diff options
author | Tomer Shalev <shalev.tomer@gmail.com> | 2009-10-17 05:39:54 +0000 |
---|---|---|
committer | Tomer Shalev <shalev.tomer@gmail.com> | 2009-10-17 05:39:54 +0000 |
commit | 4f3d7b5bcb0b025332e128c3856aa9d4cce91898 (patch) | |
tree | ac2f783e9585c476fbaa9dfaf3a7a34e826f7ccc /apps/keymaps/keymap-h10.c | |
parent | 6d4d44caf69e06ea51937da9c74e78af0ac99a62 (diff) |
USB HID: Use different context for each mode; Use constant for each action;
Rework keymaps
This commit makes the code neater and more readable. It makes it easier to
modify keymap assignments and new keypad modes.
Some platforms had their keypad mappings reworked.
The manual is updated to reflect all these changes.
H10 remote control mapping dropped.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23219 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/keymaps/keymap-h10.c')
-rw-r--r-- | apps/keymaps/keymap-h10.c | 119 |
1 files changed, 51 insertions, 68 deletions
diff --git a/apps/keymaps/keymap-h10.c b/apps/keymaps/keymap-h10.c index 8ee9a28478..9b7800a3da 100644 --- a/apps/keymaps/keymap-h10.c +++ b/apps/keymaps/keymap-h10.c @@ -339,73 +339,65 @@ static const struct button_mapping button_context_radio[] = { #ifdef USB_ENABLE_HID static const struct button_mapping button_context_usb_hid[] = { - { ACTION_USB_HID_INC, BUTTON_SCROLL_UP, BUTTON_NONE }, - { ACTION_USB_HID_INC, BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_USB_HID_DEC, BUTTON_SCROLL_DOWN, BUTTON_NONE }, - { ACTION_USB_HID_DEC, BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_USB_HID_START, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY }, - { ACTION_USB_HID_START_LONG, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY }, - { ACTION_USB_HID_QUIT, BUTTON_REW|BUTTON_REL, BUTTON_REW }, - { ACTION_USB_HID_LEFT, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT }, - { ACTION_USB_HID_LEFT_LONG, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT }, - { ACTION_USB_HID_RIGHT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT }, - { ACTION_USB_HID_RIGHT_LONG, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT }, - { ACTION_USB_HID_SELECT, BUTTON_FF|BUTTON_REL, BUTTON_FF }, - { ACTION_USB_HID_MENU, BUTTON_POWER|BUTTON_REL, BUTTON_POWER }, - { ACTION_USB_HID_MODE, BUTTON_POWER|BUTTON_REPEAT, BUTTON_POWER }, + { ACTION_USB_HID_MODE_SWITCH_NEXT, BUTTON_POWER|BUTTON_REL, BUTTON_POWER }, + { ACTION_USB_HID_MODE_SWITCH_PREV, BUTTON_POWER|BUTTON_REPEAT, BUTTON_POWER }, LAST_ITEM_IN_LIST }; /* button_context_usb_hid */ -#ifdef HAVE_USB_HID_MOUSE -static const struct button_mapping button_context_usb_hid_mouse[] = { - { ACTION_USB_HID_MOUSE_UP, BUTTON_SCROLL_UP, BUTTON_NONE }, - { ACTION_USB_HID_MOUSE_UP_REP, BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_USB_HID_MOUSE_DOWN, BUTTON_SCROLL_DOWN, BUTTON_NONE }, - { ACTION_USB_HID_MOUSE_DOWN_REP, BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_USB_HID_MOUSE_LEFT, BUTTON_LEFT, BUTTON_NONE }, - { ACTION_USB_HID_MOUSE_LEFT_REP, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_USB_HID_MOUSE_RIGHT, BUTTON_RIGHT, BUTTON_NONE }, - { ACTION_USB_HID_MOUSE_RIGHT_REP, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_USB_HID_MOUSE_BUTTON_LEFT, BUTTON_POWER, BUTTON_NONE }, - { ACTION_USB_HID_MOUSE_BUTTON_LEFT_REL, BUTTON_POWER|BUTTON_REL, BUTTON_NONE }, - { ACTION_USB_HID_MOUSE_LDRAG_UP, BUTTON_POWER|BUTTON_SCROLL_UP, BUTTON_NONE }, - { ACTION_USB_HID_MOUSE_LDRAG_UP_REP, BUTTON_POWER|BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_USB_HID_MOUSE_LDRAG_DOWN, BUTTON_POWER|BUTTON_SCROLL_DOWN, BUTTON_NONE }, - { ACTION_USB_HID_MOUSE_LDRAG_DOWN_REP, BUTTON_POWER|BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_USB_HID_MOUSE_LDRAG_LEFT, BUTTON_POWER|BUTTON_LEFT, BUTTON_NONE }, - { ACTION_USB_HID_MOUSE_LDRAG_LEFT_REP, BUTTON_POWER|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_USB_HID_MOUSE_LDRAG_RIGHT, BUTTON_POWER|BUTTON_RIGHT, BUTTON_NONE }, - { ACTION_USB_HID_MOUSE_LDRAG_RIGHT_REP, BUTTON_POWER|BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_USB_HID_MOUSE_BUTTON_RIGHT, BUTTON_PLAY, BUTTON_NONE }, - { ACTION_USB_HID_MOUSE_BUTTON_RIGHT_REL, BUTTON_PLAY|BUTTON_REL, BUTTON_NONE }, - { ACTION_USB_HID_MOUSE_RDRAG_UP, BUTTON_PLAY|BUTTON_SCROLL_UP, BUTTON_NONE }, - { ACTION_USB_HID_MOUSE_RDRAG_UP_REP, BUTTON_PLAY|BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_USB_HID_MOUSE_RDRAG_DOWN, BUTTON_PLAY|BUTTON_SCROLL_DOWN, BUTTON_NONE }, - { ACTION_USB_HID_MOUSE_RDRAG_DOWN_REP, BUTTON_PLAY|BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_USB_HID_MOUSE_RDRAG_LEFT, BUTTON_PLAY|BUTTON_LEFT, BUTTON_NONE }, - { ACTION_USB_HID_MOUSE_RDRAG_LEFT_REP, BUTTON_PLAY|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_USB_HID_MOUSE_RDRAG_RIGHT, BUTTON_PLAY|BUTTON_RIGHT, BUTTON_NONE }, - { ACTION_USB_HID_MOUSE_RDRAG_RIGHT_REP, BUTTON_PLAY|BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, +static const struct button_mapping button_context_usb_hid_mode_multimedia[] = { + { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_SCROLL_UP, BUTTON_NONE }, + { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_SCROLL_DOWN, BUTTON_NONE }, + { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_USB_HID_MULTIMEDIA_VOLUME_MUTE, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT }, + { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_PLAY_PAUSE, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY }, + { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY }, + { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_STOP, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT }, + { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_TRACK_PREV, BUTTON_REW|BUTTON_REL, BUTTON_REW }, + { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_TRACK_NEXT, BUTTON_FF|BUTTON_REL, BUTTON_FF }, LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID) -}; /* button_context_usb_hid_mouse */ -#endif +}; /* button_context_usb_hid_mode_multimedia */ + +static const struct button_mapping button_context_usb_hid_mode_presentation[] = { + { ACTION_USB_HID_PRESENTATION_SLIDESHOW_START, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY }, + { ACTION_USB_HID_PRESENTATION_SLIDESHOW_LEAVE, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY }, + { ACTION_USB_HID_PRESENTATION_SLIDE_PREV, BUTTON_REW|BUTTON_REL, BUTTON_REW }, + { ACTION_USB_HID_PRESENTATION_SLIDE_NEXT, BUTTON_FF|BUTTON_REL, BUTTON_FF }, + { ACTION_USB_HID_PRESENTATION_SLIDE_FIRST, BUTTON_REW|BUTTON_REPEAT, BUTTON_REW }, + { ACTION_USB_HID_PRESENTATION_SLIDE_LAST, BUTTON_FF|BUTTON_REPEAT, BUTTON_FF }, + { ACTION_USB_HID_PRESENTATION_SCREEN_BLACK, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT }, + { ACTION_USB_HID_PRESENTATION_SCREEN_WHITE, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT }, + { ACTION_USB_HID_PRESENTATION_LINK_PREV, BUTTON_SCROLL_UP, BUTTON_NONE }, + { ACTION_USB_HID_PRESENTATION_LINK_PREV, BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_USB_HID_PRESENTATION_LINK_NEXT, BUTTON_SCROLL_DOWN, BUTTON_NONE }, + { ACTION_USB_HID_PRESENTATION_LINK_NEXT, BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_USB_HID_PRESENTATION_MOUSE_CLICK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT }, + { ACTION_USB_HID_PRESENTATION_MOUSE_OVER, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT }, -static const struct button_mapping remote_button_context_usb_hid[] = { - { ACTION_USB_HID_INC, BUTTON_RC_VOL_UP, BUTTON_NONE }, - { ACTION_USB_HID_INC, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_USB_HID_DEC, BUTTON_RC_VOL_DOWN, BUTTON_NONE }, - { ACTION_USB_HID_DEC, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_USB_HID_START, BUTTON_RC_PLAY|BUTTON_REL, BUTTON_RC_PLAY }, - { ACTION_USB_HID_QUIT, BUTTON_RC_PLAY|BUTTON_REPEAT, BUTTON_RC_PLAY }, - { ACTION_USB_HID_LEFT, BUTTON_RC_REW|BUTTON_REL, BUTTON_RC_REW }, - { ACTION_USB_HID_LEFT_LONG, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_RC_REW }, - { ACTION_USB_HID_RIGHT, BUTTON_RC_FF|BUTTON_REL, BUTTON_RC_FF }, - { ACTION_USB_HID_RIGHT_LONG, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_RC_FF }, + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID) +}; /* button_context_usb_hid_mode_presentation */ + +static const struct button_mapping button_context_usb_hid_mode_browser[] = { + { ACTION_USB_HID_BROWSER_SCROLL_UP, BUTTON_SCROLL_UP, BUTTON_NONE }, + { ACTION_USB_HID_BROWSER_SCROLL_UP, BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_USB_HID_BROWSER_SCROLL_DOWN, BUTTON_SCROLL_DOWN, BUTTON_NONE }, + { ACTION_USB_HID_BROWSER_SCROLL_DOWN, BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_USB_HID_BROWSER_SCROLL_PAGE_UP, BUTTON_REW|BUTTON_REL, BUTTON_REW }, + { ACTION_USB_HID_BROWSER_SCROLL_PAGE_DOWN, BUTTON_FF|BUTTON_REL, BUTTON_FF }, + { ACTION_USB_HID_BROWSER_ZOOM_IN, BUTTON_REW|BUTTON_REPEAT, BUTTON_REW }, + { ACTION_USB_HID_BROWSER_ZOOM_OUT, BUTTON_FF|BUTTON_REPEAT, BUTTON_FF }, + { ACTION_USB_HID_BROWSER_ZOOM_RESET, BUTTON_REW|BUTTON_FF|BUTTON_REPEAT, BUTTON_REW|BUTTON_FF }, + { ACTION_USB_HID_BROWSER_TAB_PREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT }, + { ACTION_USB_HID_BROWSER_TAB_NEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT }, + { ACTION_USB_HID_BROWSER_TAB_CLOSE, BUTTON_LEFT|BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_LEFT|BUTTON_RIGHT }, + { ACTION_USB_HID_BROWSER_HISTORY_BACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT }, + { ACTION_USB_HID_BROWSER_HISTORY_FORWARD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT }, + { ACTION_USB_HID_BROWSER_VIEW_FULL_SCREEN, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY }, - LAST_ITEM_IN_LIST -}; /* remote_button_context_usb_hid */ + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID) +}; /* button_context_usb_hid_mode_browser */ #endif static const struct button_mapping* get_context_mapping_remote( int context ) @@ -437,11 +429,6 @@ static const struct button_mapping* get_context_mapping_remote( int context ) return remote_button_context_pitchscreen; case CONTEXT_RECSCREEN: return button_context_recscreen; -#ifdef USB_ENABLE_HID - case CONTEXT_USB_HID: - return remote_button_context_usb_hid; -#endif - default: return remote_button_context_standard; } @@ -498,10 +485,6 @@ const struct button_mapping* get_context_mapping(int context) #ifdef USB_ENABLE_HID case CONTEXT_USB_HID: return button_context_usb_hid; -#ifdef HAVE_USB_HID_MOUSE - case CONTEXT_USB_HID_MOUSE: - return button_context_usb_hid_mouse; -#endif #endif default: return button_context_standard; |