Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate
Sign In | Create Account

apps/keymaps/keymap-clip.c
Thursday, December 16th, 2010 at 7:54:38am UTC 

  1. /***************************************************************************
  2.  *             __________               __   ___.
  3.  *   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
  4.  *   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
  5.  *   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
  6.  *   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
  7.  *                     \/            \/     \/    \/            \/
  8.  * $Id: keymap-clip.c 28704 2010-11-29 11:28:53Z teru $
  9.  *
  10.  * Copyright  Rafal Carr 2008
  11.  *
  12.  * This program is free software; you can redistribute it and/or
  13.  * modify it under the terms of the GNU General Public License
  14.  * as published by the Free Software Foundation; either version 2
  15.  * of the License, or (at your option) any later version.
  16.  *
  17.  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  18.  * KIND, either express or implied.
  19.  *
  20.  ****************************************************************************/
  21. /* Button Code Definitions for Sansa Clip target */
  22.  
  23. #include "config.h"
  24. #include "action.h"
  25. #include "button.h"
  26. #include "settings.h"
  27.  
  28. /* {Action Code,    Button code,    Prereq button code } */
  29.  
  30. /*
  31.  * The format of the list is as follows
  32.  * { Action Code,   Button code,    Prereq button code }
  33.  * if there's no need to check the previous button's value, use BUTTON_NONE
  34.  * Insert LAST_ITEM_IN_LIST at the end of each mapping
  35.  */
  36. static const struct button_mapping button_context_standard[]  = {
  37.     { ACTION_STD_PREV,        BUTTON_UP,                        BUTTON_NONE },
  38.     { ACTION_STD_PREVREPEAT,  BUTTON_UP|BUTTON_REPEAT,          BUTTON_NONE },
  39.     { ACTION_STD_NEXT,        BUTTON_DOWN,                      BUTTON_NONE },
  40.     { ACTION_STD_NEXTREPEAT,  BUTTON_DOWN|BUTTON_REPEAT,        BUTTON_NONE },
  41.  
  42.     { ACTION_STD_MENU,        BUTTON_HOME|BUTTON_REL,           BUTTON_HOME },
  43.     { ACTION_STD_QUICKSCREEN, BUTTON_HOME|BUTTON_REPEAT,        BUTTON_HOME },
  44.  
  45.     { ACTION_STD_OK,          BUTTON_SELECT|BUTTON_REL,         BUTTON_SELECT },
  46.     { ACTION_STD_OK,          BUTTON_RIGHT,                     BUTTON_NONE },
  47.     { ACTION_STD_CANCEL,      BUTTON_LEFT,                      BUTTON_NONE },
  48.     { ACTION_STD_CANCEL,      BUTTON_POWER,                     BUTTON_NONE },
  49.  
  50.     { ACTION_STD_CONTEXT,     BUTTON_SELECT|BUTTON_REPEAT,      BUTTON_SELECT },
  51.  
  52.     LAST_ITEM_IN_LIST
  53. }; /* button_context_standard */
  54.  
  55.  
  56. static const struct button_mapping button_context_wps[]  = {
  57.     { ACTION_WPS_PLAY,     BUTTON_UP|BUTTON_REL,        BUTTON_UP },
  58.     { ACTION_WPS_STOP,     BUTTON_POWER|BUTTON_REL,     BUTTON_POWER },
  59.  
  60.     { ACTION_WPS_SKIPPREV, BUTTON_LEFT|BUTTON_REL,    BUTTON_LEFT },
  61.     { ACTION_WPS_SEEKBACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
  62.     { ACTION_WPS_STOPSEEK, BUTTON_LEFT|BUTTON_REL,    BUTTON_LEFT|BUTTON_REPEAT },
  63.  
  64.     { ACTION_WPS_SKIPNEXT, BUTTON_RIGHT|BUTTON_REL,    BUTTON_RIGHT },
  65.     { ACTION_WPS_SEEKFWD,  BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
  66.     { ACTION_WPS_STOPSEEK, BUTTON_RIGHT|BUTTON_REL,    BUTTON_RIGHT|BUTTON_REPEAT },
  67.  
  68.     { ACTION_WPS_ABSETB_NEXTDIR,    BUTTON_POWER|BUTTON_RIGHT,   BUTTON_POWER },
  69.     { ACTION_WPS_ABSETA_PREVDIR,    BUTTON_POWER|BUTTON_LEFT,    BUTTON_POWER },
  70.     { ACTION_WPS_ABRESET,           BUTTON_POWER|BUTTON_UP,      BUTTON_POWER },
  71.  
  72.     { ACTION_WPS_VOLUP,     BUTTON_VOL_UP,                   BUTTON_NONE },
  73.     { ACTION_WPS_VOLUP,     BUTTON_VOL_UP|BUTTON_REPEAT,     BUTTON_NONE },
  74.     { ACTION_WPS_VOLDOWN,   BUTTON_VOL_DOWN,                  BUTTON_NONE },
  75.     { ACTION_WPS_VOLDOWN,   BUTTON_VOL_DOWN|BUTTON_REPEAT,    BUTTON_NONE },
  76.  
  77.     { ACTION_WPS_BROWSE,        BUTTON_SELECT|BUTTON_REL,     BUTTON_SELECT },
  78.     { ACTION_WPS_CONTEXT,       BUTTON_SELECT|BUTTON_REPEAT,  BUTTON_SELECT },
  79.  
  80.     { ACTION_WPS_QUICKSCREEN,   BUTTON_HOME|BUTTON_REPEAT,    BUTTON_HOME },
  81.     { ACTION_WPS_MENU,          BUTTON_HOME|BUTTON_REL,      BUTTON_HOME },
  82.  
  83.     { ACTION_WPS_PITCHSCREEN,   BUTTON_UP|BUTTON_REPEAT,        BUTTON_NONE },
  84.     { ACTION_WPS_ID3SCREEN,     BUTTON_SELECT|BUTTON_DOWN,      BUTTON_SELECT },
  85.  
  86. #ifdef HAVE_HOTKEY /*If your Clip already had a hotkey, the next line remaps it.*/
  87.     { ACTION_WPS_HOTKEY,        BUTTON_HOME|BUTTON_UP,      BUTTON_HOME },
  88. #endif
  89.     { ACTION_WPS_VIEW_PLAYLIST, BUTTON_DOWN|BUTTON_REPEAT,      BUTTON_NONE },
  90.  
  91. #ifndef HAS_BUTTON_HOLD /* Clip+ */
  92.     { ACTION_STD_KEYLOCK,       BUTTON_HOME|BUTTON_SELECT,      BUTTON_NONE },
  93. #endif /* HAS_BUTTON_HOLD */
  94.  
  95.     LAST_ITEM_IN_LIST
  96. }; /* button_context_wps */
  97.  
  98. static const struct button_mapping button_context_settings[] = {
  99.     { ACTION_STD_OK,            BUTTON_HOME|BUTTON_REL,     BUTTON_HOME },
  100.     { ACTION_STD_CANCEL,        BUTTON_POWER,               BUTTON_NONE },
  101.     { ACTION_SETTINGS_RESET,    BUTTON_SELECT,              BUTTON_NONE },
  102.    
  103.     { ACTION_SETTINGS_INC,      BUTTON_UP,                  BUTTON_NONE },
  104.     { ACTION_SETTINGS_INCREPEAT,BUTTON_UP|BUTTON_REPEAT,    BUTTON_NONE },
  105.     { ACTION_SETTINGS_DEC,      BUTTON_DOWN,                BUTTON_NONE },
  106.     { ACTION_SETTINGS_DECREPEAT,BUTTON_DOWN|BUTTON_REPEAT,  BUTTON_NONE },
  107.  
  108.     { ACTION_STD_PREV,          BUTTON_LEFT,                BUTTON_NONE },
  109.     { ACTION_STD_PREVREPEAT,    BUTTON_LEFT|BUTTON_REPEAT,  BUTTON_NONE },
  110.     { ACTION_STD_NEXT,          BUTTON_RIGHT,               BUTTON_NONE },
  111.     { ACTION_STD_NEXTREPEAT,    BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
  112.  
  113.     LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
  114. }; /* button_context_settings */
  115.  
  116. static const struct button_mapping button_context_list[]  = {
  117.     { ACTION_LISTTREE_PGUP,   BUTTON_SELECT|BUTTON_UP,    BUTTON_SELECT },
  118.     { ACTION_LISTTREE_PGDOWN, BUTTON_SELECT|BUTTON_DOWN,  BUTTON_SELECT },
  119.  
  120. #ifdef HAVE_VOLUME_IN_LIST
  121.     { ACTION_LIST_VOLUP,        BUTTON_VOL_UP|BUTTON_REPEAT,    BUTTON_NONE },
  122.     { ACTION_LIST_VOLUP,        BUTTON_VOL_UP,                  BUTTON_NONE },
  123.  
  124.     { ACTION_LIST_VOLDOWN,      BUTTON_VOL_DOWN,                BUTTON_NONE },
  125.     { ACTION_LIST_VOLDOWN,      BUTTON_VOL_DOWN|BUTTON_REPEAT,  BUTTON_NONE },
  126. #else
  127.     { ACTION_LISTTREE_PGUP,     BUTTON_VOL_UP,                  BUTTON_NONE },
  128.     { ACTION_LISTTREE_PGUP,     BUTTON_VOL_UP|BUTTON_REPEAT,    BUTTON_NONE },
  129.     { ACTION_LISTTREE_PGDOWN,   BUTTON_VOL_DOWN,                BUTTON_NONE },
  130.     { ACTION_LISTTREE_PGDOWN,   BUTTON_VOL_DOWN|BUTTON_REPEAT,  BUTTON_NONE },
  131. #endif
  132.     LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
  133. }; /* button_context_list */
  134.  
  135. static const struct button_mapping button_context_tree[]  = {
  136.     { ACTION_TREE_WPS,    BUTTON_HOME|BUTTON_SELECT,    BUTTON_HOME },
  137.     { ACTION_TREE_STOP,   BUTTON_POWER|BUTTON_REL,      BUTTON_POWER },
  138. #ifdef HAVE_HOTKEY
  139.     { ACTION_TREE_HOTKEY, BUTTON_HOME|BUTTON_UP,                  BUTTON_HOME },
  140. #endif
  141.  
  142.     LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
  143. }; /* button_context_tree */
  144.  
  145. static const struct button_mapping button_context_listtree_scroll_without_combo[]  = {
  146.     { ACTION_NONE,              BUTTON_LEFT,                BUTTON_NONE },
  147.     { ACTION_STD_CANCEL,        BUTTON_LEFT|BUTTON_REL,     BUTTON_LEFT },
  148.     { ACTION_TREE_ROOT_INIT,    BUTTON_LEFT|BUTTON_REPEAT,  BUTTON_LEFT },
  149.     { ACTION_TREE_PGLEFT,       BUTTON_LEFT|BUTTON_REPEAT,  BUTTON_NONE },
  150.     { ACTION_NONE,              BUTTON_RIGHT,               BUTTON_NONE },
  151.     { ACTION_STD_OK,            BUTTON_RIGHT|BUTTON_REL,    BUTTON_RIGHT },
  152.     { ACTION_TREE_PGRIGHT,      BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
  153.  
  154.     LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
  155. }; /* button_context_listtree_scroll_without_combo */
  156.  
  157. static const struct button_mapping button_context_listtree_scroll_with_combo[]  = {
  158.     { ACTION_TREE_PGLEFT,   BUTTON_HOME|BUTTON_LEFT,               BUTTON_NONE },
  159.     { ACTION_TREE_ROOT_INIT,BUTTON_HOME|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_HOME|BUTTON_LEFT },
  160.     { ACTION_TREE_PGLEFT,   BUTTON_HOME|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
  161.     { ACTION_TREE_PGRIGHT,  BUTTON_HOME|BUTTON_RIGHT,              BUTTON_NONE },
  162.     { ACTION_TREE_PGRIGHT,  BUTTON_HOME|BUTTON_RIGHT|BUTTON_REPEAT,BUTTON_NONE },
  163.  
  164.     LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
  165. }; /* button_context_listtree_scroll_with_combo */
  166.  
  167. static const struct button_mapping button_context_yesno[]  = {
  168.     { ACTION_YESNO_ACCEPT,          BUTTON_SELECT,              BUTTON_NONE },
  169.  
  170.     LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
  171. }; /* button_context_settings_yesno */
  172.  
  173. static const struct button_mapping button_context_quickscreen[]  = {
  174.     { ACTION_NONE,       BUTTON_LEFT,                   BUTTON_NONE },
  175.     { ACTION_STD_CANCEL, BUTTON_POWER|BUTTON_REL,       BUTTON_NONE },
  176.     { ACTION_STD_CANCEL, BUTTON_HOME,                   BUTTON_NONE },
  177.     { ACTION_QS_TOP,     BUTTON_UP|BUTTON_REL,          BUTTON_NONE },
  178.     { ACTION_QS_TOP,     BUTTON_UP|BUTTON_REPEAT,       BUTTON_NONE },
  179.     { ACTION_QS_DOWN,    BUTTON_DOWN|BUTTON_REL,        BUTTON_NONE },
  180.     { ACTION_QS_DOWN,    BUTTON_DOWN|BUTTON_REPEAT,     BUTTON_NONE },
  181.     { ACTION_QS_LEFT,    BUTTON_LEFT|BUTTON_REL,        BUTTON_NONE },
  182.     { ACTION_QS_LEFT,    BUTTON_LEFT|BUTTON_REPEAT,     BUTTON_NONE },
  183.     { ACTION_QS_RIGHT,   BUTTON_RIGHT|BUTTON_REL,       BUTTON_NONE },
  184.     { ACTION_QS_RIGHT,   BUTTON_RIGHT|BUTTON_REPEAT,    BUTTON_NONE },
  185.  
  186.     LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
  187. }; /* button_context_quickscreen */
  188.  
  189. static const struct button_mapping button_context_settings_right_is_inc[]  = {
  190.     { ACTION_SETTINGS_INC,      BUTTON_RIGHT,               BUTTON_NONE },
  191.     { ACTION_SETTINGS_INCREPEAT,BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
  192.     { ACTION_SETTINGS_DEC,      BUTTON_LEFT,                BUTTON_NONE },
  193.     { ACTION_SETTINGS_DECREPEAT,BUTTON_LEFT|BUTTON_REPEAT,  BUTTON_NONE },
  194.  
  195.     { ACTION_STD_CANCEL,        BUTTON_POWER,               BUTTON_NONE },
  196.  
  197.     LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
  198. }; /* button_context_settings_right_is_inc */
  199.  
  200. static const struct button_mapping button_context_pitchscreen[]  = {
  201.     { ACTION_PS_INC_SMALL,      BUTTON_UP,                      BUTTON_NONE },
  202.     { ACTION_PS_INC_BIG,        BUTTON_UP|BUTTON_REPEAT,        BUTTON_NONE },
  203.     { ACTION_PS_DEC_SMALL,      BUTTON_DOWN,                    BUTTON_NONE },
  204.     { ACTION_PS_DEC_BIG,        BUTTON_DOWN|BUTTON_REPEAT,      BUTTON_NONE },   
  205.     { ACTION_PS_NUDGE_LEFT,     BUTTON_LEFT,                    BUTTON_NONE },
  206.     { ACTION_PS_NUDGE_LEFTOFF,  BUTTON_LEFT|BUTTON_REL,         BUTTON_NONE },
  207.     { ACTION_PS_NUDGE_RIGHT,    BUTTON_RIGHT,                   BUTTON_NONE },
  208.     { ACTION_PS_NUDGE_RIGHTOFF, BUTTON_RIGHT|BUTTON_REL,        BUTTON_NONE },
  209.     { ACTION_PS_TOGGLE_MODE,    BUTTON_HOME|BUTTON_REL,         BUTTON_HOME },
  210.     { ACTION_PS_RESET,          BUTTON_SELECT,                  BUTTON_NONE },
  211.     { ACTION_PS_EXIT,           BUTTON_POWER,                   BUTTON_NONE },
  212.     { ACTION_PS_SLOWER,         BUTTON_LEFT|BUTTON_REPEAT,      BUTTON_NONE },
  213.     { ACTION_PS_FASTER,         BUTTON_RIGHT|BUTTON_REPEAT,     BUTTON_NONE },
  214.     LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
  215. }; /* button_context_pitchscreen */
  216.  
  217. #ifdef HAVE_RECORDING
  218. /** Recording Screen **/
  219. static const struct button_mapping button_context_recscreen[]  = {
  220.     { ACTION_REC_PAUSE,          BUTTON_SELECT,                 BUTTON_NONE },
  221.     { ACTION_REC_NEWFILE,        BUTTON_HOME|BUTTON_REL,        BUTTON_HOME },
  222.     { ACTION_STD_MENU,           BUTTON_DOWN|BUTTON_REPEAT,     BUTTON_NONE },
  223.     { ACTION_SETTINGS_INC,       BUTTON_RIGHT,                  BUTTON_NONE },
  224.     { ACTION_SETTINGS_INCREPEAT, BUTTON_RIGHT|BUTTON_REPEAT,    BUTTON_NONE },
  225.     { ACTION_SETTINGS_DEC,       BUTTON_LEFT,                   BUTTON_NONE },
  226.     { ACTION_SETTINGS_DECREPEAT, BUTTON_LEFT|BUTTON_REPEAT,     BUTTON_NONE },
  227.     { ACTION_SETTINGS_INC,       BUTTON_VOL_UP,                 BUTTON_NONE },
  228.     { ACTION_SETTINGS_INCREPEAT, BUTTON_VOL_UP|BUTTON_REPEAT,   BUTTON_NONE },
  229.     { ACTION_SETTINGS_DEC,       BUTTON_VOL_DOWN,               BUTTON_NONE },
  230.     { ACTION_SETTINGS_DECREPEAT, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
  231.     LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
  232. }; /* button_context_recscreen */
  233. #endif
  234.  
  235. /** FM Radio Screen **/
  236. static const struct button_mapping button_context_radio[]  = {
  237.     /* Copied from keymap-c200.c 20081207. Feel free to suggest a better one.*/
  238.     { ACTION_NONE,              BUTTON_UP,                      BUTTON_NONE },
  239.     { ACTION_FM_MENU,           BUTTON_DOWN,                    BUTTON_NONE },
  240.     { ACTION_FM_PRESET,         BUTTON_SELECT,                  BUTTON_NONE },
  241.     { ACTION_FM_STOP,           BUTTON_UP|BUTTON_REPEAT,        BUTTON_UP   },
  242.     { ACTION_FM_MODE,           BUTTON_HOME|BUTTON_REL,         BUTTON_HOME },
  243.     { ACTION_FM_EXIT,           BUTTON_POWER|BUTTON_REL,        BUTTON_POWER },
  244.     { ACTION_FM_PLAY,           BUTTON_UP|BUTTON_REL,           BUTTON_UP },
  245.     { ACTION_SETTINGS_INC,      BUTTON_VOL_UP,                  BUTTON_NONE },
  246.     { ACTION_SETTINGS_INCREPEAT,BUTTON_VOL_UP|BUTTON_REPEAT,    BUTTON_NONE },
  247.     { ACTION_SETTINGS_DEC,      BUTTON_VOL_DOWN,                BUTTON_NONE },
  248.     { ACTION_SETTINGS_DECREPEAT,BUTTON_VOL_DOWN|BUTTON_REPEAT,  BUTTON_NONE },
  249.  
  250.     LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
  251. }; /* button_context_radio */
  252.  
  253. static const struct button_mapping button_context_keyboard[]  = {
  254.     { ACTION_KBD_LEFT,         BUTTON_LEFT,                     BUTTON_NONE },
  255.     { ACTION_KBD_LEFT,         BUTTON_LEFT|BUTTON_REPEAT,       BUTTON_NONE },
  256.     { ACTION_KBD_RIGHT,        BUTTON_RIGHT,                    BUTTON_NONE },
  257.     { ACTION_KBD_RIGHT,        BUTTON_RIGHT|BUTTON_REPEAT,      BUTTON_NONE },
  258.     { ACTION_KBD_UP,           BUTTON_UP,                       BUTTON_NONE },
  259.     { ACTION_KBD_UP,           BUTTON_UP|BUTTON_REPEAT,         BUTTON_NONE },
  260.     { ACTION_KBD_DOWN,         BUTTON_DOWN,                     BUTTON_NONE },
  261.     { ACTION_KBD_DOWN,         BUTTON_DOWN|BUTTON_REPEAT,       BUTTON_NONE },
  262.  
  263.     { ACTION_KBD_CURSOR_LEFT,  BUTTON_VOL_UP,                   BUTTON_NONE },
  264.     { ACTION_KBD_CURSOR_LEFT,  BUTTON_VOL_UP|BUTTON_REPEAT,     BUTTON_NONE },
  265.     { ACTION_KBD_CURSOR_RIGHT, BUTTON_VOL_DOWN,                 BUTTON_NONE },
  266.     { ACTION_KBD_CURSOR_RIGHT, BUTTON_VOL_DOWN|BUTTON_REPEAT,   BUTTON_NONE },
  267.  
  268.     /*{ ACTION_KBD_PAGE_FLIP,    ,       BUTTON_NONE },*/
  269.     { ACTION_KBD_BACKSPACE,    BUTTON_HOME,                     BUTTON_NONE },
  270.     { ACTION_KBD_BACKSPACE,    BUTTON_HOME|BUTTON_REPEAT,       BUTTON_NONE },
  271.     { ACTION_KBD_SELECT,       BUTTON_SELECT|BUTTON_REL,        BUTTON_NONE },
  272.     { ACTION_KBD_DONE,         BUTTON_SELECT|BUTTON_REPEAT,     BUTTON_NONE },
  273.     { ACTION_KBD_ABORT,        BUTTON_POWER,                    BUTTON_NONE },
  274.  
  275.     LAST_ITEM_IN_LIST
  276. }; /* button_context_keyboard */
  277.  
  278. static const struct button_mapping button_context_bmark[]  = {
  279.     { ACTION_BMS_DELETE,       BUTTON_HOME,        BUTTON_NONE },
  280.  
  281.     LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
  282. }; /* button_context_bmark */
  283.  
  284. #ifdef USB_ENABLE_HID
  285. static const struct button_mapping button_context_usb_hid[] = {
  286.     { ACTION_USB_HID_MODE_SWITCH_NEXT, BUTTON_POWER|BUTTON_REL,    BUTTON_POWER },
  287.     { ACTION_USB_HID_MODE_SWITCH_PREV, BUTTON_POWER|BUTTON_REPEAT, BUTTON_POWER },
  288.  
  289.     LAST_ITEM_IN_LIST
  290. }; /* button_context_usb_hid */
  291.  
  292. static const struct button_mapping button_context_usb_hid_mode_multimedia[] = {
  293.     { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN,         BUTTON_VOL_DOWN,               BUTTON_NONE },
  294.     { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN,         BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
  295.     { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP,           BUTTON_VOL_UP,                 BUTTON_NONE },
  296.     { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP,           BUTTON_VOL_UP|BUTTON_REPEAT,   BUTTON_NONE },
  297.     { ACTION_USB_HID_MULTIMEDIA_VOLUME_MUTE,         BUTTON_SELECT|BUTTON_REL,      BUTTON_SELECT },
  298.     { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_PLAY_PAUSE, BUTTON_UP|BUTTON_REL,          BUTTON_UP },
  299.     { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_STOP,       BUTTON_HOME|BUTTON_REL,        BUTTON_HOME },
  300.     { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_TRACK_PREV, BUTTON_LEFT|BUTTON_REL,        BUTTON_LEFT },
  301.     { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_TRACK_NEXT, BUTTON_RIGHT|BUTTON_REL,       BUTTON_RIGHT },
  302.  
  303.     LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
  304. }; /* button_context_usb_hid_mode_multimedia */
  305.  
  306. static const struct button_mapping button_context_usb_hid_mode_presentation[] = {
  307.     { ACTION_USB_HID_PRESENTATION_SLIDESHOW_START, BUTTON_UP|BUTTON_REL,          BUTTON_UP },
  308.     { ACTION_USB_HID_PRESENTATION_SLIDESHOW_LEAVE, BUTTON_HOME|BUTTON_REL,        BUTTON_HOME },
  309.     { ACTION_USB_HID_PRESENTATION_SLIDE_PREV,      BUTTON_LEFT|BUTTON_REL,        BUTTON_LEFT },
  310.     { ACTION_USB_HID_PRESENTATION_SLIDE_NEXT,      BUTTON_RIGHT|BUTTON_REL,       BUTTON_RIGHT },
  311.     { ACTION_USB_HID_PRESENTATION_SLIDE_FIRST,     BUTTON_LEFT|BUTTON_REPEAT,     BUTTON_LEFT },
  312.     { ACTION_USB_HID_PRESENTATION_SLIDE_LAST,      BUTTON_RIGHT|BUTTON_REPEAT,    BUTTON_RIGHT },
  313.     { ACTION_USB_HID_PRESENTATION_SCREEN_BLACK,    BUTTON_DOWN|BUTTON_REL,        BUTTON_DOWN },
  314.     { ACTION_USB_HID_PRESENTATION_SCREEN_WHITE,    BUTTON_DOWN|BUTTON_REPEAT,     BUTTON_DOWN },
  315.     { ACTION_USB_HID_PRESENTATION_LINK_PREV,       BUTTON_VOL_UP,                 BUTTON_NONE },
  316.     { ACTION_USB_HID_PRESENTATION_LINK_PREV,       BUTTON_VOL_UP|BUTTON_REPEAT,   BUTTON_NONE },
  317.     { ACTION_USB_HID_PRESENTATION_LINK_NEXT,       BUTTON_VOL_DOWN,               BUTTON_NONE },
  318.     { ACTION_USB_HID_PRESENTATION_LINK_NEXT,       BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
  319.     { ACTION_USB_HID_PRESENTATION_MOUSE_CLICK,     BUTTON_SELECT|BUTTON_REL,      BUTTON_SELECT },
  320.     { ACTION_USB_HID_PRESENTATION_MOUSE_OVER,      BUTTON_SELECT|BUTTON_REPEAT,   BUTTON_SELECT },
  321.  
  322.     LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
  323. }; /* button_context_usb_hid_mode_presentation */
  324.  
  325. static const struct button_mapping button_context_usb_hid_mode_browser[] = {
  326.     { ACTION_USB_HID_BROWSER_SCROLL_UP,        BUTTON_VOL_UP,                       BUTTON_NONE },
  327.     { ACTION_USB_HID_BROWSER_SCROLL_UP,        BUTTON_VOL_UP|BUTTON_REPEAT,         BUTTON_NONE },
  328.     { ACTION_USB_HID_BROWSER_SCROLL_DOWN,      BUTTON_VOL_DOWN,                     BUTTON_NONE },
  329.     { ACTION_USB_HID_BROWSER_SCROLL_DOWN,      BUTTON_VOL_DOWN|BUTTON_REPEAT,       BUTTON_NONE },
  330.     { ACTION_USB_HID_BROWSER_SCROLL_PAGE_UP,   BUTTON_UP|BUTTON_REL,                BUTTON_UP },
  331.     { ACTION_USB_HID_BROWSER_SCROLL_PAGE_DOWN, BUTTON_DOWN|BUTTON_REL,              BUTTON_DOWN },
  332.     { ACTION_USB_HID_BROWSER_ZOOM_IN,          BUTTON_UP|BUTTON_REPEAT,             BUTTON_UP },
  333.     { ACTION_USB_HID_BROWSER_ZOOM_OUT,         BUTTON_DOWN|BUTTON_REPEAT,           BUTTON_DOWN },
  334.     { ACTION_USB_HID_BROWSER_ZOOM_RESET,       BUTTON_SELECT|BUTTON_REPEAT,         BUTTON_SELECT },
  335.     { ACTION_USB_HID_BROWSER_ZOOM_RESET,       BUTTON_UP|BUTTON_DOWN|BUTTON_REPEAT, BUTTON_UP|BUTTON_DOWN },
  336.     { ACTION_USB_HID_BROWSER_TAB_PREV,         BUTTON_LEFT|BUTTON_REL,              BUTTON_LEFT },
  337.     { ACTION_USB_HID_BROWSER_TAB_NEXT,         BUTTON_RIGHT|BUTTON_REL,             BUTTON_RIGHT },
  338.     { ACTION_USB_HID_BROWSER_TAB_CLOSE,        BUTTON_HOME|BUTTON_REPEAT,           BUTTON_HOME },
  339.     { ACTION_USB_HID_BROWSER_HISTORY_BACK,     BUTTON_LEFT|BUTTON_REPEAT,           BUTTON_LEFT },
  340.     { ACTION_USB_HID_BROWSER_HISTORY_FORWARD,  BUTTON_RIGHT|BUTTON_REPEAT,          BUTTON_RIGHT },
  341.     { ACTION_USB_HID_BROWSER_VIEW_FULL_SCREEN, BUTTON_SELECT|BUTTON_REL,            BUTTON_SELECT },
  342.  
  343.     LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
  344. }; /* button_context_usb_hid_mode_browser */
  345.  
  346. #ifdef HAVE_USB_HID_MOUSE
  347. static const struct button_mapping button_context_usb_hid_mode_mouse[] = {
  348.     { ACTION_USB_HID_MOUSE_UP,                BUTTON_UP,                                BUTTON_NONE },
  349.     { ACTION_USB_HID_MOUSE_UP_REP,            BUTTON_UP|BUTTON_REPEAT,                  BUTTON_NONE },
  350.     { ACTION_USB_HID_MOUSE_DOWN,              BUTTON_DOWN,                              BUTTON_NONE },
  351.     { ACTION_USB_HID_MOUSE_DOWN_REP,          BUTTON_DOWN|BUTTON_REPEAT,                BUTTON_NONE },
  352.     { ACTION_USB_HID_MOUSE_LEFT,              BUTTON_LEFT,                              BUTTON_NONE },
  353.     { ACTION_USB_HID_MOUSE_LEFT_REP,          BUTTON_LEFT|BUTTON_REPEAT,                BUTTON_NONE },
  354.     { ACTION_USB_HID_MOUSE_RIGHT,             BUTTON_RIGHT,                             BUTTON_NONE },
  355.     { ACTION_USB_HID_MOUSE_RIGHT_REP,         BUTTON_RIGHT|BUTTON_REPEAT,               BUTTON_NONE },
  356.     { ACTION_USB_HID_MOUSE_BUTTON_LEFT,       BUTTON_SELECT,                            BUTTON_NONE },
  357.     { ACTION_USB_HID_MOUSE_BUTTON_LEFT_REL,   BUTTON_SELECT|BUTTON_REL,                 BUTTON_NONE },
  358.     { ACTION_USB_HID_MOUSE_LDRAG_UP,          BUTTON_SELECT|BUTTON_UP,                  BUTTON_NONE },
  359.     { ACTION_USB_HID_MOUSE_LDRAG_UP_REP,      BUTTON_SELECT|BUTTON_UP|BUTTON_REPEAT,    BUTTON_NONE },
  360.     { ACTION_USB_HID_MOUSE_LDRAG_DOWN,        BUTTON_SELECT|BUTTON_DOWN,                BUTTON_NONE },
  361.     { ACTION_USB_HID_MOUSE_LDRAG_DOWN_REP,    BUTTON_SELECT|BUTTON_DOWN|BUTTON_REPEAT,  BUTTON_NONE },
  362.     { ACTION_USB_HID_MOUSE_LDRAG_LEFT,        BUTTON_SELECT|BUTTON_LEFT,                BUTTON_NONE },
  363.     { ACTION_USB_HID_MOUSE_LDRAG_LEFT_REP,    BUTTON_SELECT|BUTTON_LEFT|BUTTON_REPEAT,  BUTTON_NONE },
  364.     { ACTION_USB_HID_MOUSE_LDRAG_RIGHT,       BUTTON_SELECT|BUTTON_RIGHT,               BUTTON_NONE },
  365.     { ACTION_USB_HID_MOUSE_LDRAG_RIGHT_REP,   BUTTON_SELECT|BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
  366.     { ACTION_USB_HID_MOUSE_BUTTON_RIGHT,      BUTTON_HOME,                              BUTTON_NONE },
  367.     { ACTION_USB_HID_MOUSE_BUTTON_RIGHT_REL,  BUTTON_HOME|BUTTON_REL,                   BUTTON_NONE },
  368.     { ACTION_USB_HID_MOUSE_RDRAG_UP,          BUTTON_HOME|BUTTON_UP,                    BUTTON_NONE },
  369.     { ACTION_USB_HID_MOUSE_RDRAG_UP_REP,      BUTTON_HOME|BUTTON_UP|BUTTON_REPEAT,      BUTTON_NONE },
  370.     { ACTION_USB_HID_MOUSE_RDRAG_DOWN,        BUTTON_HOME|BUTTON_DOWN,                  BUTTON_NONE },
  371.     { ACTION_USB_HID_MOUSE_RDRAG_DOWN_REP,    BUTTON_HOME|BUTTON_DOWN|BUTTON_REPEAT,    BUTTON_NONE },
  372.     { ACTION_USB_HID_MOUSE_RDRAG_LEFT,        BUTTON_HOME|BUTTON_LEFT,                  BUTTON_NONE },
  373.     { ACTION_USB_HID_MOUSE_RDRAG_LEFT_REP,    BUTTON_HOME|BUTTON_LEFT|BUTTON_REPEAT,    BUTTON_NONE },
  374.     { ACTION_USB_HID_MOUSE_RDRAG_RIGHT,       BUTTON_HOME|BUTTON_RIGHT,                 BUTTON_NONE },
  375.     { ACTION_USB_HID_MOUSE_RDRAG_RIGHT_REP,   BUTTON_HOME|BUTTON_RIGHT|BUTTON_REPEAT,   BUTTON_NONE },
  376.     { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_UP,   BUTTON_VOL_UP,                            BUTTON_NONE },
  377.     { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_UP,   BUTTON_VOL_UP|BUTTON_REPEAT,              BUTTON_NONE },
  378.     { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_DOWN, BUTTON_VOL_DOWN,                          BUTTON_NONE },
  379.     { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_DOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT,            BUTTON_NONE },
  380.  
  381.     LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
  382. }; /* button_context_usb_hid_mode_mouse */
  383. #endif
  384. #endif
  385.  
  386. /* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */
  387. const struct button_mapping* get_context_mapping(int context)
  388. {
  389.     switch (context)
  390.     {
  391.         case CONTEXT_STD:
  392.             return button_context_standard;
  393.  
  394.         case CONTEXT_WPS:
  395.             return button_context_wps;
  396.  
  397.         case CONTEXT_LIST:
  398.             return button_context_list;
  399.         case CONTEXT_TREE:
  400.         case CONTEXT_MAINMENU:
  401.             if (global_settings.hold_lr_for_scroll_in_list)
  402.                 return button_context_listtree_scroll_without_combo;
  403.             else
  404.                 return button_context_listtree_scroll_with_combo;
  405.         case CONTEXT_CUSTOM|CONTEXT_TREE:
  406.             return button_context_tree;
  407.  
  408.         case CONTEXT_SETTINGS:
  409.         case CONTEXT_SETTINGS_TIME:
  410.             return button_context_settings;
  411.         case CONTEXT_CUSTOM|CONTEXT_SETTINGS:
  412.         case CONTEXT_SETTINGS_COLOURCHOOSER:
  413.         case CONTEXT_SETTINGS_EQ:
  414.         case CONTEXT_SETTINGS_RECTRIGGER:
  415.             return button_context_settings_right_is_inc;
  416.  
  417.         case CONTEXT_YESNOSCREEN:
  418.             return button_context_yesno;
  419.         case CONTEXT_FM:
  420.             return button_context_radio;
  421.         case CONTEXT_BOOKMARKSCREEN:
  422.             return button_context_bmark;
  423.         case CONTEXT_QUICKSCREEN:
  424.             return button_context_quickscreen;
  425.         case CONTEXT_PITCHSCREEN:
  426.             return button_context_pitchscreen;
  427. #ifdef HAVE_RECORDING
  428.         case CONTEXT_RECSCREEN:
  429.             return button_context_recscreen;
  430. #endif
  431.         case CONTEXT_KEYBOARD:
  432.             return button_context_keyboard;
  433. #ifdef USB_ENABLE_HID
  434.         case CONTEXT_USB_HID:
  435.             return button_context_usb_hid;
  436.         case CONTEXT_USB_HID_MODE_MULTIMEDIA:
  437.             return button_context_usb_hid_mode_multimedia;
  438.         case CONTEXT_USB_HID_MODE_PRESENTATION:
  439.             return button_context_usb_hid_mode_presentation;
  440.         case CONTEXT_USB_HID_MODE_BROWSER:
  441.             return button_context_usb_hid_mode_browser;
  442. #ifdef HAVE_USB_HID_MOUSE
  443.         case CONTEXT_USB_HID_MODE_MOUSE:
  444.             return button_context_usb_hid_mode_mouse;
  445. #endif
  446. #endif
  447.         default:
  448.             return button_context_standard;
  449.     }
  450.     return button_context_standard;
  451. }

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

comments powered by Disqus
worth-right