summaryrefslogtreecommitdiff
path: root/apps/keymaps/keymap-zen.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/keymaps/keymap-zen.c')
-rw-r--r--apps/keymaps/keymap-zen.c448
1 files changed, 448 insertions, 0 deletions
diff --git a/apps/keymaps/keymap-zen.c b/apps/keymaps/keymap-zen.c
new file mode 100644
index 0000000000..dda12959d8
--- /dev/null
+++ b/apps/keymaps/keymap-zen.c
@@ -0,0 +1,448 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright © Amaury Pouly 2013
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
22#include "config.h"
23#include "action.h"
24#include "button.h"
25#include "settings.h"
26
27/** This keymap is shared by the ZEN targets with some variants. All ZEN targets
28 * shared a core set of buttons: left, right, up, down, select, back, play/pause
29 * and they all have a hold button. Two extra groups of button may exist:
30 * (ctl) menu, shortcut
31 * (dir) top left, top right, bottom left, bottom left
32 * (vol) vol up, vol down
33 * Here is the list of ZEN targets are the groups:
34 * target core ctl dir vol
35 * V (Plus) 1 0 0 1
36 * Mozaic 1 1 0 0
37 * ZEN 1 1 0 0
38 * X-Fi 1 1 1 0 */
39
40/* {Action Code, Button code, Prereq button code } */
41
42#ifdef BUTTON_VOL_UP
43#define ZEN_HAS_VOL
44#endif
45
46#ifdef BUTTON_BOTTOMLEFT
47#define ZEN_HAS_DIRECTIONAL
48#endif
49
50#ifdef BUTTON_MENU
51#define ZEN_HAS_CONTROL
52#endif
53
54/*
55 * The format of the list is as follows
56 * { Action Code, Button code, Prereq button code }
57 * if there's no need to check the previous button's value, use BUTTON_NONE
58 * Insert LAST_ITEM_IN_LIST at the end of each mapping
59 */
60static const struct button_mapping button_context_standard[] = {
61 { ACTION_STD_PREV, BUTTON_UP, BUTTON_NONE },
62 { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
63 { ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE },
64 { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
65
66 { ACTION_STD_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
67 { ACTION_STD_CONTEXT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
68
69 { ACTION_STD_CANCEL, BUTTON_BACK, BUTTON_NONE },
70 { ACTION_STD_CANCEL, BUTTON_BACK|BUTTON_REPEAT, BUTTON_NONE },
71 { ACTION_STD_CANCEL, BUTTON_LEFT, BUTTON_NONE },
72 { ACTION_STD_CANCEL, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
73 { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
74 { ACTION_STD_OK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
75
76 LAST_ITEM_IN_LIST
77}; /* button_context_standard */
78
79static const struct button_mapping button_context_wps[] = {
80 { ACTION_WPS_PLAY, BUTTON_PLAYPAUSE|BUTTON_REL, BUTTON_PLAYPAUSE },
81 { ACTION_WPS_STOP, BUTTON_PLAYPAUSE|BUTTON_REPEAT, BUTTON_NONE },
82
83 { ACTION_WPS_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE },
84
85 { ACTION_WPS_SKIPNEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
86 { ACTION_WPS_SEEKFWD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
87 { ACTION_WPS_SKIPPREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
88 { ACTION_WPS_SEEKBACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
89 { ACTION_WPS_STOPSEEK, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT },
90 { ACTION_WPS_STOPSEEK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT },
91
92#ifdef ZEN_HAS_VOL
93 { ACTION_WPS_VOLUP, BUTTON_VOL_UP, BUTTON_NONE },
94 { ACTION_WPS_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
95#endif
96 { ACTION_WPS_VOLUP, BUTTON_UP, BUTTON_NONE },
97 { ACTION_WPS_VOLUP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
98
99#ifdef ZEN_HAS_VOL
100 { ACTION_WPS_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE },
101 { ACTION_WPS_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
102#endif
103 { ACTION_WPS_VOLDOWN, BUTTON_DOWN, BUTTON_NONE },
104 { ACTION_WPS_VOLDOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
105
106 { ACTION_WPS_MENU, BUTTON_BACK, BUTTON_NONE },
107 { ACTION_WPS_BROWSE, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
108
109 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
110}; /* button_context_wps */
111
112static const struct button_mapping button_context_keyboard[] = {
113 { ACTION_KBD_LEFT, BUTTON_LEFT, BUTTON_NONE },
114 { ACTION_KBD_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
115 { ACTION_KBD_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
116 { ACTION_KBD_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
117 { ACTION_KBD_UP, BUTTON_UP, BUTTON_NONE },
118 { ACTION_KBD_UP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
119 { ACTION_KBD_DOWN, BUTTON_DOWN, BUTTON_NONE },
120 { ACTION_KBD_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
121
122 { ACTION_KBD_BACKSPACE, BUTTON_BACK, BUTTON_NONE },
123 { ACTION_KBD_BACKSPACE, BUTTON_BACK|BUTTON_REPEAT, BUTTON_NONE },
124
125 { ACTION_KBD_SELECT, BUTTON_PLAYPAUSE, BUTTON_NONE },
126 { ACTION_KBD_DONE, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
127 { ACTION_KBD_ABORT, BUTTON_POWER, BUTTON_NONE },
128
129#ifdef ZEN_HAS_VOL
130 { ACTION_KBD_MORSE_INPUT, BUTTON_VOL_UP, BUTTON_NONE },
131 { ACTION_KBD_MORSE_SELECT, BUTTON_VOL_DOWN|BUTTON_REL, BUTTON_NONE },
132#endif
133
134 LAST_ITEM_IN_LIST
135}; /* button_context_keyboard */
136
137static const struct button_mapping button_context_quickscreen[] = {
138 { ACTION_STD_CANCEL, BUTTON_SELECT, BUTTON_NONE },
139 { ACTION_STD_CANCEL, BUTTON_BACK, BUTTON_NONE },
140 { ACTION_STD_CANCEL, BUTTON_PLAYPAUSE, BUTTON_NONE },
141 { ACTION_QS_TOP, BUTTON_UP, BUTTON_NONE },
142 { ACTION_QS_DOWN, BUTTON_DOWN, BUTTON_NONE },
143 { ACTION_QS_LEFT, BUTTON_LEFT, BUTTON_NONE },
144 { ACTION_QS_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
145
146 LAST_ITEM_IN_LIST
147}; /* button_context_quickscreen */
148
149static const struct button_mapping button_context_tree[] = {
150 { ACTION_TREE_WPS, BUTTON_PLAYPAUSE|BUTTON_REL, BUTTON_PLAYPAUSE },
151 { ACTION_TREE_STOP, BUTTON_PLAYPAUSE|BUTTON_REPEAT, BUTTON_NONE },
152
153 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST)
154}; /* button_context_tree */
155
156static const struct button_mapping button_context_list[] = {
157#ifdef HAVE_VOLUME_IN_LIST
158#ifdef ZEN_HAS_VOL
159 { ACTION_LIST_VOLUP, BUTTON_VOL_UP, BUTTON_NONE },
160 { ACTION_LIST_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
161 { ACTION_LIST_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE },
162 { ACTION_LIST_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
163#endif
164#endif
165/*#ifdef HAVE_HOTKEY on some gesture later?
166 { ACTION_TREE_HOTKEY, BUTTON_BACK|BUTTON_REL, BUTTON_BACK|BUTTON_REPEAT },
167#endif*/
168
169 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
170}; /* button_context_list */
171
172#ifdef CONFIG_TUNER
173static const struct button_mapping button_context_radio[] = {
174 { ACTION_FM_MENU, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE },
175 { ACTION_FM_PLAY, BUTTON_PLAYPAUSE|BUTTON_REL, BUTTON_PLAYPAUSE },
176 { ACTION_FM_STOP, BUTTON_PLAYPAUSE|BUTTON_REPEAT, BUTTON_NONE },
177#ifdef ZEN_HAS_VOL
178 { ACTION_SETTINGS_INC, BUTTON_VOL_UP, BUTTON_NONE },
179 { ACTION_SETTINGS_INCREPEAT, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
180 { ACTION_SETTINGS_DEC, BUTTON_VOL_DOWN, BUTTON_NONE },
181 { ACTION_SETTINGS_DECREPEAT, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
182#endif
183
184 { ACTION_FM_EXIT, BUTTON_BACK, BUTTON_NONE },
185
186 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
187}; /* button_context_radio */
188#endif
189
190#ifdef HAVE_RECORDING
191static const struct button_mapping button_context_recscreen[] = {
192 { ACTION_REC_PAUSE, BUTTON_PLAYPAUSE|BUTTON_REL, BUTTON_PLAYPAUSE },
193 { ACTION_SETTINGS_INC, BUTTON_RIGHT, BUTTON_NONE },
194 { ACTION_SETTINGS_INCREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
195 { ACTION_SETTINGS_DEC, BUTTON_LEFT, BUTTON_NONE },
196 { ACTION_SETTINGS_DECREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
197
198 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
199}; /* button_context_recscreen */
200#endif
201
202static const struct button_mapping button_context_settings[] = {
203 /* we overwrite this to avoid select from std */
204 { ACTION_NONE, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
205
206 { ACTION_SETTINGS_INC, BUTTON_UP, BUTTON_NONE },
207 { ACTION_SETTINGS_INCREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
208 { ACTION_SETTINGS_DEC, BUTTON_DOWN, BUTTON_NONE },
209 { ACTION_SETTINGS_DECREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
210
211 { ACTION_STD_PREV, BUTTON_LEFT, BUTTON_NONE },
212 { ACTION_STD_PREVREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
213 { ACTION_STD_NEXT, BUTTON_RIGHT, BUTTON_NONE },
214 { ACTION_STD_NEXTREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
215
216 { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
217 { ACTION_SETTINGS_RESET, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE },
218
219 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
220}; /* button_context_settings */
221
222static const struct button_mapping button_context_settings_right_is_inc[] = {
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_STD_PREV, BUTTON_UP, BUTTON_NONE },
228 { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
229 { ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE },
230 { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
231
232 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
233}; /* button_context_settingsgraphical */
234
235static const struct button_mapping button_context_time[] = {
236
237 { ACTION_STD_CANCEL, BUTTON_BACK, BUTTON_NONE },
238 { ACTION_STD_OK, BUTTON_PLAYPAUSE, BUTTON_NONE },
239
240 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
241}; /* button_context_time */
242
243static const struct button_mapping button_context_colorchooser[] = {
244 { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
245 { ACTION_STD_CANCEL, BUTTON_BACK, BUTTON_NONE },
246
247 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS),
248}; /* button_context_colorchooser */
249
250static const struct button_mapping button_context_eq[] = {
251 { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
252
253 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS),
254}; /* button_context_eq */
255
256/* Bookmark Screen */
257static const struct button_mapping button_context_bmark[] = {
258 { ACTION_BMS_DELETE, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
259
260 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
261}; /* button_context_bmark */
262
263static const struct button_mapping button_context_pitchscreen[] = {
264
265 { ACTION_PS_INC_SMALL, BUTTON_UP, BUTTON_NONE },
266 { ACTION_PS_INC_BIG, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
267 { ACTION_PS_DEC_SMALL, BUTTON_DOWN, BUTTON_NONE },
268 { ACTION_PS_DEC_BIG, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
269
270 { ACTION_PS_NUDGE_LEFT, BUTTON_LEFT, BUTTON_NONE },
271 { ACTION_PS_NUDGE_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
272 { ACTION_PS_NUDGE_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
273 { ACTION_PS_NUDGE_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
274
275 { ACTION_PS_RESET, BUTTON_SELECT, BUTTON_NONE },
276 { ACTION_PS_EXIT, BUTTON_BACK, BUTTON_NONE },
277 { ACTION_PS_EXIT, BUTTON_PLAYPAUSE, BUTTON_NONE },
278
279 LAST_ITEM_IN_LIST
280}; /* button_context_pitchcreen */
281
282static const struct button_mapping button_context_yesno[] = {
283 { ACTION_YESNO_ACCEPT, BUTTON_SELECT, BUTTON_NONE },
284
285 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
286}; /* button_context_yesno */
287
288#ifdef USB_ENABLE_HID
289static const struct button_mapping button_context_usb_hid[] = {
290 { ACTION_USB_HID_MODE_SWITCH_NEXT, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
291 { ACTION_USB_HID_MODE_SWITCH_PREV, BUTTON_POWER|BUTTON_REPEAT, BUTTON_POWER },
292
293 LAST_ITEM_IN_LIST
294}; /* button_context_usb_hid */
295
296static const struct button_mapping button_context_usb_hid_mode_multimedia[] = {
297
298 { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_DOWN, BUTTON_NONE },
299 { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
300 { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_UP, BUTTON_NONE },
301 { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
302#ifdef ZEN_HAS_VOL
303 { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_VOL_DOWN, BUTTON_NONE },
304 { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
305 { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_VOL_UP, BUTTON_NONE },
306 { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
307#endif
308 { ACTION_USB_HID_MULTIMEDIA_VOLUME_MUTE, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
309 { ACTION_USB_HID_MULTIMEDIA_VOLUME_MUTE, BUTTON_BACK|BUTTON_REL, BUTTON_BACK },
310 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_PLAY_PAUSE, BUTTON_PLAYPAUSE|BUTTON_REL, BUTTON_PLAYPAUSE },
311 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_STOP, BUTTON_PLAYPAUSE|BUTTON_REPEAT, BUTTON_PLAYPAUSE },
312 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_TRACK_PREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
313 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_TRACK_NEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
314
315 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
316}; /* button_context_usb_hid_mode_multimedia */
317
318
319static const struct button_mapping button_context_usb_hid_mode_presentation[] = {
320 { ACTION_USB_HID_PRESENTATION_SLIDESHOW_START, BUTTON_PLAYPAUSE|BUTTON_REL, BUTTON_PLAYPAUSE },
321 { ACTION_USB_HID_PRESENTATION_SLIDESHOW_LEAVE, BUTTON_PLAYPAUSE|BUTTON_REPEAT, BUTTON_PLAYPAUSE },
322 { ACTION_USB_HID_PRESENTATION_SLIDE_PREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
323 { ACTION_USB_HID_PRESENTATION_SLIDE_NEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
324 { ACTION_USB_HID_PRESENTATION_SLIDE_FIRST, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
325 { ACTION_USB_HID_PRESENTATION_SLIDE_LAST, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
326 { ACTION_USB_HID_PRESENTATION_LINK_PREV, BUTTON_UP, BUTTON_NONE },
327 { ACTION_USB_HID_PRESENTATION_LINK_PREV, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
328 { ACTION_USB_HID_PRESENTATION_LINK_NEXT, BUTTON_DOWN, BUTTON_NONE },
329 { ACTION_USB_HID_PRESENTATION_LINK_NEXT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
330 { ACTION_USB_HID_PRESENTATION_MOUSE_CLICK, BUTTON_SELECT, BUTTON_SELECT },
331 { ACTION_USB_HID_PRESENTATION_MOUSE_OVER, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
332
333 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
334}; /* button_context_usb_hid_mode_presentation */
335
336static const struct button_mapping button_context_usb_hid_mode_browser[] = {
337 { ACTION_USB_HID_BROWSER_SCROLL_UP, BUTTON_UP, BUTTON_NONE },
338 { ACTION_USB_HID_BROWSER_SCROLL_UP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
339 { ACTION_USB_HID_BROWSER_SCROLL_DOWN, BUTTON_DOWN, BUTTON_NONE },
340 { ACTION_USB_HID_BROWSER_SCROLL_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
341#ifdef ZEN_HAS_VOL
342 { ACTION_USB_HID_BROWSER_ZOOM_IN, BUTTON_VOL_UP, BUTTON_NONE },
343 { ACTION_USB_HID_BROWSER_ZOOM_IN, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
344 { ACTION_USB_HID_BROWSER_ZOOM_OUT, BUTTON_VOL_DOWN, BUTTON_NONE },
345 { ACTION_USB_HID_BROWSER_ZOOM_OUT, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
346#endif
347 { ACTION_USB_HID_BROWSER_ZOOM_RESET, BUTTON_PLAYPAUSE|BUTTON_REPEAT, BUTTON_NONE },
348 { ACTION_USB_HID_BROWSER_TAB_PREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
349 { ACTION_USB_HID_BROWSER_TAB_NEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
350 { ACTION_USB_HID_BROWSER_TAB_CLOSE, BUTTON_BACK|BUTTON_REPEAT, BUTTON_BACK },
351 { ACTION_USB_HID_BROWSER_HISTORY_BACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
352 { ACTION_USB_HID_BROWSER_HISTORY_FORWARD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
353 { ACTION_USB_HID_BROWSER_VIEW_FULL_SCREEN, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
354
355 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
356}; /* button_context_usb_hid_mode_browser */
357
358#ifdef HAVE_USB_HID_MOUSE
359static const struct button_mapping button_context_usb_hid_mode_mouse[] = {
360 { ACTION_USB_HID_MOUSE_UP, BUTTON_UP, BUTTON_NONE },
361 { ACTION_USB_HID_MOUSE_UP_REP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
362 { ACTION_USB_HID_MOUSE_DOWN, BUTTON_DOWN, BUTTON_NONE },
363 { ACTION_USB_HID_MOUSE_DOWN_REP, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
364 { ACTION_USB_HID_MOUSE_LEFT, BUTTON_LEFT, BUTTON_NONE },
365 { ACTION_USB_HID_MOUSE_LEFT_REP, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
366 { ACTION_USB_HID_MOUSE_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
367 { ACTION_USB_HID_MOUSE_RIGHT_REP, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
368
369 { ACTION_USB_HID_MOUSE_BUTTON_LEFT, BUTTON_SELECT, BUTTON_NONE },
370 { ACTION_USB_HID_MOUSE_BUTTON_LEFT_REL, BUTTON_SELECT|BUTTON_REL, BUTTON_NONE },
371
372 { ACTION_USB_HID_MOUSE_BUTTON_RIGHT, BUTTON_PLAYPAUSE, BUTTON_NONE },
373 { ACTION_USB_HID_MOUSE_BUTTON_RIGHT_REL, BUTTON_PLAYPAUSE|BUTTON_REL, BUTTON_PLAYPAUSE },
374
375 { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_UP, BUTTON_BACK, BUTTON_NONE },
376 { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_UP, BUTTON_BACK|BUTTON_REPEAT, BUTTON_NONE },
377
378 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
379}; /* button_context_usb_hid_mode_mouse */
380#endif
381#endif
382
383/* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */
384const struct button_mapping* get_context_mapping(int context)
385{
386 switch (context)
387 {
388 case CONTEXT_STD:
389 return button_context_standard;
390 case CONTEXT_MAINMENU:
391 return button_context_tree;
392 case CONTEXT_SETTINGS:
393 return button_context_settings;
394 case CONTEXT_WPS:
395 return button_context_wps;
396 case CONTEXT_YESNOSCREEN:
397 return button_context_yesno;
398 case CONTEXT_SETTINGS_TIME:
399 return button_context_time;
400 case CONTEXT_KEYBOARD:
401 case CONTEXT_MORSE_INPUT:
402 return button_context_keyboard;
403#ifdef CONFIG_TUNER
404 case CONTEXT_FM:
405 return button_context_radio;
406#endif
407 case CONTEXT_LIST:
408 return button_context_list;
409 case CONTEXT_TREE:
410 return button_context_tree;
411 case CONTEXT_SETTINGS_EQ:
412 return button_context_eq;
413#ifdef HAVE_RECORDING
414 case CONTEXT_RECSCREEN:
415 return button_context_recscreen;
416#endif
417 case CONTEXT_QUICKSCREEN:
418 return button_context_quickscreen;
419 case CONTEXT_BOOKMARKSCREEN:
420 return button_context_bmark;
421 case CONTEXT_PITCHSCREEN:
422 return button_context_pitchscreen;
423 case CONTEXT_SETTINGS_COLOURCHOOSER:
424 return button_context_colorchooser;
425 case CONTEXT_SETTINGS_RECTRIGGER:
426 return button_context_settings_right_is_inc;
427 case CONTEXT_CUSTOM|CONTEXT_SETTINGS:
428 return button_context_settings_right_is_inc;
429#ifdef USB_ENABLE_HID
430 case CONTEXT_USB_HID:
431 return button_context_usb_hid;
432 case CONTEXT_USB_HID_MODE_MULTIMEDIA:
433 return button_context_usb_hid_mode_multimedia;
434 case CONTEXT_USB_HID_MODE_PRESENTATION:
435 return button_context_usb_hid_mode_presentation;
436 case CONTEXT_USB_HID_MODE_BROWSER:
437 return button_context_usb_hid_mode_browser;
438#ifdef HAVE_USB_HID_MOUSE
439 case CONTEXT_USB_HID_MODE_MOUSE:
440 return button_context_usb_hid_mode_mouse;
441#endif
442#endif
443 default:
444 return button_context_standard;
445 }
446 return button_context_standard;
447}
448