blob: 0a4db76f038a8f244ef520cb5a5b9fd5096af599 [file] [log] [blame]
Amaury Pouly268d83f2011-09-13 23:40:24 +00001/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright © Amaury Pouly 2011
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/* {Action Code, Button code, Prereq button code } */
28
29/*
30 * The format of the list is as follows
31 * { Action Code, Button code, Prereq button code }
32 * if there's no need to check the previous button's value, use BUTTON_NONE
33 * Insert LAST_ITEM_IN_LIST at the end of each mapping
34 */
35static const struct button_mapping button_context_standard[] = {
Amaury Pouly374a08a2011-11-30 18:39:22 +000036 { ACTION_STD_PREV, BUTTON_UP, BUTTON_NONE },
37 { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
38 { ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE },
39 { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
40
41 { ACTION_STD_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
Amaury Pouly84b97dd2011-12-26 17:45:54 +000042 { ACTION_STD_CANCEL, BUTTON_BACK, BUTTON_NONE },
Amaury Pouly374a08a2011-11-30 18:39:22 +000043 { ACTION_STD_CANCEL, BUTTON_LEFT, BUTTON_NONE },
44
45
46 { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
47 { ACTION_STD_OK, BUTTON_RIGHT, BUTTON_NONE },
48
49#ifdef HAVE_VOLUME_IN_LIST
50 { ACTION_LIST_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
51 { ACTION_LIST_VOLUP, BUTTON_VOL_UP, BUTTON_NONE },
52 { ACTION_LIST_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE },
53 { ACTION_LIST_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
54#endif
55
56 { ACTION_TREE_WPS, BUTTON_PLAYPAUSE|BUTTON_REL, BUTTON_PLAYPAUSE },
57 { ACTION_TREE_STOP, BUTTON_PLAYPAUSE|BUTTON_REPEAT, BUTTON_NONE },
58
59 { ACTION_STD_KEYLOCK, BUTTON_POWER, BUTTON_NONE },
Amaury Pouly268d83f2011-09-13 23:40:24 +000060
61 LAST_ITEM_IN_LIST
62}; /* button_context_standard */
63
Amaury Pouly374a08a2011-11-30 18:39:22 +000064
65static const struct button_mapping button_context_list[] = {
66
67 { ACTION_LISTTREE_PGUP, BUTTON_BOTTOMLEFT, BUTTON_NONE },
68 { ACTION_LISTTREE_PGUP, BUTTON_BOTTOMLEFT|BUTTON_REPEAT, BUTTON_BOTTOMLEFT },
69 { ACTION_LISTTREE_PGDOWN, BUTTON_BOTTOMRIGHT, BUTTON_NONE },
70 { ACTION_LISTTREE_PGDOWN, BUTTON_BOTTOMRIGHT|BUTTON_REPEAT, BUTTON_BOTTOMRIGHT },
Amaury Pouly84b97dd2011-12-26 17:45:54 +000071/*#ifdef HAVE_HOTKEY on some gesture later?
Amaury Pouly374a08a2011-11-30 18:39:22 +000072 { ACTION_TREE_HOTKEY, BUTTON_BACK|BUTTON_REL, BUTTON_BACK|BUTTON_REPEAT },
Amaury Pouly84b97dd2011-12-26 17:45:54 +000073#endif*/
Amaury Pouly374a08a2011-11-30 18:39:22 +000074
75 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
76}; /* button_context_list */
77
Amaury Pouly268d83f2011-09-13 23:40:24 +000078static const struct button_mapping button_context_wps[] = {
Amaury Pouly374a08a2011-11-30 18:39:22 +000079 { ACTION_WPS_PLAY, BUTTON_PLAYPAUSE|BUTTON_REL, BUTTON_PLAYPAUSE },
80 { ACTION_WPS_STOP, BUTTON_PLAYPAUSE|BUTTON_REPEAT, BUTTON_NONE },
Amaury Pouly268d83f2011-09-13 23:40:24 +000081
Amaury Pouly84b97dd2011-12-26 17:45:54 +000082 { ACTION_WPS_MENU, BUTTON_BACK, BUTTON_NONE },
Amaury Pouly268d83f2011-09-13 23:40:24 +000083
Amaury Pouly374a08a2011-11-30 18:39:22 +000084 { ACTION_WPS_BROWSE, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
85 { ACTION_WPS_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE },
86
87 { ACTION_WPS_SKIPNEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
Amaury Poulyd4720902011-12-04 00:03:09 +000088 { ACTION_WPS_SEEKFWD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
Amaury Pouly374a08a2011-11-30 18:39:22 +000089 { ACTION_WPS_SKIPPREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
Amaury Poulyd4720902011-12-04 00:03:09 +000090 { ACTION_WPS_SEEKBACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
Amaury Pouly374a08a2011-11-30 18:39:22 +000091 { ACTION_WPS_STOPSEEK, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT },
92 { ACTION_WPS_STOPSEEK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT },
93
94 { ACTION_WPS_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE },
95 { ACTION_WPS_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
96 { ACTION_WPS_VOLUP, BUTTON_VOL_UP, BUTTON_NONE },
97 { ACTION_WPS_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
98
99 { ACTION_WPS_VOLUP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
100 { ACTION_WPS_VOLDOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
101 { ACTION_WPS_VOLUP, BUTTON_UP, BUTTON_NONE },
102 { ACTION_WPS_VOLDOWN, BUTTON_DOWN, BUTTON_NONE },
103
Amaury Pouly374a08a2011-11-30 18:39:22 +0000104 { ACTION_WPS_PITCHSCREEN, BUTTON_BOTTOMLEFT|BUTTON_REPEAT, BUTTON_BOTTOMLEFT },
105 { ACTION_WPS_QUICKSCREEN, BUTTON_BOTTOMLEFT|BUTTON_REL, BUTTON_BOTTOMLEFT },
106 { ACTION_WPS_ID3SCREEN, BUTTON_BOTTOMRIGHT|BUTTON_REPEAT, BUTTON_BOTTOMRIGHT },
107
108 { ACTION_WPS_HOTKEY, BUTTON_BOTTOMRIGHT|BUTTON_REL, BUTTON_BOTTOMRIGHT },
109
110 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
Amaury Pouly268d83f2011-09-13 23:40:24 +0000111}; /* button_context_wps */
112
Amaury Pouly374a08a2011-11-30 18:39:22 +0000113static const struct button_mapping button_context_keyboard[] = {
114 { ACTION_KBD_LEFT, BUTTON_LEFT, BUTTON_NONE },
115 { ACTION_KBD_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
116 { ACTION_KBD_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
117 { ACTION_KBD_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
118 { ACTION_KBD_UP, BUTTON_UP, BUTTON_NONE },
119 { ACTION_KBD_UP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
120 { ACTION_KBD_DOWN, BUTTON_DOWN, BUTTON_NONE },
121 { ACTION_KBD_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
Amaury Pouly268d83f2011-09-13 23:40:24 +0000122
Amaury Pouly374a08a2011-11-30 18:39:22 +0000123 { ACTION_KBD_CURSOR_LEFT, BUTTON_BOTTOMLEFT, BUTTON_NONE },
124 { ACTION_KBD_CURSOR_LEFT, BUTTON_BOTTOMLEFT|BUTTON_REPEAT, BUTTON_NONE },
125 { ACTION_KBD_CURSOR_RIGHT, BUTTON_BOTTOMRIGHT, BUTTON_NONE },
126 { ACTION_KBD_CURSOR_RIGHT, BUTTON_BOTTOMRIGHT|BUTTON_REPEAT, BUTTON_NONE },
127
128 { ACTION_KBD_BACKSPACE, BUTTON_BACK, BUTTON_NONE },
129 { ACTION_KBD_BACKSPACE, BUTTON_BACK|BUTTON_REPEAT, BUTTON_NONE },
130
131 { ACTION_KBD_SELECT, BUTTON_PLAYPAUSE|BUTTON_REL, BUTTON_PLAYPAUSE },
132 { ACTION_KBD_DONE, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE },
133 { ACTION_KBD_ABORT, BUTTON_POWER, BUTTON_NONE },
134
135 LAST_ITEM_IN_LIST
136}; /* button_context_keyboard */
137
138static const struct button_mapping button_context_quickscreen[] = {
139 { ACTION_STD_CANCEL, BUTTON_SELECT|BUTTON_REL, BUTTON_NONE },
140 { ACTION_STD_CANCEL, BUTTON_BACK|BUTTON_REL, BUTTON_NONE },
141 { ACTION_STD_CANCEL, BUTTON_PLAYPAUSE|BUTTON_REL, BUTTON_NONE },
142 { ACTION_STD_CANCEL, BUTTON_BOTTOMRIGHT|BUTTON_REL, BUTTON_NONE },
143 { ACTION_STD_CANCEL, BUTTON_BOTTOMLEFT|BUTTON_REL, BUTTON_NONE },
144 { ACTION_QS_TOP, BUTTON_UP|BUTTON_REL, BUTTON_NONE },
145 { ACTION_QS_TOP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
146 { ACTION_QS_DOWN, BUTTON_DOWN|BUTTON_REL, BUTTON_NONE },
147 { ACTION_QS_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
148 { ACTION_QS_LEFT, BUTTON_LEFT|BUTTON_REL, BUTTON_NONE },
149 { ACTION_QS_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
150 { ACTION_QS_RIGHT, BUTTON_RIGHT|BUTTON_REL, BUTTON_NONE },
151 { ACTION_QS_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
152
153 LAST_ITEM_IN_LIST
154}; /* button_context_quickscreen */
155
156static const struct button_mapping button_context_tree[] = {
157
158 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST)
159}; /* button_context_tree */
160
161static const struct button_mapping button_context_radio[] = {
162 { ACTION_STD_PREV, BUTTON_LEFT, BUTTON_NONE },
163 { ACTION_STD_PREVREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
164 { ACTION_STD_NEXT, BUTTON_RIGHT, BUTTON_NONE },
165 { ACTION_STD_NEXTREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
166
167 { ACTION_FM_MENU, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE },
168 { ACTION_FM_PRESET, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
169 { ACTION_FM_PLAY, BUTTON_PLAYPAUSE|BUTTON_REL, BUTTON_PLAYPAUSE },
170 { ACTION_FM_STOP, BUTTON_BOTTOMRIGHT|BUTTON_REL, BUTTON_NONE },
171 { ACTION_FM_MODE, BUTTON_BOTTOMLEFT|BUTTON_REL, BUTTON_BOTTOMLEFT },
172
173 { ACTION_FM_EXIT, BUTTON_BACK|BUTTON_REL, BUTTON_NONE },
174
175 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
176}; /* button_context_radio */
177
178static const struct button_mapping button_context_recscreen[] = {
179 { ACTION_REC_PAUSE, BUTTON_PLAYPAUSE|BUTTON_REL, BUTTON_PLAYPAUSE },
180 { ACTION_REC_NEWFILE, BUTTON_BOTTOMRIGHT|BUTTON_REPEAT, BUTTON_NONE },
181
182 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
183}; /* button_context_recscreen */
184
185static const struct button_mapping button_context_time[] = {
186
187 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
188}; /* button_context_time */
189
190static const struct button_mapping button_context_settings_right_is_inc[] = {
191 { ACTION_SETTINGS_INC, BUTTON_RIGHT, BUTTON_NONE },
192 { ACTION_SETTINGS_INCREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
193 { ACTION_SETTINGS_DEC, BUTTON_LEFT, BUTTON_NONE },
194 { ACTION_SETTINGS_DECREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
195
196 { ACTION_SETTINGS_RESET, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE },
197
198 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
199}; /* button_context_settingsgraphical */
200
201static const struct button_mapping button_context_settings[] = {
202 { ACTION_SETTINGS_INC, BUTTON_UP, BUTTON_NONE },
203 { ACTION_SETTINGS_INCREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
204 { ACTION_SETTINGS_DEC, BUTTON_DOWN, BUTTON_NONE },
205 { ACTION_SETTINGS_DECREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
206
207 { ACTION_STD_PREV, BUTTON_LEFT, BUTTON_NONE },
208 { ACTION_STD_PREVREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
209 { ACTION_STD_NEXT, BUTTON_RIGHT, BUTTON_NONE },
210 { ACTION_STD_NEXTREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
211
212 { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
213
214 { ACTION_SETTINGS_RESET, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
215
216 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
217}; /* button_context_settings */
218
219static const struct button_mapping button_context_colorchooser[] = {
220 { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
221 { ACTION_STD_CANCEL, BUTTON_BACK, BUTTON_NONE },
222
223 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS),
224}; /* button_context_colorchooser */
225
226static const struct button_mapping button_context_eq[] = {
227 { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
228
229 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS),
230}; /* button_context_eq */
231
232/* Bookmark Screen */
233static const struct button_mapping button_context_bmark[] = {
234 { ACTION_BMS_DELETE, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
235
236 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
237}; /* button_context_bmark */
238
239static const struct button_mapping button_context_pitchscreen[] = {
240
241 { ACTION_PS_INC_SMALL, BUTTON_UP, BUTTON_NONE },
242 { ACTION_PS_INC_BIG, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
243 { ACTION_PS_DEC_SMALL, BUTTON_DOWN, BUTTON_NONE },
244 { ACTION_PS_DEC_BIG, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
245 { ACTION_PS_NUDGE_LEFT, BUTTON_LEFT, BUTTON_NONE },
246 { ACTION_PS_NUDGE_LEFTOFF, BUTTON_LEFT|BUTTON_REL, BUTTON_NONE },
247 { ACTION_PS_NUDGE_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
248 { ACTION_PS_NUDGE_RIGHTOFF, BUTTON_RIGHT|BUTTON_REL, BUTTON_NONE },
249 { ACTION_PS_TOGGLE_MODE, BUTTON_PLAYPAUSE, BUTTON_NONE },
250 { ACTION_PS_TOGGLE_MODE, BUTTON_BOTTOMRIGHT, BUTTON_NONE },
251 { ACTION_PS_RESET, BUTTON_SELECT, BUTTON_NONE },
252 { ACTION_PS_EXIT, BUTTON_BACK, BUTTON_NONE },
253 { ACTION_PS_SLOWER, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
254 { ACTION_PS_FASTER, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
255 LAST_ITEM_IN_LIST
256}; /* button_context_pitchcreen */
257
258static const struct button_mapping button_context_yesno[] = {
259 { ACTION_YESNO_ACCEPT, BUTTON_SELECT, BUTTON_NONE },
260
261 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
262}; /* button_context_yesno */
263
264#ifdef USB_ENABLE_HID
265static const struct button_mapping button_context_usb_hid[] = {
266 { ACTION_USB_HID_MODE_SWITCH_NEXT, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
267 { ACTION_USB_HID_MODE_SWITCH_PREV, BUTTON_POWER|BUTTON_REPEAT, BUTTON_POWER },
268
269 LAST_ITEM_IN_LIST
270}; /* button_context_usb_hid */
271
272static const struct button_mapping button_context_usb_hid_mode_multimedia[] = {
273
274 { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_DOWN, BUTTON_NONE },
275 { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
276 { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_UP, BUTTON_NONE },
277 { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
278 { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_VOL_DOWN, BUTTON_NONE },
279 { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
280 { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_VOL_UP, BUTTON_NONE },
281 { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
282 { ACTION_USB_HID_MULTIMEDIA_VOLUME_MUTE, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
283 { ACTION_USB_HID_MULTIMEDIA_VOLUME_MUTE, BUTTON_BACK|BUTTON_REL, BUTTON_BACK },
284 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_PLAY_PAUSE, BUTTON_PLAYPAUSE|BUTTON_REL, BUTTON_PLAYPAUSE },
285 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_STOP, BUTTON_PLAYPAUSE|BUTTON_REPEAT, BUTTON_NONE },
286 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_TRACK_PREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
287 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_TRACK_NEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
288
289 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
290}; /* button_context_usb_hid_mode_multimedia */
291
292
293static const struct button_mapping button_context_usb_hid_mode_presentation[] = {
294 { ACTION_USB_HID_PRESENTATION_SLIDESHOW_START, BUTTON_PLAYPAUSE|BUTTON_REL, BUTTON_PLAYPAUSE },
295 { ACTION_USB_HID_PRESENTATION_SLIDESHOW_LEAVE, BUTTON_PLAYPAUSE|BUTTON_REPEAT, BUTTON_PLAYPAUSE },
296 { ACTION_USB_HID_PRESENTATION_SLIDE_PREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
297 { ACTION_USB_HID_PRESENTATION_SLIDE_NEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
298 { ACTION_USB_HID_PRESENTATION_SLIDE_FIRST, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
299 { ACTION_USB_HID_PRESENTATION_SLIDE_LAST, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
300 { ACTION_USB_HID_PRESENTATION_SCREEN_BLACK, BUTTON_BOTTOMRIGHT|BUTTON_REL, BUTTON_BOTTOMRIGHT },
301 { ACTION_USB_HID_PRESENTATION_SCREEN_WHITE, BUTTON_BOTTOMRIGHT|BUTTON_REPEAT, BUTTON_BOTTOMRIGHT },
302 { ACTION_USB_HID_PRESENTATION_LINK_PREV, BUTTON_UP, BUTTON_NONE },
303 { ACTION_USB_HID_PRESENTATION_LINK_PREV, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
304 { ACTION_USB_HID_PRESENTATION_LINK_NEXT, BUTTON_DOWN, BUTTON_NONE },
305 { ACTION_USB_HID_PRESENTATION_LINK_NEXT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
306 { ACTION_USB_HID_PRESENTATION_MOUSE_CLICK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
307 { ACTION_USB_HID_PRESENTATION_MOUSE_OVER, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
308
309 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
310}; /* button_context_usb_hid_mode_presentation */
311
312static const struct button_mapping button_context_usb_hid_mode_browser[] = {
313 { ACTION_USB_HID_BROWSER_SCROLL_UP, BUTTON_UP, BUTTON_NONE },
314 { ACTION_USB_HID_BROWSER_SCROLL_UP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
315 { ACTION_USB_HID_BROWSER_SCROLL_DOWN, BUTTON_DOWN, BUTTON_NONE },
316 { ACTION_USB_HID_BROWSER_SCROLL_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
317
318 { ACTION_USB_HID_BROWSER_ZOOM_IN, BUTTON_PLAYPAUSE|BUTTON_REPEAT, BUTTON_NONE },
319 { ACTION_USB_HID_BROWSER_ZOOM_OUT, BUTTON_BOTTOMRIGHT|BUTTON_REPEAT, BUTTON_NONE },
320 { ACTION_USB_HID_BROWSER_ZOOM_RESET, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
321 { ACTION_USB_HID_BROWSER_ZOOM_RESET, BUTTON_PLAYPAUSE|BUTTON_BOTTOMRIGHT|BUTTON_REPEAT, BUTTON_PLAYPAUSE|BUTTON_BOTTOMRIGHT },
322 { ACTION_USB_HID_BROWSER_TAB_PREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
323 { ACTION_USB_HID_BROWSER_TAB_NEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
324 { ACTION_USB_HID_BROWSER_TAB_CLOSE, BUTTON_BACK|BUTTON_REPEAT, BUTTON_BACK },
325 { ACTION_USB_HID_BROWSER_HISTORY_BACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
326 { ACTION_USB_HID_BROWSER_HISTORY_FORWARD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
327 { ACTION_USB_HID_BROWSER_VIEW_FULL_SCREEN, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
328
329 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
330}; /* button_context_usb_hid_mode_browser */
331
332#ifdef HAVE_USB_HID_MOUSE
333static const struct button_mapping button_context_usb_hid_mode_mouse[] = {
334 { ACTION_USB_HID_MOUSE_UP, BUTTON_UP, BUTTON_NONE },
335 { ACTION_USB_HID_MOUSE_UP_REP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
336 { ACTION_USB_HID_MOUSE_DOWN, BUTTON_DOWN, BUTTON_NONE },
337 { ACTION_USB_HID_MOUSE_DOWN_REP, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
338 { ACTION_USB_HID_MOUSE_LEFT, BUTTON_LEFT, BUTTON_NONE },
339 { ACTION_USB_HID_MOUSE_LEFT_REP, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
340 { ACTION_USB_HID_MOUSE_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
341 { ACTION_USB_HID_MOUSE_RIGHT_REP, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
342
343 { ACTION_USB_HID_MOUSE_BUTTON_LEFT, BUTTON_SELECT, BUTTON_NONE },
344 { ACTION_USB_HID_MOUSE_BUTTON_LEFT_REL, BUTTON_SELECT|BUTTON_REL, BUTTON_NONE },
345
346 { ACTION_USB_HID_MOUSE_BUTTON_RIGHT, BUTTON_PLAYPAUSE, BUTTON_NONE },
347 { ACTION_USB_HID_MOUSE_BUTTON_RIGHT_REL, BUTTON_PLAYPAUSE|BUTTON_REL, BUTTON_PLAYPAUSE },
348
349 { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_UP, BUTTON_BACK, BUTTON_NONE },
350 { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_UP, BUTTON_BACK|BUTTON_REPEAT, BUTTON_NONE },
351 { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_DOWN, BUTTON_BOTTOMLEFT, BUTTON_NONE },
352 { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_DOWN, BUTTON_BOTTOMLEFT|BUTTON_REPEAT, BUTTON_NONE },
353
354 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
355}; /* button_context_usb_hid_mode_mouse */
356#endif
357#endif
Amaury Pouly268d83f2011-09-13 23:40:24 +0000358
359/* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */
360const struct button_mapping* get_context_mapping(int context)
361{
362 switch (context)
363 {
364 case CONTEXT_STD:
365 return button_context_standard;
Amaury Pouly268d83f2011-09-13 23:40:24 +0000366 case CONTEXT_SETTINGS:
Amaury Pouly374a08a2011-11-30 18:39:22 +0000367 return button_context_settings;
368 case CONTEXT_WPS:
369 return button_context_wps;
370 case CONTEXT_YESNOSCREEN:
371 return button_context_yesno;
372 case CONTEXT_SETTINGS_TIME:
373 return button_context_time;
374 case CONTEXT_KEYBOARD:
375 case CONTEXT_MORSE_INPUT:
376 return button_context_keyboard;
377 case CONTEXT_FM:
378 return button_context_radio;
379 case CONTEXT_LIST:
380 return button_context_list;
381 case CONTEXT_TREE:
382 return button_context_tree;
383 case CONTEXT_SETTINGS_EQ:
384 return button_context_eq;
385 case CONTEXT_RECSCREEN:
386 return button_context_recscreen;
387 case CONTEXT_QUICKSCREEN:
388 return button_context_quickscreen;
389 case CONTEXT_BOOKMARKSCREEN:
390 return button_context_bmark;
391 case CONTEXT_PITCHSCREEN:
392 return button_context_pitchscreen;
393 case CONTEXT_SETTINGS_COLOURCHOOSER:
394 return button_context_colorchooser;
395 case CONTEXT_SETTINGS_RECTRIGGER:
396 return button_context_settings_right_is_inc;
397 case CONTEXT_CUSTOM|CONTEXT_SETTINGS:
398 return button_context_settings_right_is_inc;
399#ifdef USB_ENABLE_HID
400 case CONTEXT_USB_HID:
401 return button_context_usb_hid;
402 case CONTEXT_USB_HID_MODE_MULTIMEDIA:
403 return button_context_usb_hid_mode_multimedia;
404 case CONTEXT_USB_HID_MODE_PRESENTATION:
405 return button_context_usb_hid_mode_presentation;
406 case CONTEXT_USB_HID_MODE_BROWSER:
407 return button_context_usb_hid_mode_browser;
408#ifdef HAVE_USB_HID_MOUSE
409 case CONTEXT_USB_HID_MODE_MOUSE:
410 return button_context_usb_hid_mode_mouse;
411#endif
412#endif
Amaury Pouly268d83f2011-09-13 23:40:24 +0000413 default:
414 return button_context_standard;
Amaury Poulycb0a8cb2011-10-02 14:44:22 +0000415 }
Amaury Pouly268d83f2011-09-13 23:40:24 +0000416 return button_context_standard;
417}