nwztools: various fix and enhancements
[maemo-rb.git] / apps / keymaps / keymap-fuzeplus.c
blob43c50c03b0fecac6e95c1325d3c0551628dbef0d
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright © Amaury Pouly 2011
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.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
22 #include "config.h"
23 #include "action.h"
24 #include "button.h"
25 #include "settings.h"
27 /* {Action Code, Button code, Prereq button code } */
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
35 static const struct button_mapping button_context_standard[] = {
36 { 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 },
41 { ACTION_STD_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
42 { ACTION_STD_CONTEXT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
44 { ACTION_STD_CANCEL, BUTTON_BACK, BUTTON_NONE },
45 { ACTION_STD_CANCEL, BUTTON_BACK|BUTTON_REPEAT, BUTTON_NONE },
46 { ACTION_STD_CANCEL, BUTTON_LEFT, BUTTON_NONE },
47 { ACTION_STD_CANCEL, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
48 { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
49 { ACTION_STD_OK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
51 { ACTION_STD_KEYLOCK, BUTTON_POWER, BUTTON_NONE },
53 /* { ACTION_STD_QUICKSCREEN, BUTTON_REC|BUTTON_SELECT, BUTTON_REC },
54 { ACTION_STD_REC, BUTTON_REC|BUTTON_REPEAT, BUTTON_REC },
55 { ACTION_STD_HOTKEY, BUTTON_REC|BUTTON_SELECT, BUTTON_REC },
56 { ACTION_STD_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
57 on some gesture later? */
59 LAST_ITEM_IN_LIST
60 }; /* button_context_standard */
62 static const struct button_mapping button_context_wps[] = {
63 { ACTION_WPS_PLAY, BUTTON_PLAYPAUSE|BUTTON_REL, BUTTON_PLAYPAUSE },
64 { ACTION_WPS_STOP, BUTTON_PLAYPAUSE|BUTTON_REPEAT, BUTTON_NONE },
66 { ACTION_WPS_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE },
68 { ACTION_WPS_SKIPNEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
69 { ACTION_WPS_SEEKFWD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
70 { ACTION_WPS_SKIPPREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
71 { ACTION_WPS_SEEKBACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
72 { ACTION_WPS_STOPSEEK, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT },
73 { ACTION_WPS_STOPSEEK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT },
75 { ACTION_WPS_VOLUP, BUTTON_VOL_UP, BUTTON_NONE },
76 { ACTION_WPS_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
77 { ACTION_WPS_VOLUP, BUTTON_UP, BUTTON_NONE },
78 { ACTION_WPS_VOLUP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
80 { ACTION_WPS_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE },
81 { ACTION_WPS_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
82 { ACTION_WPS_VOLDOWN, BUTTON_DOWN, BUTTON_NONE },
83 { ACTION_WPS_VOLDOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
85 { ACTION_WPS_MENU, BUTTON_BACK, BUTTON_NONE },
86 { ACTION_WPS_BROWSE, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
87 { ACTION_WPS_PITCHSCREEN, BUTTON_BOTTOMLEFT|BUTTON_REPEAT, BUTTON_BOTTOMLEFT },
88 { ACTION_WPS_QUICKSCREEN, BUTTON_BOTTOMLEFT|BUTTON_REL, BUTTON_BOTTOMLEFT },
89 { ACTION_WPS_ID3SCREEN, BUTTON_BOTTOMRIGHT|BUTTON_REPEAT, BUTTON_BOTTOMRIGHT },
91 { ACTION_WPS_HOTKEY, BUTTON_BOTTOMRIGHT|BUTTON_REL, BUTTON_BOTTOMRIGHT },
93 /* Playlist should be hard linked on BOTTOMRIGHT and hotkey move to some gesture in the future
94 { ACTION_WPS_VIEW_PLAYLIST, BUTTON_BACK|BUTTON_DOWN, BUTTON_NONE },
95 { ACTION_WPS_ABSETB_NEXTDIR, BUTTON_BACK|BUTTON_RIGHT, BUTTON_BACK },
96 { ACTION_WPS_ABSETA_PREVDIR, BUTTON_BACK|BUTTON_LEFT, BUTTON_BACK },
97 { ACTION_WPS_ABRESET, BUTTON_BACK|BUTTON_SELECT, BUTTON_BACK },
98 on some gesture later? */
100 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
101 }; /* button_context_wps */
103 static const struct button_mapping button_context_keyboard[] = {
104 { ACTION_KBD_LEFT, BUTTON_LEFT, BUTTON_NONE },
105 { ACTION_KBD_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
106 { ACTION_KBD_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
107 { ACTION_KBD_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
108 { ACTION_KBD_UP, BUTTON_UP, BUTTON_NONE },
109 { ACTION_KBD_UP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
110 { ACTION_KBD_DOWN, BUTTON_DOWN, BUTTON_NONE },
111 { ACTION_KBD_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
113 { ACTION_KBD_CURSOR_LEFT, BUTTON_BOTTOMLEFT, BUTTON_NONE },
114 { ACTION_KBD_CURSOR_LEFT, BUTTON_BOTTOMLEFT|BUTTON_REPEAT, BUTTON_NONE },
115 { ACTION_KBD_CURSOR_RIGHT, BUTTON_BOTTOMRIGHT, BUTTON_NONE },
116 { ACTION_KBD_CURSOR_RIGHT, BUTTON_BOTTOMRIGHT|BUTTON_REPEAT, BUTTON_NONE },
118 { ACTION_KBD_BACKSPACE, BUTTON_BACK, BUTTON_NONE },
119 { ACTION_KBD_BACKSPACE, BUTTON_BACK|BUTTON_REPEAT, BUTTON_NONE },
121 { ACTION_KBD_SELECT, BUTTON_PLAYPAUSE, BUTTON_NONE },
122 { ACTION_KBD_DONE, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
123 { ACTION_KBD_ABORT, BUTTON_POWER, BUTTON_NONE },
125 { ACTION_KBD_MORSE_INPUT, BUTTON_VOL_UP, BUTTON_NONE },
126 { ACTION_KBD_MORSE_SELECT, BUTTON_VOL_DOWN|BUTTON_REL, BUTTON_NONE },
128 LAST_ITEM_IN_LIST
129 }; /* button_context_keyboard */
131 static const struct button_mapping button_context_quickscreen[] = {
132 { ACTION_STD_CANCEL, BUTTON_SELECT, BUTTON_NONE },
133 { ACTION_STD_CANCEL, BUTTON_BACK, BUTTON_NONE },
134 { ACTION_STD_CANCEL, BUTTON_PLAYPAUSE, BUTTON_NONE },
135 { ACTION_STD_CANCEL, BUTTON_BOTTOMRIGHT, BUTTON_NONE },
136 { ACTION_STD_CANCEL, BUTTON_BOTTOMLEFT, BUTTON_NONE },
137 { ACTION_QS_TOP, BUTTON_UP, BUTTON_NONE },
138 { ACTION_QS_DOWN, BUTTON_DOWN, BUTTON_NONE },
139 { ACTION_QS_LEFT, BUTTON_LEFT, BUTTON_NONE },
140 { ACTION_QS_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
142 LAST_ITEM_IN_LIST
143 }; /* button_context_quickscreen */
145 static const struct button_mapping button_context_tree[] = {
146 { ACTION_TREE_WPS, BUTTON_PLAYPAUSE|BUTTON_REL, BUTTON_PLAYPAUSE },
147 { ACTION_TREE_STOP, BUTTON_PLAYPAUSE|BUTTON_REPEAT, BUTTON_NONE },
149 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST)
150 }; /* button_context_tree */
152 static const struct button_mapping button_context_list[] = {
153 #ifdef HAVE_VOLUME_IN_LIST
154 { ACTION_LIST_VOLUP, BUTTON_VOL_UP, BUTTON_NONE },
155 { ACTION_LIST_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
156 { ACTION_LIST_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE },
157 { ACTION_LIST_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
158 #endif
159 { ACTION_LISTTREE_PGUP, BUTTON_BOTTOMLEFT, BUTTON_NONE },
160 { ACTION_LISTTREE_PGUP, BUTTON_BOTTOMLEFT|BUTTON_REPEAT, BUTTON_NONE },
161 { ACTION_LISTTREE_PGDOWN, BUTTON_BOTTOMRIGHT, BUTTON_NONE },
162 { ACTION_LISTTREE_PGDOWN, BUTTON_BOTTOMRIGHT|BUTTON_REPEAT, BUTTON_NONE },
163 /*#ifdef HAVE_HOTKEY on some gesture later?
164 { ACTION_TREE_HOTKEY, BUTTON_BACK|BUTTON_REL, BUTTON_BACK|BUTTON_REPEAT },
165 #endif*/
167 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
168 }; /* button_context_list */
170 #ifdef CONFIG_TUNER
171 static const struct button_mapping button_context_radio[] = {
172 { ACTION_FM_MENU, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE },
173 { ACTION_FM_PRESET, BUTTON_BOTTOMRIGHT, BUTTON_SELECT },
174 { ACTION_FM_PLAY, BUTTON_PLAYPAUSE|BUTTON_REL, BUTTON_PLAYPAUSE },
175 { ACTION_FM_STOP, BUTTON_PLAYPAUSE|BUTTON_REPEAT, BUTTON_NONE },
176 { ACTION_FM_MODE, BUTTON_BOTTOMLEFT, BUTTON_BOTTOMLEFT },
177 { ACTION_SETTINGS_INC, BUTTON_VOL_UP, BUTTON_NONE },
178 { ACTION_SETTINGS_INCREPEAT, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
179 { ACTION_SETTINGS_DEC, BUTTON_VOL_DOWN, BUTTON_NONE },
180 { ACTION_SETTINGS_DECREPEAT, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
182 { ACTION_FM_EXIT, BUTTON_BACK, BUTTON_NONE },
184 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
185 }; /* button_context_radio */
186 #endif
188 #ifdef HAVE_RECORDING
189 static const struct button_mapping button_context_recscreen[] = {
190 { ACTION_REC_PAUSE, BUTTON_PLAYPAUSE|BUTTON_REL, BUTTON_PLAYPAUSE },
191 { ACTION_REC_NEWFILE, BUTTON_BOTTOMRIGHT, BUTTON_NONE },
192 { ACTION_SETTINGS_INC, BUTTON_RIGHT, BUTTON_NONE },
193 { ACTION_SETTINGS_INCREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
194 { ACTION_SETTINGS_DEC, BUTTON_LEFT, BUTTON_NONE },
195 { ACTION_SETTINGS_DECREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
197 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
198 }; /* button_context_recscreen */
199 #endif
201 static const struct button_mapping button_context_settings[] = {
202 /* we overwrite this to avoid select from std */
203 { ACTION_NONE, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
205 { ACTION_SETTINGS_INC, BUTTON_UP, BUTTON_NONE },
206 { ACTION_SETTINGS_INCREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
207 { ACTION_SETTINGS_DEC, BUTTON_DOWN, BUTTON_NONE },
208 { ACTION_SETTINGS_DECREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
210 { ACTION_STD_PREV, BUTTON_LEFT, BUTTON_NONE },
211 { ACTION_STD_PREVREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
212 { ACTION_STD_NEXT, BUTTON_RIGHT, BUTTON_NONE },
213 { ACTION_STD_NEXTREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
215 { ACTION_SETTINGS_INCBIGSTEP, BUTTON_BOTTOMRIGHT, BUTTON_NONE },
216 { ACTION_SETTINGS_INCBIGSTEP, BUTTON_BOTTOMRIGHT|BUTTON_REPEAT, BUTTON_NONE },
217 { ACTION_SETTINGS_DECBIGSTEP, BUTTON_BOTTOMLEFT, BUTTON_NONE },
218 { ACTION_SETTINGS_DECBIGSTEP, BUTTON_BOTTOMLEFT|BUTTON_REPEAT, BUTTON_NONE },
220 { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
221 { ACTION_SETTINGS_RESET, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE },
223 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
224 }; /* button_context_settings */
226 static const struct button_mapping button_context_settings_right_is_inc[] = {
227 { ACTION_SETTINGS_INC, BUTTON_RIGHT, BUTTON_NONE },
228 { ACTION_SETTINGS_INCREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
229 { ACTION_SETTINGS_DEC, BUTTON_LEFT, BUTTON_NONE },
230 { ACTION_SETTINGS_DECREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
231 { ACTION_STD_PREV, BUTTON_UP, BUTTON_NONE },
232 { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
233 { ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE },
234 { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
236 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
237 }; /* button_context_settingsgraphical */
239 static const struct button_mapping button_context_time[] = {
241 { ACTION_STD_CANCEL, BUTTON_BACK, BUTTON_NONE },
242 { ACTION_STD_OK, BUTTON_PLAYPAUSE, BUTTON_NONE },
244 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
245 }; /* button_context_time */
247 static const struct button_mapping button_context_colorchooser[] = {
248 { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
249 { ACTION_STD_CANCEL, BUTTON_BACK, BUTTON_NONE },
251 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS),
252 }; /* button_context_colorchooser */
254 static const struct button_mapping button_context_eq[] = {
255 { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
257 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS),
258 }; /* button_context_eq */
260 /* Bookmark Screen */
261 static const struct button_mapping button_context_bmark[] = {
262 { ACTION_BMS_DELETE, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
264 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
265 }; /* button_context_bmark */
267 static const struct button_mapping button_context_pitchscreen[] = {
269 { ACTION_PS_INC_SMALL, BUTTON_UP, BUTTON_NONE },
270 { ACTION_PS_INC_BIG, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
271 { ACTION_PS_DEC_SMALL, BUTTON_DOWN, BUTTON_NONE },
272 { ACTION_PS_DEC_BIG, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
274 { ACTION_PS_NUDGE_LEFT, BUTTON_LEFT, BUTTON_NONE },
275 { ACTION_PS_NUDGE_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
276 { ACTION_PS_NUDGE_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
277 { ACTION_PS_NUDGE_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
279 { ACTION_PS_TOGGLE_MODE, BUTTON_BOTTOMRIGHT, BUTTON_NONE },
281 { ACTION_PS_RESET, BUTTON_SELECT, BUTTON_NONE },
282 { ACTION_PS_EXIT, BUTTON_BACK, BUTTON_NONE },
283 { ACTION_PS_EXIT, BUTTON_PLAYPAUSE, BUTTON_NONE },
285 LAST_ITEM_IN_LIST
286 }; /* button_context_pitchcreen */
288 static const struct button_mapping button_context_yesno[] = {
289 { ACTION_YESNO_ACCEPT, BUTTON_SELECT, BUTTON_NONE },
291 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
292 }; /* button_context_yesno */
294 #ifdef USB_ENABLE_HID
295 static const struct button_mapping button_context_usb_hid[] = {
296 { ACTION_USB_HID_MODE_SWITCH_NEXT, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
297 { ACTION_USB_HID_MODE_SWITCH_PREV, BUTTON_POWER|BUTTON_REPEAT, BUTTON_POWER },
299 LAST_ITEM_IN_LIST
300 }; /* button_context_usb_hid */
302 static const struct button_mapping button_context_usb_hid_mode_multimedia[] = {
304 { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_DOWN, BUTTON_NONE },
305 { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
306 { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_UP, BUTTON_NONE },
307 { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
308 { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_VOL_DOWN, BUTTON_NONE },
309 { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
310 { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_VOL_UP, BUTTON_NONE },
311 { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
312 { ACTION_USB_HID_MULTIMEDIA_VOLUME_MUTE, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
313 { ACTION_USB_HID_MULTIMEDIA_VOLUME_MUTE, BUTTON_BACK|BUTTON_REL, BUTTON_BACK },
314 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_PLAY_PAUSE, BUTTON_PLAYPAUSE|BUTTON_REL, BUTTON_PLAYPAUSE },
315 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_STOP, BUTTON_PLAYPAUSE|BUTTON_REPEAT, BUTTON_PLAYPAUSE },
316 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_TRACK_PREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
317 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_TRACK_NEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
319 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
320 }; /* button_context_usb_hid_mode_multimedia */
323 static const struct button_mapping button_context_usb_hid_mode_presentation[] = {
324 { ACTION_USB_HID_PRESENTATION_SLIDESHOW_START, BUTTON_PLAYPAUSE|BUTTON_REL, BUTTON_PLAYPAUSE },
325 { ACTION_USB_HID_PRESENTATION_SLIDESHOW_LEAVE, BUTTON_PLAYPAUSE|BUTTON_REPEAT, BUTTON_PLAYPAUSE },
326 { ACTION_USB_HID_PRESENTATION_SLIDE_PREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
327 { ACTION_USB_HID_PRESENTATION_SLIDE_NEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
328 { ACTION_USB_HID_PRESENTATION_SLIDE_FIRST, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
329 { ACTION_USB_HID_PRESENTATION_SLIDE_LAST, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
330 { ACTION_USB_HID_PRESENTATION_SCREEN_BLACK, BUTTON_BOTTOMRIGHT|BUTTON_REPEAT, BUTTON_BOTTOMRIGHT },
331 { ACTION_USB_HID_PRESENTATION_SCREEN_WHITE, BUTTON_BOTTOMLEFT|BUTTON_REPEAT, BUTTON_BOTTOMLEFT },
332 { ACTION_USB_HID_PRESENTATION_LINK_PREV, BUTTON_UP, BUTTON_NONE },
333 { ACTION_USB_HID_PRESENTATION_LINK_PREV, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
334 { ACTION_USB_HID_PRESENTATION_LINK_NEXT, BUTTON_DOWN, BUTTON_NONE },
335 { ACTION_USB_HID_PRESENTATION_LINK_NEXT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
336 { ACTION_USB_HID_PRESENTATION_MOUSE_CLICK, BUTTON_SELECT, BUTTON_SELECT },
337 { ACTION_USB_HID_PRESENTATION_MOUSE_OVER, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
339 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
340 }; /* button_context_usb_hid_mode_presentation */
342 static const struct button_mapping button_context_usb_hid_mode_browser[] = {
343 { ACTION_USB_HID_BROWSER_SCROLL_UP, BUTTON_UP, BUTTON_NONE },
344 { ACTION_USB_HID_BROWSER_SCROLL_UP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
345 { ACTION_USB_HID_BROWSER_SCROLL_DOWN, BUTTON_DOWN, BUTTON_NONE },
346 { ACTION_USB_HID_BROWSER_SCROLL_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
347 { ACTION_USB_HID_BROWSER_SCROLL_PAGE_UP, BUTTON_BOTTOMLEFT, BUTTON_NONE },
348 { ACTION_USB_HID_BROWSER_SCROLL_PAGE_UP, BUTTON_BOTTOMLEFT|BUTTON_REPEAT, BUTTON_NONE },
349 { ACTION_USB_HID_BROWSER_SCROLL_PAGE_DOWN, BUTTON_BOTTOMRIGHT, BUTTON_NONE },
350 { ACTION_USB_HID_BROWSER_SCROLL_PAGE_DOWN, BUTTON_BOTTOMRIGHT|BUTTON_REPEAT, BUTTON_NONE },
351 { ACTION_USB_HID_BROWSER_ZOOM_IN, BUTTON_VOL_UP, BUTTON_NONE },
352 { ACTION_USB_HID_BROWSER_ZOOM_IN, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
353 { ACTION_USB_HID_BROWSER_ZOOM_OUT, BUTTON_VOL_DOWN, BUTTON_NONE },
354 { ACTION_USB_HID_BROWSER_ZOOM_OUT, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
355 { ACTION_USB_HID_BROWSER_ZOOM_RESET, BUTTON_PLAYPAUSE|BUTTON_REPEAT, BUTTON_NONE },
356 { ACTION_USB_HID_BROWSER_TAB_PREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
357 { ACTION_USB_HID_BROWSER_TAB_NEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
358 { ACTION_USB_HID_BROWSER_TAB_CLOSE, BUTTON_BACK|BUTTON_REPEAT, BUTTON_BACK },
359 { ACTION_USB_HID_BROWSER_HISTORY_BACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
360 { ACTION_USB_HID_BROWSER_HISTORY_FORWARD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
361 { ACTION_USB_HID_BROWSER_VIEW_FULL_SCREEN, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
363 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
364 }; /* button_context_usb_hid_mode_browser */
366 #ifdef HAVE_USB_HID_MOUSE
367 static const struct button_mapping button_context_usb_hid_mode_mouse[] = {
368 { ACTION_USB_HID_MOUSE_UP, BUTTON_UP, BUTTON_NONE },
369 { ACTION_USB_HID_MOUSE_UP_REP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
370 { ACTION_USB_HID_MOUSE_DOWN, BUTTON_DOWN, BUTTON_NONE },
371 { ACTION_USB_HID_MOUSE_DOWN_REP, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
372 { ACTION_USB_HID_MOUSE_LEFT, BUTTON_LEFT, BUTTON_NONE },
373 { ACTION_USB_HID_MOUSE_LEFT_REP, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
374 { ACTION_USB_HID_MOUSE_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
375 { ACTION_USB_HID_MOUSE_RIGHT_REP, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
377 { ACTION_USB_HID_MOUSE_BUTTON_LEFT, BUTTON_SELECT, BUTTON_NONE },
378 { ACTION_USB_HID_MOUSE_BUTTON_LEFT_REL, BUTTON_SELECT|BUTTON_REL, BUTTON_NONE },
380 { ACTION_USB_HID_MOUSE_BUTTON_RIGHT, BUTTON_PLAYPAUSE, BUTTON_NONE },
381 { ACTION_USB_HID_MOUSE_BUTTON_RIGHT_REL, BUTTON_PLAYPAUSE|BUTTON_REL, BUTTON_PLAYPAUSE },
383 { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_UP, BUTTON_BACK, BUTTON_NONE },
384 { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_UP, BUTTON_BACK|BUTTON_REPEAT, BUTTON_NONE },
385 { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_DOWN, BUTTON_BOTTOMLEFT, BUTTON_NONE },
386 { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_DOWN, BUTTON_BOTTOMLEFT|BUTTON_REPEAT, BUTTON_NONE },
388 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
389 }; /* button_context_usb_hid_mode_mouse */
390 #endif
391 #endif
393 /* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */
394 const struct button_mapping* get_context_mapping(int context)
396 switch (context)
398 case CONTEXT_STD:
399 return button_context_standard;
400 case CONTEXT_MAINMENU:
401 return button_context_tree;
402 case CONTEXT_SETTINGS:
403 return button_context_settings;
404 case CONTEXT_WPS:
405 return button_context_wps;
406 case CONTEXT_YESNOSCREEN:
407 return button_context_yesno;
408 case CONTEXT_SETTINGS_TIME:
409 return button_context_time;
410 case CONTEXT_KEYBOARD:
411 case CONTEXT_MORSE_INPUT:
412 return button_context_keyboard;
413 #ifdef CONFIG_TUNER
414 case CONTEXT_FM:
415 return button_context_radio;
416 #endif
417 case CONTEXT_LIST:
418 return button_context_list;
419 case CONTEXT_TREE:
420 return button_context_tree;
421 case CONTEXT_SETTINGS_EQ:
422 return button_context_eq;
423 #ifdef HAVE_RECORDING
424 case CONTEXT_RECSCREEN:
425 return button_context_recscreen;
426 #endif
427 case CONTEXT_QUICKSCREEN:
428 return button_context_quickscreen;
429 case CONTEXT_BOOKMARKSCREEN:
430 return button_context_bmark;
431 case CONTEXT_PITCHSCREEN:
432 return button_context_pitchscreen;
433 case CONTEXT_SETTINGS_COLOURCHOOSER:
434 return button_context_colorchooser;
435 case CONTEXT_SETTINGS_RECTRIGGER:
436 return button_context_settings_right_is_inc;
437 case CONTEXT_CUSTOM|CONTEXT_SETTINGS:
438 return button_context_settings_right_is_inc;
439 #ifdef USB_ENABLE_HID
440 case CONTEXT_USB_HID:
441 return button_context_usb_hid;
442 case CONTEXT_USB_HID_MODE_MULTIMEDIA:
443 return button_context_usb_hid_mode_multimedia;
444 case CONTEXT_USB_HID_MODE_PRESENTATION:
445 return button_context_usb_hid_mode_presentation;
446 case CONTEXT_USB_HID_MODE_BROWSER:
447 return button_context_usb_hid_mode_browser;
448 #ifdef HAVE_USB_HID_MOUSE
449 case CONTEXT_USB_HID_MODE_MOUSE:
450 return button_context_usb_hid_mode_mouse;
451 #endif
452 #endif
453 default:
454 return button_context_standard;
456 return button_context_standard;