From 374a08ab31c3e298fd6d956423e9493c8f837718 Mon Sep 17 00:00:00 2001 From: Amaury Pouly Date: Wed, 30 Nov 2011 18:39:22 +0000 Subject: [PATCH] fuze+: update keymap and touchpad driver based on FS#12405 with minor modifications. Thanks to Jean-Louis Biasini. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31098 a1c6a512-1295-4272-9138-f99709370657 --- apps/keymaps/keymap-fuzeplus.c | 394 ++++++++++++++++-- docs/CREDITS | 1 + firmware/export/config/sansafuzeplus.h | 6 + .../imx233/sansa-fuzeplus/button-fuzeplus.c | 83 +++- .../arm/imx233/sansa-fuzeplus/button-target.h | 27 +- uisimulator/buttonmap/sansa-fuzeplus.c | 25 +- 6 files changed, 463 insertions(+), 73 deletions(-) diff --git a/apps/keymaps/keymap-fuzeplus.c b/apps/keymaps/keymap-fuzeplus.c index 5ec543585f..a5d952652f 100644 --- a/apps/keymaps/keymap-fuzeplus.c +++ b/apps/keymaps/keymap-fuzeplus.c @@ -33,44 +33,330 @@ * Insert LAST_ITEM_IN_LIST at the end of each mapping */ static const struct button_mapping button_context_standard[] = { - { ACTION_STD_PREV, BUTTON_LEFT, BUTTON_NONE }, - { ACTION_STD_PREV, BUTTON_UP, BUTTON_NONE }, - { ACTION_STD_PREVREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, - - { ACTION_STD_NEXT, BUTTON_RIGHT, BUTTON_NONE }, - { ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE }, - { ACTION_STD_NEXTREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, - - { ACTION_STD_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT }, - { ACTION_STD_CANCEL, BUTTON_BACK, BUTTON_NONE }, - { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT }, + { ACTION_STD_PREV, BUTTON_UP, BUTTON_NONE }, + { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE }, + { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + + { ACTION_STD_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT }, + { ACTION_STD_CANCEL, BUTTON_BACK|BUTTON_REL, BUTTON_BACK }, + { ACTION_STD_CANCEL, BUTTON_LEFT, BUTTON_NONE }, + + + { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT }, + { ACTION_STD_OK, BUTTON_RIGHT, BUTTON_NONE }, + +#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 + + { ACTION_TREE_WPS, BUTTON_PLAYPAUSE|BUTTON_REL, BUTTON_PLAYPAUSE }, + { ACTION_TREE_STOP, BUTTON_PLAYPAUSE|BUTTON_REPEAT, BUTTON_NONE }, + + { ACTION_STD_KEYLOCK, BUTTON_POWER, BUTTON_NONE }, + { ACTION_STD_KEYLOCK, BUTTON_TWO_FINGERS|BUTTON_REL, BUTTON_TWO_FINGERS|BUTTON_REPEAT }, LAST_ITEM_IN_LIST }; /* button_context_standard */ + +static const struct button_mapping button_context_list[] = { + + { ACTION_LISTTREE_PGUP, BUTTON_BOTTOMLEFT, BUTTON_NONE }, + { ACTION_LISTTREE_PGUP, BUTTON_BOTTOMLEFT|BUTTON_REPEAT, BUTTON_BOTTOMLEFT }, + { ACTION_LISTTREE_PGDOWN, BUTTON_BOTTOMRIGHT, BUTTON_NONE }, + { ACTION_LISTTREE_PGDOWN, BUTTON_BOTTOMRIGHT|BUTTON_REPEAT, BUTTON_BOTTOMRIGHT }, +#ifdef HAVE_HOTKEY + { ACTION_TREE_HOTKEY, BUTTON_BACK|BUTTON_REL, BUTTON_BACK|BUTTON_REPEAT }, +#endif + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) +}; /* button_context_list */ + static const struct button_mapping button_context_wps[] = { - { ACTION_WPS_PLAY, BUTTON_PLAYPAUSE|BUTTON_REL, BUTTON_PLAYPAUSE }, - { ACTION_WPS_SKIPNEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT }, - { ACTION_WPS_SKIPPREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT }, - { ACTION_WPS_SEEKBACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_WPS_SEEKFWD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_WPS_STOPSEEK, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT }, - { ACTION_WPS_STOPSEEK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT }, - { ACTION_WPS_STOP, BUTTON_PLAYPAUSE|BUTTON_REPEAT, BUTTON_PLAYPAUSE }, - { ACTION_WPS_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE }, - { ACTION_WPS_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT,BUTTON_NONE }, - { ACTION_WPS_VOLUP, BUTTON_VOL_UP, BUTTON_NONE }, - { ACTION_WPS_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_WPS_PLAY, BUTTON_PLAYPAUSE|BUTTON_REL, BUTTON_PLAYPAUSE }, + { ACTION_WPS_STOP, BUTTON_PLAYPAUSE|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_WPS_MENU, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT }, - { ACTION_WPS_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT }, + { ACTION_WPS_MENU, BUTTON_BACK|BUTTON_REL, BUTTON_BACK }, - LAST_ITEM_IN_LIST + { ACTION_WPS_BROWSE, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT }, + { ACTION_WPS_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE }, + + { ACTION_WPS_SKIPNEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT }, + { ACTION_WPS_SEEKFWD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT }, + { ACTION_WPS_SKIPPREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT }, + { ACTION_WPS_SEEKBACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT }, + { ACTION_WPS_STOPSEEK, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT }, + { ACTION_WPS_STOPSEEK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT }, + + { ACTION_WPS_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE }, + { ACTION_WPS_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_WPS_VOLUP, BUTTON_VOL_UP, BUTTON_NONE }, + { ACTION_WPS_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, + + { ACTION_WPS_VOLUP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_WPS_VOLDOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_WPS_VOLUP, BUTTON_UP, BUTTON_NONE }, + { ACTION_WPS_VOLDOWN, BUTTON_DOWN, BUTTON_NONE }, + + { ACTION_WPS_REC, BUTTON_BACK|BUTTON_REPEAT, BUTTON_BACK }, + { ACTION_WPS_PITCHSCREEN, BUTTON_BOTTOMLEFT|BUTTON_REPEAT, BUTTON_BOTTOMLEFT }, + { ACTION_WPS_QUICKSCREEN, BUTTON_BOTTOMLEFT|BUTTON_REL, BUTTON_BOTTOMLEFT }, + { ACTION_WPS_ID3SCREEN, BUTTON_BOTTOMRIGHT|BUTTON_REPEAT, BUTTON_BOTTOMRIGHT }, + + { ACTION_WPS_HOTKEY, BUTTON_BOTTOMRIGHT|BUTTON_REL, BUTTON_BOTTOMRIGHT }, + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) }; /* button_context_wps */ +static const struct button_mapping button_context_keyboard[] = { + { ACTION_KBD_LEFT, BUTTON_LEFT, BUTTON_NONE }, + { ACTION_KBD_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_KBD_RIGHT, BUTTON_RIGHT, BUTTON_NONE }, + { ACTION_KBD_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_KBD_UP, BUTTON_UP, BUTTON_NONE }, + { ACTION_KBD_UP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_KBD_DOWN, BUTTON_DOWN, BUTTON_NONE }, + { ACTION_KBD_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_KBD_CURSOR_LEFT, BUTTON_BOTTOMLEFT, BUTTON_NONE }, + { ACTION_KBD_CURSOR_LEFT, BUTTON_BOTTOMLEFT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_KBD_CURSOR_RIGHT, BUTTON_BOTTOMRIGHT, BUTTON_NONE }, + { ACTION_KBD_CURSOR_RIGHT, BUTTON_BOTTOMRIGHT|BUTTON_REPEAT, BUTTON_NONE }, + + { ACTION_KBD_BACKSPACE, BUTTON_BACK, BUTTON_NONE }, + { ACTION_KBD_BACKSPACE, BUTTON_BACK|BUTTON_REPEAT, BUTTON_NONE }, + + { ACTION_KBD_SELECT, BUTTON_PLAYPAUSE|BUTTON_REL, BUTTON_PLAYPAUSE }, + { ACTION_KBD_DONE, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_KBD_ABORT, BUTTON_POWER, BUTTON_NONE }, + + LAST_ITEM_IN_LIST +}; /* button_context_keyboard */ + +static const struct button_mapping button_context_quickscreen[] = { + { ACTION_STD_CANCEL, BUTTON_SELECT|BUTTON_REL, BUTTON_NONE }, + { ACTION_STD_CANCEL, BUTTON_BACK|BUTTON_REL, BUTTON_NONE }, + { ACTION_STD_CANCEL, BUTTON_PLAYPAUSE|BUTTON_REL, BUTTON_NONE }, + { ACTION_STD_CANCEL, BUTTON_BOTTOMRIGHT|BUTTON_REL, BUTTON_NONE }, + { ACTION_STD_CANCEL, BUTTON_BOTTOMLEFT|BUTTON_REL, BUTTON_NONE }, + { ACTION_QS_TOP, BUTTON_UP|BUTTON_REL, BUTTON_NONE }, + { ACTION_QS_TOP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_QS_DOWN, BUTTON_DOWN|BUTTON_REL, BUTTON_NONE }, + { ACTION_QS_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_QS_LEFT, BUTTON_LEFT|BUTTON_REL, BUTTON_NONE }, + { ACTION_QS_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_QS_RIGHT, BUTTON_RIGHT|BUTTON_REL, BUTTON_NONE }, + { ACTION_QS_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, + + LAST_ITEM_IN_LIST +}; /* button_context_quickscreen */ + +static const struct button_mapping button_context_tree[] = { + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST) +}; /* button_context_tree */ + +static const struct button_mapping button_context_radio[] = { + { ACTION_STD_PREV, BUTTON_LEFT, BUTTON_NONE }, + { ACTION_STD_PREVREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_STD_NEXT, BUTTON_RIGHT, BUTTON_NONE }, + { ACTION_STD_NEXTREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, + + { ACTION_FM_MENU, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_FM_PRESET, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT }, + { ACTION_FM_PLAY, BUTTON_PLAYPAUSE|BUTTON_REL, BUTTON_PLAYPAUSE }, + { ACTION_FM_STOP, BUTTON_BOTTOMRIGHT|BUTTON_REL, BUTTON_NONE }, + { ACTION_FM_MODE, BUTTON_BOTTOMLEFT|BUTTON_REL, BUTTON_BOTTOMLEFT }, + + { ACTION_FM_EXIT, BUTTON_BACK|BUTTON_REL, BUTTON_NONE }, + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) +}; /* button_context_radio */ + +static const struct button_mapping button_context_recscreen[] = { + { ACTION_REC_PAUSE, BUTTON_PLAYPAUSE|BUTTON_REL, BUTTON_PLAYPAUSE }, + { ACTION_REC_NEWFILE, BUTTON_BOTTOMRIGHT|BUTTON_REPEAT, BUTTON_NONE }, + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS) +}; /* button_context_recscreen */ + +static const struct button_mapping button_context_time[] = { + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS) +}; /* button_context_time */ + +static const struct button_mapping button_context_settings_right_is_inc[] = { + { ACTION_SETTINGS_INC, BUTTON_RIGHT, BUTTON_NONE }, + { ACTION_SETTINGS_INCREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_SETTINGS_DEC, BUTTON_LEFT, BUTTON_NONE }, + { ACTION_SETTINGS_DECREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, + + { ACTION_SETTINGS_RESET, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE }, + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) +}; /* button_context_settingsgraphical */ + +static const struct button_mapping button_context_settings[] = { + { ACTION_SETTINGS_INC, BUTTON_UP, BUTTON_NONE }, + { ACTION_SETTINGS_INCREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_SETTINGS_DEC, BUTTON_DOWN, BUTTON_NONE }, + { ACTION_SETTINGS_DECREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + + { ACTION_STD_PREV, BUTTON_LEFT, BUTTON_NONE }, + { ACTION_STD_PREVREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_STD_NEXT, BUTTON_RIGHT, BUTTON_NONE }, + { ACTION_STD_NEXTREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, + + { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT }, + + { ACTION_SETTINGS_RESET, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT }, + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) +}; /* button_context_settings */ + +static const struct button_mapping button_context_colorchooser[] = { + { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT }, + { ACTION_STD_CANCEL, BUTTON_BACK, BUTTON_NONE }, + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS), +}; /* button_context_colorchooser */ + +static const struct button_mapping button_context_eq[] = { + { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT }, + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS), +}; /* button_context_eq */ + +/* Bookmark Screen */ +static const struct button_mapping button_context_bmark[] = { + { ACTION_BMS_DELETE, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT }, + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST), +}; /* button_context_bmark */ + +static const struct button_mapping button_context_pitchscreen[] = { + + { ACTION_PS_INC_SMALL, BUTTON_UP, BUTTON_NONE }, + { ACTION_PS_INC_BIG, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_PS_DEC_SMALL, BUTTON_DOWN, BUTTON_NONE }, + { ACTION_PS_DEC_BIG, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_PS_NUDGE_LEFT, BUTTON_LEFT, BUTTON_NONE }, + { ACTION_PS_NUDGE_LEFTOFF, BUTTON_LEFT|BUTTON_REL, BUTTON_NONE }, + { ACTION_PS_NUDGE_RIGHT, BUTTON_RIGHT, BUTTON_NONE }, + { ACTION_PS_NUDGE_RIGHTOFF, BUTTON_RIGHT|BUTTON_REL, BUTTON_NONE }, + { ACTION_PS_TOGGLE_MODE, BUTTON_PLAYPAUSE, BUTTON_NONE }, + { ACTION_PS_TOGGLE_MODE, BUTTON_BOTTOMRIGHT, BUTTON_NONE }, + { ACTION_PS_RESET, BUTTON_SELECT, BUTTON_NONE }, + { ACTION_PS_EXIT, BUTTON_BACK, BUTTON_NONE }, + { ACTION_PS_SLOWER, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_PS_FASTER, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, + LAST_ITEM_IN_LIST +}; /* button_context_pitchcreen */ + +static const struct button_mapping button_context_yesno[] = { + { ACTION_YESNO_ACCEPT, BUTTON_SELECT, BUTTON_NONE }, + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) +}; /* button_context_yesno */ + +#ifdef USB_ENABLE_HID +static const struct button_mapping button_context_usb_hid[] = { + { 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 */ + +static const struct button_mapping button_context_usb_hid_mode_multimedia[] = { + + { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_DOWN, BUTTON_NONE }, + { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_UP, BUTTON_NONE }, + { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_VOL_DOWN, BUTTON_NONE }, + { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_VOL_UP, BUTTON_NONE }, + { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_USB_HID_MULTIMEDIA_VOLUME_MUTE, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT }, + { ACTION_USB_HID_MULTIMEDIA_VOLUME_MUTE, BUTTON_BACK|BUTTON_REL, BUTTON_BACK }, + { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_PLAY_PAUSE, BUTTON_PLAYPAUSE|BUTTON_REL, BUTTON_PLAYPAUSE }, + { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_STOP, BUTTON_PLAYPAUSE|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_TRACK_PREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT }, + { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_TRACK_NEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT }, + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID) +}; /* button_context_usb_hid_mode_multimedia */ + + +static const struct button_mapping button_context_usb_hid_mode_presentation[] = { + { ACTION_USB_HID_PRESENTATION_SLIDESHOW_START, BUTTON_PLAYPAUSE|BUTTON_REL, BUTTON_PLAYPAUSE }, + { ACTION_USB_HID_PRESENTATION_SLIDESHOW_LEAVE, BUTTON_PLAYPAUSE|BUTTON_REPEAT, BUTTON_PLAYPAUSE }, + { ACTION_USB_HID_PRESENTATION_SLIDE_PREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT }, + { ACTION_USB_HID_PRESENTATION_SLIDE_NEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT }, + { ACTION_USB_HID_PRESENTATION_SLIDE_FIRST, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT }, + { ACTION_USB_HID_PRESENTATION_SLIDE_LAST, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT }, + { ACTION_USB_HID_PRESENTATION_SCREEN_BLACK, BUTTON_BOTTOMRIGHT|BUTTON_REL, BUTTON_BOTTOMRIGHT }, + { ACTION_USB_HID_PRESENTATION_SCREEN_WHITE, BUTTON_BOTTOMRIGHT|BUTTON_REPEAT, BUTTON_BOTTOMRIGHT }, + { ACTION_USB_HID_PRESENTATION_LINK_PREV, BUTTON_UP, BUTTON_NONE }, + { ACTION_USB_HID_PRESENTATION_LINK_PREV, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_USB_HID_PRESENTATION_LINK_NEXT, BUTTON_DOWN, BUTTON_NONE }, + { ACTION_USB_HID_PRESENTATION_LINK_NEXT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_USB_HID_PRESENTATION_MOUSE_CLICK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT }, + { ACTION_USB_HID_PRESENTATION_MOUSE_OVER, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT }, + + 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_UP, BUTTON_NONE }, + { ACTION_USB_HID_BROWSER_SCROLL_UP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_USB_HID_BROWSER_SCROLL_DOWN, BUTTON_DOWN, BUTTON_NONE }, + { ACTION_USB_HID_BROWSER_SCROLL_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + + { ACTION_USB_HID_BROWSER_ZOOM_IN, BUTTON_PLAYPAUSE|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_USB_HID_BROWSER_ZOOM_OUT, BUTTON_BOTTOMRIGHT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_USB_HID_BROWSER_ZOOM_RESET, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT }, + { ACTION_USB_HID_BROWSER_ZOOM_RESET, BUTTON_PLAYPAUSE|BUTTON_BOTTOMRIGHT|BUTTON_REPEAT, BUTTON_PLAYPAUSE|BUTTON_BOTTOMRIGHT }, + { 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_BACK|BUTTON_REPEAT, BUTTON_BACK }, + { 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_SELECT|BUTTON_REL, BUTTON_SELECT }, + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID) +}; /* button_context_usb_hid_mode_browser */ + +#ifdef HAVE_USB_HID_MOUSE +static const struct button_mapping button_context_usb_hid_mode_mouse[] = { + { ACTION_USB_HID_MOUSE_UP, BUTTON_UP, BUTTON_NONE }, + { ACTION_USB_HID_MOUSE_UP_REP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_USB_HID_MOUSE_DOWN, BUTTON_DOWN, BUTTON_NONE }, + { ACTION_USB_HID_MOUSE_DOWN_REP, BUTTON_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_SELECT, BUTTON_NONE }, + { ACTION_USB_HID_MOUSE_BUTTON_LEFT_REL, BUTTON_SELECT|BUTTON_REL, BUTTON_NONE }, + + { ACTION_USB_HID_MOUSE_BUTTON_RIGHT, BUTTON_PLAYPAUSE, BUTTON_NONE }, + { ACTION_USB_HID_MOUSE_BUTTON_RIGHT_REL, BUTTON_PLAYPAUSE|BUTTON_REL, BUTTON_PLAYPAUSE }, + + { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_UP, BUTTON_BACK, BUTTON_NONE }, + { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_UP, BUTTON_BACK|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_DOWN, BUTTON_BOTTOMLEFT, BUTTON_NONE }, + { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_DOWN, BUTTON_BOTTOMLEFT|BUTTON_REPEAT, BUTTON_NONE }, + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID) +}; /* button_context_usb_hid_mode_mouse */ +#endif +#endif /* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */ const struct button_mapping* get_context_mapping(int context) @@ -79,13 +365,53 @@ const struct button_mapping* get_context_mapping(int context) { case CONTEXT_STD: return button_context_standard; - case CONTEXT_WPS: - return button_context_wps; - - case CONTEXT_TREE: - case CONTEXT_LIST: - case CONTEXT_MAINMENU: case CONTEXT_SETTINGS: + return button_context_settings; + case CONTEXT_WPS: + return button_context_wps; + case CONTEXT_YESNOSCREEN: + return button_context_yesno; + case CONTEXT_SETTINGS_TIME: + return button_context_time; + case CONTEXT_KEYBOARD: + case CONTEXT_MORSE_INPUT: + return button_context_keyboard; + case CONTEXT_FM: + return button_context_radio; + case CONTEXT_LIST: + return button_context_list; + case CONTEXT_TREE: + return button_context_tree; + case CONTEXT_SETTINGS_EQ: + return button_context_eq; + case CONTEXT_RECSCREEN: + return button_context_recscreen; + case CONTEXT_QUICKSCREEN: + return button_context_quickscreen; + case CONTEXT_BOOKMARKSCREEN: + return button_context_bmark; + case CONTEXT_PITCHSCREEN: + return button_context_pitchscreen; + case CONTEXT_SETTINGS_COLOURCHOOSER: + return button_context_colorchooser; + case CONTEXT_SETTINGS_RECTRIGGER: + return button_context_settings_right_is_inc; + case CONTEXT_CUSTOM|CONTEXT_SETTINGS: + return button_context_settings_right_is_inc; +#ifdef USB_ENABLE_HID + case CONTEXT_USB_HID: + return button_context_usb_hid; + case CONTEXT_USB_HID_MODE_MULTIMEDIA: + return button_context_usb_hid_mode_multimedia; + case CONTEXT_USB_HID_MODE_PRESENTATION: + return button_context_usb_hid_mode_presentation; + case CONTEXT_USB_HID_MODE_BROWSER: + return button_context_usb_hid_mode_browser; +#ifdef HAVE_USB_HID_MOUSE + case CONTEXT_USB_HID_MODE_MOUSE: + return button_context_usb_hid_mode_mouse; +#endif +#endif default: return button_context_standard; } diff --git a/docs/CREDITS b/docs/CREDITS index 2124fab86a..614b165afd 100644 --- a/docs/CREDITS +++ b/docs/CREDITS @@ -609,6 +609,7 @@ Stanislav Chizhik Desu Rozen Olivier Kaloudoff Kessia Pinheiro +Jean-Louis Biasini The libmad team The wavpack team diff --git a/firmware/export/config/sansafuzeplus.h b/firmware/export/config/sansafuzeplus.h index 8039b8699f..c9376cca59 100644 --- a/firmware/export/config/sansafuzeplus.h +++ b/firmware/export/config/sansafuzeplus.h @@ -37,6 +37,9 @@ /* define this to enable JPEG decoding */ #define HAVE_JPEG +/* Define this if a programmable hotkey is mapped */ +#define HAVE_HOTKEY + /* define this if you have access to the quickscreen */ #define HAVE_QUICKSCREEN @@ -46,6 +49,9 @@ /* define this if you would like tagcache to build on this target */ #define HAVE_TAGCACHE +/* define this if the target has volume keys which can be used in the lists */ +#define HAVE_VOLUME_IN_LIST + /* define this if you have LCD enable function */ #define HAVE_LCD_ENABLE diff --git a/firmware/target/arm/imx233/sansa-fuzeplus/button-fuzeplus.c b/firmware/target/arm/imx233/sansa-fuzeplus/button-fuzeplus.c index 47fafb6713..0250d276d9 100644 --- a/firmware/target/arm/imx233/sansa-fuzeplus/button-fuzeplus.c +++ b/firmware/target/arm/imx233/sansa-fuzeplus/button-fuzeplus.c @@ -41,6 +41,7 @@ bool button_debug_screen(void) int sensor_resol = rmi_read_single(RMI_2D_SENSOR_RESOLUTION(0)); int min_dist = rmi_read_single(RMI_2D_MIN_DIST); int gesture_settings = rmi_read_single(RMI_2D_GESTURE_SETTINGS); + int sensibility_counter = 0; union { unsigned char data; @@ -157,10 +158,15 @@ bool button_debug_screen(void) if(btns & BUTTON_VOL_DOWN || btns & BUTTON_VOL_UP) { if(btns & BUTTON_VOL_UP) - sensitivity.value++; + sensibility_counter++; if(btns & BUTTON_VOL_DOWN) - sensitivity.value--; - rmi_write(RMI_2D_SENSITIVITY_ADJ, 1, &sensitivity.data); + sensibility_counter--; + if((sensibility_counter == -15) || (sensibility_counter == 15)) + { + sensitivity.value += (sensibility_counter / 15); + sensibility_counter = 0; + } + rmi_write(RMI_2D_SENSITIVITY_ADJ, 1, &sensitivity.data); } yield(); @@ -179,19 +185,23 @@ struct button_area_t static struct button_area_t button_areas[] = { - {1300, 600, 1700, 1100, BUTTON_SELECT}, - {500, 600, 1100, 1100, BUTTON_LEFT}, - {1900, 600, 2500, 1100, BUTTON_RIGHT}, - {1300, 0, 1700, 400, BUTTON_DOWN}, - {1300, 1300, 1700, 1800, BUTTON_UP}, - {2500, 1600, 2900, 1800, BUTTON_PLAYPAUSE}, - {300, 1600, 500, 1800, BUTTON_BACK}, + {1003, 658, 2006, 1316, BUTTON_SELECT}, + {0, 658, 1003, 1316, BUTTON_LEFT}, + {2006, 658, 3009, 1316, BUTTON_RIGHT}, + {1003, 0 , 2006, 658, BUTTON_DOWN}, + {1003, 1316, 2006, 1974, BUTTON_UP}, + {2006, 1316, 3009, 1974, BUTTON_PLAYPAUSE}, + {0, 1316, 1003, 1974, BUTTON_BACK}, + {0, 0 , 1003, 658, BUTTON_BOTTOMLEFT}, + {2006, 0 , 3009, 658, BUTTON_BOTTOMRIGHT}, {0, 0, 0, 0, 0}, }; #define RMI_INTERRUPT 1 static int touchpad_btns = 0; +static bool two_fingers_mode = 0; +static int button_delay = 0; static long rmi_stack [DEFAULT_STACK_SIZE/sizeof(long)]; static const char rmi_thread_name[] = "rmi"; static struct event_queue rmi_queue; @@ -255,10 +265,46 @@ static void rmi_thread(void) int absolute_y = u.s.absolute.y_msb << 8 | u.s.absolute.y_lsb; int nr_fingers = u.s.absolute.misc & 7; - if(nr_fingers == 0) - touchpad_btns = 0; - else - touchpad_btns = find_button(absolute_x, absolute_y); + /* Handle the single vs two fingers event considering the following issues: + - When they are two fingers on the touchpad the signal often + switch between 1 and 2 fingers. We use the bool + two_fingers_mode to "lock" the two fingers's signal + as long as the user doesn't release the touchpad + - User can hit the device at first with only one finger while + trying to do a double fingers's touch. In order to "smooth" + the signal, we set a delay on single finger so that user as + time to actually touch with 2 finger if he meant to. + */ + + switch(nr_fingers) + { + case 2: + /* enter two fingers mode */ + two_fingers_mode = 1; + touchpad_btns = BUTTON_TWO_FINGERS; + break; + case 1: + /* Ignore any touch when in two fingers mode */ + if (two_fingers_mode) + touchpad_btns = BUTTON_TWO_FINGERS; + else + { + if(button_delay > 2) + touchpad_btns = find_button(absolute_x, absolute_y); + else + button_delay++; + } + break; + case 0: + /* reset two fingers mode and delay */ + two_fingers_mode = 0; + button_delay = 0; + touchpad_btns = 0; + break; + default: + break; + } + /* enable interrupt */ imx233_setup_pin_irq(0, 27, true, true, false, &rmi_attn_cb); } @@ -299,11 +345,10 @@ void button_init_device(void) char product_id[RMI_PRODUCT_ID_LEN]; rmi_read(RMI_PRODUCT_ID, RMI_PRODUCT_ID_LEN, product_id); - /* adjust sensitivity based on product ID like the OF */ - if(product_id[1] > 2) - rmi_write_single(RMI_2D_SENSITIVITY_ADJ, 0); - else - rmi_write_single(RMI_2D_SENSITIVITY_ADJ, 13); + /* The OF adjust the sensitivity based on product_id[1] compared to 2. + * Since it doesn't to work great, just hardcode the sensitivity to + * some reasonable value for now. */ + rmi_write_single(RMI_2D_SENSITIVITY_ADJ, 13); rmi_write_single(RMI_2D_GESTURE_SETTINGS, RMI_2D_GESTURE_PRESS_TIME_300MS | diff --git a/firmware/target/arm/imx233/sansa-fuzeplus/button-target.h b/firmware/target/arm/imx233/sansa-fuzeplus/button-target.h index 686872d6cb..2e5e6c157c 100644 --- a/firmware/target/arm/imx233/sansa-fuzeplus/button-target.h +++ b/firmware/target/arm/imx233/sansa-fuzeplus/button-target.h @@ -29,21 +29,26 @@ int button_read_device(void); bool button_debug_screen(void); /* Main unit's buttons */ -#define BUTTON_POWER 0x00000001 -#define BUTTON_VOL_UP 0x00000002 -#define BUTTON_VOL_DOWN 0x00000004 +#define BUTTON_POWER 0x00000001 +#define BUTTON_VOL_UP 0x00000002 +#define BUTTON_VOL_DOWN 0x00000004 /* Virtual buttons */ -#define BUTTON_LEFT 0x00000008 -#define BUTTON_UP 0x00000010 -#define BUTTON_RIGHT 0x00000020 -#define BUTTON_DOWN 0x00000040 -#define BUTTON_SELECT 0x00000080 -#define BUTTON_PLAYPAUSE 0x00000100 -#define BUTTON_BACK 0x00000200 +#define BUTTON_LEFT 0x00000008 +#define BUTTON_UP 0x00000010 +#define BUTTON_RIGHT 0x00000020 +#define BUTTON_DOWN 0x00000040 +#define BUTTON_SELECT 0x00000080 +#define BUTTON_PLAYPAUSE 0x00000100 +#define BUTTON_BACK 0x00000200 +#define BUTTON_BOTTOMLEFT 0x00000400 +#define BUTTON_BOTTOMRIGHT 0x00000800 +/* Touch the touchpad with two fingers */ +#define BUTTON_TWO_FINGERS 0x000001000 #define BUTTON_MAIN (BUTTON_VOL_UP|BUTTON_VOL_DOWN|BUTTON_POWER|BUTTON_LEFT| \ BUTTON_UP|BUTTON_RIGHT|BUTTON_DOWN|BUTTON_SELECT| \ - BUTTON_PLAYPAUSE|BUTTON_BACK) + BUTTON_PLAYPAUSE|BUTTON_BACK| \ + BUTTON_TWO_FINGERS|BUTTON_BOTTOMRIGHT|BUTTON_BOTTOMLEFT) #define BUTTON_REMOTE 0 diff --git a/uisimulator/buttonmap/sansa-fuzeplus.c b/uisimulator/buttonmap/sansa-fuzeplus.c index bd78274a03..40a4d21ed3 100644 --- a/uisimulator/buttonmap/sansa-fuzeplus.c +++ b/uisimulator/buttonmap/sansa-fuzeplus.c @@ -49,7 +49,9 @@ int key_to_button(int keyboard_button) case SDLK_KP9: new_btn = BUTTON_PLAYPAUSE; break; - case SDLK_INSERT: + case SDLK_KP0: + new_btn = BUTTON_TWO_FINGERS; + break; case SDLK_KP7: new_btn = BUTTON_BACK; break; @@ -66,23 +68,28 @@ int key_to_button(int keyboard_button) new_btn = BUTTON_VOL_DOWN; break; case SDLK_HOME: - case SDLK_KP1: new_btn = BUTTON_POWER; break; + case SDLK_KP1: + new_btn = BUTTON_BOTTOMLEFT; + break; + case SDLK_KP3: + new_btn = BUTTON_BOTTOMRIGHT; + break; } return new_btn; } struct button_map bm[] = { - { SDLK_KP8, 70, 265, 35, "Scroll Back" }, - { SDLK_KP9, 141, 255, 31, "Play" }, - { SDLK_KP_MULTIPLY, 228, 267, 18, "Home" }, + { SDLK_KP8, 70, 265, 35, "Up" }, + { SDLK_KP9, 141, 255, 31, "Play/Pause" }, { SDLK_LEFT, 69, 329, 31, "Left" }, { SDLK_SPACE, 141, 330, 20, "Select" }, { SDLK_RIGHT, 214, 331, 23, "Right" }, - { SDLK_KP3, 142, 406, 30, "Menu" }, - { SDLK_DOWN, 221, 384, 24, "Scroll Fwd" }, - { SDLK_KP_MINUS, 270, 299, 25, "Power" }, - { SDLK_h, 269, 358, 26, "Hold" }, + { SDLK_KP1, 69, 406, 30, "Bottom Left" }, + { SDLK_KP3, 142, 406, 30, "Bottom Right" }, + { SDLK_DOWN, 221, 384, 24, "Down" }, + { SDLK_KP_MINUS, 270, 150, 25, "Volume -" }, + { SDLK_KP_PLUS, 270, 180, 25, "Volume +" }, { 0, 0, 0, 0, "None" } };