Enable volume keys in Android.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29559 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Björn Stenberg 2011-03-10 22:53:58 +00:00
parent b8f29c7eed
commit 8196f21a94
4 changed files with 20 additions and 1 deletions

View file

@ -60,11 +60,21 @@ static const struct button_mapping button_context_wps[] = {
{ ACTION_WPS_BROWSE, BUTTON_BACK, BUTTON_NONE },
{ ACTION_WPS_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
{ ACTION_WPS_CONTEXT, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
{ ACTION_WPS_VOLUP, BUTTON_VOL_UP, BUTTON_NONE },
{ ACTION_WPS_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_WPS_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE },
{ ACTION_WPS_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
LAST_ITEM_IN_LIST
}; /* button_context_wps */
static const struct button_mapping button_context_list[] = {
#ifdef HAVE_VOLUME_IN_LIST
{ ACTION_LIST_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_LIST_VOLUP, BUTTON_VOL_UP, BUTTON_NONE },
{ ACTION_LIST_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE },
{ ACTION_LIST_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
#endif
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
}; /* button_context_list */

View file

@ -76,6 +76,9 @@
#define HAVE_MULTIMEDIA_KEYS
#define CONFIG_KEYPAD ANDROID_PAD
/* define this if the target has volume keys which can be used in the lists */
#define HAVE_VOLUME_IN_LIST
#define HAVE_SW_TONE_CONTROLS
/* Define current usage levels. */

View file

@ -39,6 +39,10 @@ int key_to_button(int keyboard_key)
return BUTTON_MENU;
case KEYCODE_DPAD_CENTER:
return BUTTON_DPAD_CENTER;
case KEYCODE_VOLUME_UP:
return BUTTON_VOL_UP;
case KEYCODE_VOLUME_DOWN:
return BUTTON_VOL_DOWN;
default:
return BUTTON_NONE;
}

View file

@ -40,6 +40,8 @@ void android_ignore_back_button(bool yes);
#define BUTTON_DPAD_UP 0x00000010
#define BUTTON_DPAD_DOWN 0x00000020
#define BUTTON_DPAD_CENTER 0x00000040
#define BUTTON_VOL_UP 0x00000080
#define BUTTON_VOL_DOWN 0x00000100
/* Compatibility hacks for flipping. Needs a somewhat better fix. */
#define BUTTON_LEFT BUTTON_DPAD_LEFT