1
0
Fork 0
forked from len0rd/rockbox

Add HID keymap handling in usb screen. This allows to use the DAP as a keypad to control the PC. The current keymaps are audio-oriented (play/pause/volume/...) (FS#10218 by Tomer Shalev)

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21054 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Frank Gevaerts 2009-05-23 14:42:54 +00:00
parent c61a75173b
commit 08fb988e87
14 changed files with 422 additions and 11 deletions

View file

@ -188,6 +188,23 @@ const struct button_mapping button_context_recscreen[] = {
}; /* button_context_recscreen */
#endif
#ifdef HAVE_USBSTACK
static const struct button_mapping button_context_usb_hid[] = {
{ ACTION_USB_HID_PLAY, BUTTON_PLAY, BUTTON_NONE },
{ ACTION_USB_HID_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_USB_HID_SKIPPREV, BUTTON_LEFT, BUTTON_NONE },
{ ACTION_USB_HID_SKIPNEXT, BUTTON_RIGHT, BUTTON_NONE },
{ ACTION_USB_HID_VOLUP, BUTTON_SCROLL_FWD, BUTTON_NONE },
{ ACTION_USB_HID_VOLUP, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_USB_HID_VOLDOWN, BUTTON_SCROLL_BACK, BUTTON_NONE },
{ ACTION_USB_HID_VOLDOWN, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_USB_HID_MUTE, BUTTON_SELECT, BUTTON_NONE },
{ ACTION_USB_HID_MENU, BUTTON_MENU, BUTTON_NONE },
LAST_ITEM_IN_LIST
}; /* button_context_usb_hid */
#endif
#if BUTTON_REMOTE != 0
/*****************************************************************************
* Remote control mappings
@ -220,6 +237,20 @@ static const struct button_mapping remote_button_context_wps[] = {
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
};
#ifdef HAVE_USBSTACK
static const struct button_mapping remote_button_context_usb_hid[] = {
{ ACTION_USB_HID_PLAY, BUTTON_RC_PLAY, BUTTON_NONE },
{ ACTION_USB_HID_STOP, BUTTON_RC_PLAY|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_USB_HID_SKIPPREV, BUTTON_RC_LEFT, BUTTON_NONE },
{ ACTION_USB_HID_SKIPNEXT, BUTTON_RC_RIGHT, BUTTON_NONE },
{ ACTION_USB_HID_VOLUP, BUTTON_RC_VOL_UP, BUTTON_NONE },
{ ACTION_USB_HID_VOLUP, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_USB_HID_VOLDOWN, BUTTON_RC_VOL_DOWN, BUTTON_NONE },
{ ACTION_USB_HID_VOLDOWN, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
LAST_ITEM_IN_LIST
}; /* remote_button_context_usb_hid */
#endif
static const struct button_mapping* get_context_mapping_remote( int context )
{
@ -229,7 +260,10 @@ static const struct button_mapping* get_context_mapping_remote( int context )
{
case CONTEXT_WPS:
return remote_button_context_wps;
#ifdef HAVE_USBSTACK
case CONTEXT_USB_HID:
return remote_button_context_usb_hid;
#endif
default:
return remote_button_context_standard;
}
@ -281,6 +315,10 @@ const struct button_mapping* get_context_mapping(int context)
#ifdef HAVE_RECORDING
case CONTEXT_RECSCREEN:
return button_context_recscreen;
#endif
#ifdef HAVE_USBSTACK
case CONTEXT_USB_HID:
return button_context_usb_hid;
#endif
default:
return button_context_standard;