summaryrefslogtreecommitdiff
path: root/apps/keymaps/keymap-xduoox3.c
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2020-09-12 05:03:12 -0400
committerWilliam Wilgus <me.theuser@yahoo.com>2020-09-13 16:23:24 +0000
commitc62493e98adfd27c16eb2adb2ecd22716813b705 (patch)
treec5d2a0fbdcf145584518289885e7676f82b20a29 /apps/keymaps/keymap-xduoox3.c
parent6b674a6a0a347bd4cb946b37b6e075dc2715f7ac (diff)
downloadrockbox-c62493e98adfd27c16eb2adb2ecd22716813b705.tar.gz
rockbox-c62493e98adfd27c16eb2adb2ecd22716813b705.zip
Xduoo X3 Add tree scrolling FS#13240, Emulate Multibutton presses
Fixes deficiencies with the button system on the X3 The x3 has an interesting button layout. Multiple key presses are NOT supported unless [BUTTON_POWER] is one of the combined keys As you can imagine this causes problems as the power button takes precedence in the button system and initiates a shutdown if the key is held too long instead of BUTTON_POWER use BUTTON_PWRALT in combination with other keys IF using as a prerequsite button then BUTTON_POWER should be used Multiple buttons are emulated by button_read_device but there are a few caveats to be aware of: Button Order Matters! different keys have different priorities, higher priority keys 'overide' the lower priority keys VOLUP[7] VOLDN[6] PREV[5] NEXT[4] PLAY[3] OPTION[2] HOME[1] There will be no true release or repeat events, the user can let off the button pressed initially and it will still continue to appear to be pressed as long as the second key is held Tree scrolling is PLAY+NEXT or PLAY+PREV Change-Id: I88dfee1c70a6a99659e8227f5becacc50cc43910
Diffstat (limited to 'apps/keymaps/keymap-xduoox3.c')
-rw-r--r--apps/keymaps/keymap-xduoox3.c44
1 files changed, 40 insertions, 4 deletions
diff --git a/apps/keymaps/keymap-xduoox3.c b/apps/keymaps/keymap-xduoox3.c
index e73798d4fe..ed217fd722 100644
--- a/apps/keymaps/keymap-xduoox3.c
+++ b/apps/keymaps/keymap-xduoox3.c
@@ -21,6 +21,29 @@
21 21
22/* Button Code Definitions for xDuoo X3 target */ 22/* Button Code Definitions for xDuoo X3 target */
23 23
24
25/* NOTE X3 Button system
26 * The x3 has an interesting button layout. Multiple key presses are
27 * NOT supported unless [BUTTON_POWER] is one of the combined keys
28 * as you can imagine this causes problems as the power button takes
29 * precedence in the button system and initiates a shutdown if the
30 * key is held too long
31 * instead of BUTTON_POWER use BUTTON_PWRALT in combination with other keys
32 * IF using as a prerequsite button then BUTTON_POWER should be used
33 *
34 * Multiple buttons are emulated by button_read_device but there are a few
35 * caveats to be aware of:
36 *
37 * Button Order Matters!
38 * different keys have different priorities, higher priority keys 'overide' the
39 * lower priority keys
40 * VOLUP[7] VOLDN[6] PREV[5] NEXT[4] PLAY[3] OPTION[2] HOME[1]
41 *
42 * There will be no true release or repeat events, the user can let off the button
43 * pressed initially and it will still continue to appear to be pressed as long as
44 * the second key is held
45 * */
46
24#include "config.h" 47#include "config.h"
25#include "action.h" 48#include "action.h"
26#include "button.h" 49#include "button.h"
@@ -67,9 +90,9 @@ static const struct button_mapping button_context_wps[] = {
67 { ACTION_WPS_QUICKSCREEN, BUTTON_OPTION|BUTTON_REPEAT, BUTTON_OPTION }, 90 { ACTION_WPS_QUICKSCREEN, BUTTON_OPTION|BUTTON_REPEAT, BUTTON_OPTION },
68 { ACTION_WPS_HOTKEY, BUTTON_HOME|BUTTON_REPEAT, BUTTON_HOME }, 91 { ACTION_WPS_HOTKEY, BUTTON_HOME|BUTTON_REPEAT, BUTTON_HOME },
69 92
70 { ACTION_WPS_ABSETB_NEXTDIR, BUTTON_POWER|BUTTON_NEXT, BUTTON_POWER }, 93 { ACTION_WPS_ABSETB_NEXTDIR, BUTTON_PWRALT|BUTTON_NEXT, BUTTON_POWER },
71 { ACTION_WPS_ABSETA_PREVDIR, BUTTON_POWER|BUTTON_PREV, BUTTON_POWER }, 94 { ACTION_WPS_ABSETA_PREVDIR, BUTTON_PWRALT|BUTTON_PREV, BUTTON_POWER },
72 { ACTION_WPS_ABRESET, BUTTON_POWER|BUTTON_PLAY, BUTTON_POWER }, 95 { ACTION_WPS_ABRESET, BUTTON_PWRALT|BUTTON_PLAY, BUTTON_POWER },
73 96
74 LAST_ITEM_IN_LIST 97 LAST_ITEM_IN_LIST
75}; /* button_context_wps */ 98}; /* button_context_wps */
@@ -173,11 +196,21 @@ static const struct button_mapping button_context_settings_vol_is_inc[] = {
173static const struct button_mapping button_context_tree[] = { 196static const struct button_mapping button_context_tree[] = {
174 { ACTION_TREE_WPS, BUTTON_POWER|BUTTON_REL, BUTTON_POWER }, 197 { ACTION_TREE_WPS, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
175 { ACTION_TREE_STOP, BUTTON_POWER|BUTTON_REPEAT, BUTTON_POWER }, 198 { ACTION_TREE_STOP, BUTTON_POWER|BUTTON_REPEAT, BUTTON_POWER },
176 { ACTION_TREE_HOTKEY, BUTTON_HOME|BUTTON_REPEAT, BUTTON_HOME }, 199 { ACTION_TREE_HOTKEY, BUTTON_HOME|BUTTON_REPEAT, BUTTON_HOME},
177 200
178 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST) 201 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST)
179}; /* button_context_tree */ 202}; /* button_context_tree */
180 203
204static const struct button_mapping button_context_listtree_scroll_with_combo[] = {
205 { ACTION_NONE, BUTTON_POWER, BUTTON_NONE },
206 { ACTION_TREE_PGLEFT, BUTTON_PLAY|BUTTON_PREV, BUTTON_NONE },
207 { ACTION_TREE_PGLEFT, BUTTON_PLAY|BUTTON_PREV|BUTTON_REPEAT, BUTTON_NONE },
208 { ACTION_TREE_PGRIGHT, BUTTON_PLAY|BUTTON_NEXT, BUTTON_NONE },
209 { ACTION_TREE_PGRIGHT, BUTTON_PLAY|BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NONE },
210
211 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
212}; /* button_context_listtree_scroll_with_combo */
213
181/** Yes/No Screen **/ 214/** Yes/No Screen **/
182static const struct button_mapping button_context_yesnoscreen[] = { 215static const struct button_mapping button_context_yesnoscreen[] = {
183 { ACTION_YESNO_ACCEPT, BUTTON_PLAY, BUTTON_NONE }, 216 { ACTION_YESNO_ACCEPT, BUTTON_PLAY, BUTTON_NONE },
@@ -256,8 +289,11 @@ const struct button_mapping* get_context_mapping(int context)
256 case CONTEXT_SETTINGS_RECTRIGGER: 289 case CONTEXT_SETTINGS_RECTRIGGER:
257 return button_context_settings_vol_is_inc; 290 return button_context_settings_vol_is_inc;
258 case CONTEXT_TREE: 291 case CONTEXT_TREE:
292 return button_context_listtree_scroll_with_combo;
259 case CONTEXT_MAINMENU: 293 case CONTEXT_MAINMENU:
260 return button_context_tree; 294 return button_context_tree;
295 case CONTEXT_CUSTOM|CONTEXT_TREE:
296 return button_context_tree;
261 case CONTEXT_WPS: 297 case CONTEXT_WPS:
262 return button_context_wps; 298 return button_context_wps;
263 case CONTEXT_YESNOSCREEN: 299 case CONTEXT_YESNOSCREEN: