fix pitch_detector: recording will stop itself if the callback returns <0
[kugel-rb.git] / apps / keymaps / keymap-c200.c
blobf19440019c07e2a055fb97b97563844da42ed728
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2007 Mark Arigo
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 ****************************************************************************/
21 /* Button Code Definitions for Sandisk c200 target */
23 #include "config.h"
24 #include "action.h"
25 #include "button.h"
26 #include "settings.h"
28 /* {Action Code, Button code, Prereq button code } */
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
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 },
40 { ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE },
41 { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
43 { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
44 { ACTION_STD_OK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
45 { ACTION_STD_CANCEL, BUTTON_LEFT, BUTTON_NONE },
47 { ACTION_STD_MENU, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
48 { ACTION_STD_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
49 { ACTION_STD_REC, BUTTON_REC|BUTTON_REPEAT, BUTTON_REC },
50 { ACTION_STD_QUICKSCREEN, BUTTON_REC|BUTTON_SELECT, BUTTON_REC },
52 LAST_ITEM_IN_LIST
53 }; /* button_context_standard */
56 static const struct button_mapping button_context_wps[] = {
57 { ACTION_WPS_PLAY, BUTTON_UP|BUTTON_REL, BUTTON_UP },
58 { ACTION_WPS_STOP, BUTTON_UP|BUTTON_REPEAT, BUTTON_UP },
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 },
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 },
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 },
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 },
77 { ACTION_WPS_MENU, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
78 { ACTION_WPS_BROWSE, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
79 { ACTION_WPS_PITCHSCREEN, BUTTON_SELECT|BUTTON_UP, BUTTON_SELECT },
80 { ACTION_WPS_ID3SCREEN, BUTTON_SELECT|BUTTON_DOWN, BUTTON_SELECT },
81 { ACTION_WPS_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
82 { ACTION_WPS_QUICKSCREEN, BUTTON_DOWN, BUTTON_NONE },
83 { ACTION_WPS_REC, BUTTON_REC|BUTTON_REPEAT, BUTTON_NONE },
84 { ACTION_WPS_HOTKEY, BUTTON_REC|BUTTON_REL, BUTTON_REC },
86 LAST_ITEM_IN_LIST
87 }; /* button_context_wps */
89 static const struct button_mapping button_context_settings[] = {
90 { ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE },
91 { ACTION_SETTINGS_RESET, BUTTON_SELECT, BUTTON_NONE },
93 { ACTION_SETTINGS_INC, BUTTON_UP, BUTTON_NONE },
94 { ACTION_SETTINGS_INCREPEAT,BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
96 { ACTION_SETTINGS_DEC, BUTTON_DOWN, BUTTON_NONE },
97 { ACTION_SETTINGS_DECREPEAT,BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
99 { ACTION_STD_PREV, BUTTON_LEFT, BUTTON_NONE },
100 { ACTION_STD_PREVREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
101 { ACTION_NONE, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
103 { ACTION_STD_NEXT, BUTTON_RIGHT, BUTTON_NONE },
104 { ACTION_STD_NEXTREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
105 { ACTION_NONE, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
107 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
108 }; /* button_context_settings */
110 static const struct button_mapping button_context_list[] = {
111 { ACTION_LISTTREE_PGUP, BUTTON_REC|BUTTON_UP, BUTTON_REC },
112 { ACTION_LISTTREE_PGDOWN, BUTTON_REC|BUTTON_DOWN, BUTTON_REC },
114 #ifdef HAVE_VOLUME_IN_LIST
115 { ACTION_LIST_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
116 { ACTION_LIST_VOLUP, BUTTON_VOL_UP, BUTTON_NONE },
117 { ACTION_LIST_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE },
118 { ACTION_LIST_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
119 #endif
121 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
122 }; /* button_context_list */
124 static const struct button_mapping button_context_tree[] = {
125 { ACTION_TREE_WPS, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
126 { ACTION_TREE_HOTKEY, BUTTON_REC|BUTTON_REL, BUTTON_REC },
128 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
129 }; /* button_context_tree */
131 static const struct button_mapping button_context_listtree_scroll_with_combo[] = {
132 { ACTION_TREE_ROOT_INIT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
134 { ACTION_TREE_PGLEFT, BUTTON_REC|BUTTON_LEFT, BUTTON_REC },
135 { ACTION_TREE_PGLEFT, BUTTON_REC|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
137 { ACTION_TREE_PGRIGHT, BUTTON_REC|BUTTON_RIGHT, BUTTON_REC },
138 { ACTION_TREE_PGRIGHT, BUTTON_REC|BUTTON_RIGHT|BUTTON_REPEAT,BUTTON_NONE },
140 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
141 }; /* button_context_listtree_scroll_with_combo */
143 static const struct button_mapping button_context_yesno[] = {
144 { ACTION_YESNO_ACCEPT, BUTTON_SELECT, BUTTON_NONE },
146 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
147 }; /* button_context_settings_yesno */
149 static const struct button_mapping button_context_quickscreen[] = {
150 { ACTION_NONE, BUTTON_LEFT, BUTTON_NONE },
151 { ACTION_STD_CANCEL, BUTTON_POWER|BUTTON_REL, BUTTON_NONE },
153 { ACTION_QS_TOP, BUTTON_UP|BUTTON_REL, BUTTON_NONE },
154 { ACTION_QS_TOP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
156 { ACTION_QS_DOWN, BUTTON_DOWN|BUTTON_REL, BUTTON_NONE },
157 { ACTION_QS_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
159 { ACTION_QS_LEFT, BUTTON_LEFT|BUTTON_REL, BUTTON_NONE },
160 { ACTION_QS_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
162 { ACTION_QS_RIGHT, BUTTON_RIGHT|BUTTON_REL, BUTTON_NONE },
163 { ACTION_QS_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
165 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
166 }; /* button_context_quickscreen */
168 static const struct button_mapping button_context_settings_right_is_inc[] = {
169 { ACTION_SETTINGS_INC, BUTTON_RIGHT, BUTTON_NONE },
170 { ACTION_SETTINGS_INCREPEAT,BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
171 { ACTION_NONE, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
173 { ACTION_SETTINGS_DEC, BUTTON_LEFT, BUTTON_NONE },
174 { ACTION_SETTINGS_DECREPEAT,BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
175 { ACTION_NONE, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
177 { ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE },
179 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
180 }; /* button_context_settings_right_is_inc */
182 static const struct button_mapping button_context_pitchscreen[] = {
183 { ACTION_PS_INC_SMALL, BUTTON_UP, BUTTON_NONE },
184 { ACTION_PS_INC_BIG, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
185 { ACTION_PS_DEC_SMALL, BUTTON_DOWN, BUTTON_NONE },
186 { ACTION_PS_DEC_BIG, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
187 { ACTION_PS_NUDGE_LEFT, BUTTON_LEFT, BUTTON_NONE },
188 { ACTION_PS_NUDGE_LEFTOFF, BUTTON_LEFT|BUTTON_REL, BUTTON_NONE },
189 { ACTION_PS_NUDGE_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
190 { ACTION_PS_NUDGE_RIGHTOFF, BUTTON_RIGHT|BUTTON_REL, BUTTON_NONE },
191 { ACTION_PS_TOGGLE_MODE, BUTTON_REC, BUTTON_NONE },
192 { ACTION_PS_RESET, BUTTON_SELECT, BUTTON_NONE },
193 { ACTION_PS_EXIT, BUTTON_POWER, BUTTON_NONE },
194 { ACTION_PS_SLOWER, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
195 { ACTION_PS_FASTER, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
196 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
197 }; /* button_context_pitchscreen */
199 /** Recording Screen **/
200 #ifdef HAVE_RECORDING
201 static const struct button_mapping button_context_recscreen[] = {
202 { ACTION_STD_MENU, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
203 { ACTION_REC_PAUSE, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
204 { ACTION_STD_CANCEL, BUTTON_POWER|BUTTON_REPEAT, BUTTON_NONE },
205 { ACTION_REC_NEWFILE, BUTTON_REC|BUTTON_REL, BUTTON_REC },
207 { ACTION_SETTINGS_INC, BUTTON_RIGHT, BUTTON_NONE },
208 { ACTION_SETTINGS_INCREPEAT,BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
209 { ACTION_SETTINGS_DEC, BUTTON_LEFT, BUTTON_NONE },
210 { ACTION_SETTINGS_DECREPEAT,BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
212 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
213 }; /* button_context_recscreen */
214 #endif
216 /** FM Radio Screen **/
217 #if CONFIG_TUNER
218 static const struct button_mapping button_context_radio[] = {
219 { ACTION_NONE, BUTTON_UP, BUTTON_NONE },
220 { ACTION_FM_MENU, BUTTON_DOWN|BUTTON_REL, BUTTON_NONE },
221 { ACTION_FM_PRESET, BUTTON_SELECT, BUTTON_NONE },
222 { ACTION_FM_STOP, BUTTON_UP|BUTTON_REPEAT, BUTTON_UP },
223 { ACTION_FM_MODE, BUTTON_REC, BUTTON_NONE },
224 { ACTION_FM_EXIT, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
225 { ACTION_FM_PLAY, BUTTON_UP|BUTTON_REL, BUTTON_UP },
226 { ACTION_SETTINGS_INC, BUTTON_VOL_UP, BUTTON_NONE },
227 { ACTION_SETTINGS_INCREPEAT,BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
228 { ACTION_SETTINGS_DEC, BUTTON_VOL_DOWN, BUTTON_NONE },
229 { ACTION_SETTINGS_DECREPEAT,BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
230 { ACTION_FM_QUICKSCREEN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_DOWN },
232 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
233 }; /* button_context_radio */
234 #endif
236 static const struct button_mapping button_context_keyboard[] = {
237 { ACTION_KBD_LEFT, BUTTON_LEFT, BUTTON_NONE },
238 { ACTION_KBD_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
239 { ACTION_KBD_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
240 { ACTION_KBD_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
241 { ACTION_KBD_UP, BUTTON_UP, BUTTON_NONE },
242 { ACTION_KBD_UP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
243 { ACTION_KBD_DOWN, BUTTON_DOWN, BUTTON_NONE },
244 { ACTION_KBD_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
246 { ACTION_KBD_CURSOR_LEFT, BUTTON_VOL_DOWN, BUTTON_NONE },
247 { ACTION_KBD_CURSOR_LEFT, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
248 { ACTION_KBD_CURSOR_RIGHT, BUTTON_VOL_UP, BUTTON_NONE },
249 { ACTION_KBD_CURSOR_RIGHT, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
250 { ACTION_KBD_BACKSPACE, BUTTON_REC, BUTTON_NONE },
251 { ACTION_KBD_BACKSPACE, BUTTON_REC|BUTTON_REPEAT, BUTTON_NONE },
253 { ACTION_KBD_PAGE_FLIP, BUTTON_SELECT|BUTTON_RIGHT, BUTTON_SELECT },
254 { ACTION_KBD_PAGE_FLIP, BUTTON_SELECT|BUTTON_LEFT, BUTTON_SELECT },
256 { ACTION_KBD_SELECT, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
257 { ACTION_KBD_DONE, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
258 { ACTION_KBD_ABORT, BUTTON_POWER, BUTTON_NONE },
260 LAST_ITEM_IN_LIST
261 }; /* button_context_keyboard */
263 static const struct button_mapping button_context_bmark[] = {
264 { ACTION_BMS_DELETE, BUTTON_REC, BUTTON_NONE },
266 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
267 }; /* button_context_bmark */
269 #ifdef USB_ENABLE_HID
270 static const struct button_mapping button_context_usb_hid[] = {
271 { ACTION_USB_HID_MODE_SWITCH_NEXT, BUTTON_REC|BUTTON_REL, BUTTON_REC },
272 { ACTION_USB_HID_MODE_SWITCH_PREV, BUTTON_REC|BUTTON_REPEAT, BUTTON_REC },
274 LAST_ITEM_IN_LIST
275 }; /* button_context_usb_hid */
277 static const struct button_mapping button_context_usb_hid_mode_multimedia[] = {
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_PLAYBACK_PLAY_PAUSE, BUTTON_UP|BUTTON_REL, BUTTON_UP },
284 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_STOP, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
285 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_TRACK_PREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
286 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_TRACK_NEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
288 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
289 }; /* button_context_usb_hid_mode_multimedia */
291 static const struct button_mapping button_context_usb_hid_mode_presentation[] = {
292 { ACTION_USB_HID_PRESENTATION_SLIDESHOW_START, BUTTON_UP|BUTTON_REL, BUTTON_UP },
293 { ACTION_USB_HID_PRESENTATION_SLIDESHOW_LEAVE, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
294 { ACTION_USB_HID_PRESENTATION_SLIDE_PREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
295 { ACTION_USB_HID_PRESENTATION_SLIDE_NEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
296 { ACTION_USB_HID_PRESENTATION_SLIDE_FIRST, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
297 { ACTION_USB_HID_PRESENTATION_SLIDE_LAST, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
298 { ACTION_USB_HID_PRESENTATION_SCREEN_BLACK, BUTTON_DOWN|BUTTON_REL, BUTTON_DOWN },
299 { ACTION_USB_HID_PRESENTATION_SCREEN_WHITE, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_DOWN },
300 { ACTION_USB_HID_PRESENTATION_LINK_PREV, BUTTON_VOL_UP, BUTTON_NONE },
301 { ACTION_USB_HID_PRESENTATION_LINK_PREV, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
302 { ACTION_USB_HID_PRESENTATION_LINK_NEXT, BUTTON_VOL_DOWN, BUTTON_NONE },
303 { ACTION_USB_HID_PRESENTATION_LINK_NEXT, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
304 { ACTION_USB_HID_PRESENTATION_MOUSE_CLICK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
305 { ACTION_USB_HID_PRESENTATION_MOUSE_OVER, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
307 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
308 }; /* button_context_usb_hid_mode_presentation */
310 static const struct button_mapping button_context_usb_hid_mode_browser[] = {
311 { ACTION_USB_HID_BROWSER_SCROLL_UP, BUTTON_VOL_UP, BUTTON_NONE },
312 { ACTION_USB_HID_BROWSER_SCROLL_UP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
313 { ACTION_USB_HID_BROWSER_SCROLL_DOWN, BUTTON_VOL_DOWN, BUTTON_NONE },
314 { ACTION_USB_HID_BROWSER_SCROLL_DOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
315 { ACTION_USB_HID_BROWSER_SCROLL_PAGE_UP, BUTTON_UP|BUTTON_REL, BUTTON_UP },
316 { ACTION_USB_HID_BROWSER_SCROLL_PAGE_DOWN, BUTTON_DOWN|BUTTON_REL, BUTTON_DOWN },
317 { ACTION_USB_HID_BROWSER_ZOOM_IN, BUTTON_UP|BUTTON_REPEAT, BUTTON_UP },
318 { ACTION_USB_HID_BROWSER_ZOOM_OUT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_DOWN },
319 { ACTION_USB_HID_BROWSER_ZOOM_RESET, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
320 { ACTION_USB_HID_BROWSER_ZOOM_RESET, BUTTON_UP|BUTTON_DOWN|BUTTON_REPEAT, BUTTON_UP|BUTTON_DOWN },
321 { ACTION_USB_HID_BROWSER_TAB_PREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
322 { ACTION_USB_HID_BROWSER_TAB_NEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
323 { ACTION_USB_HID_BROWSER_TAB_CLOSE, BUTTON_POWER|BUTTON_REPEAT, BUTTON_POWER },
324 { ACTION_USB_HID_BROWSER_HISTORY_BACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
325 { ACTION_USB_HID_BROWSER_HISTORY_FORWARD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
326 { ACTION_USB_HID_BROWSER_VIEW_FULL_SCREEN, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
328 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
329 }; /* button_context_usb_hid_mode_browser */
331 #ifdef HAVE_USB_HID_MOUSE
332 static const struct button_mapping button_context_usb_hid_mode_mouse[] = {
333 { ACTION_USB_HID_MOUSE_UP, BUTTON_UP, BUTTON_NONE },
334 { ACTION_USB_HID_MOUSE_UP_REP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
335 { ACTION_USB_HID_MOUSE_DOWN, BUTTON_DOWN, BUTTON_NONE },
336 { ACTION_USB_HID_MOUSE_DOWN_REP, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
337 { ACTION_USB_HID_MOUSE_LEFT, BUTTON_LEFT, BUTTON_NONE },
338 { ACTION_USB_HID_MOUSE_LEFT_REP, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
339 { ACTION_USB_HID_MOUSE_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
340 { ACTION_USB_HID_MOUSE_RIGHT_REP, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
341 { ACTION_USB_HID_MOUSE_BUTTON_LEFT, BUTTON_SELECT, BUTTON_NONE },
342 { ACTION_USB_HID_MOUSE_BUTTON_LEFT_REL, BUTTON_SELECT|BUTTON_REL, BUTTON_NONE },
343 { ACTION_USB_HID_MOUSE_LDRAG_UP, BUTTON_SELECT|BUTTON_UP, BUTTON_NONE },
344 { ACTION_USB_HID_MOUSE_LDRAG_UP_REP, BUTTON_SELECT|BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
345 { ACTION_USB_HID_MOUSE_LDRAG_DOWN, BUTTON_SELECT|BUTTON_DOWN, BUTTON_NONE },
346 { ACTION_USB_HID_MOUSE_LDRAG_DOWN_REP, BUTTON_SELECT|BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
347 { ACTION_USB_HID_MOUSE_LDRAG_LEFT, BUTTON_SELECT|BUTTON_LEFT, BUTTON_NONE },
348 { ACTION_USB_HID_MOUSE_LDRAG_LEFT_REP, BUTTON_SELECT|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
349 { ACTION_USB_HID_MOUSE_LDRAG_RIGHT, BUTTON_SELECT|BUTTON_RIGHT, BUTTON_NONE },
350 { ACTION_USB_HID_MOUSE_LDRAG_RIGHT_REP, BUTTON_SELECT|BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
351 { ACTION_USB_HID_MOUSE_BUTTON_RIGHT, BUTTON_POWER, BUTTON_NONE },
352 { ACTION_USB_HID_MOUSE_BUTTON_RIGHT_REL, BUTTON_POWER|BUTTON_REL, BUTTON_NONE },
353 { ACTION_USB_HID_MOUSE_RDRAG_UP, BUTTON_POWER|BUTTON_UP, BUTTON_NONE },
354 { ACTION_USB_HID_MOUSE_RDRAG_UP_REP, BUTTON_POWER|BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
355 { ACTION_USB_HID_MOUSE_RDRAG_DOWN, BUTTON_POWER|BUTTON_DOWN, BUTTON_NONE },
356 { ACTION_USB_HID_MOUSE_RDRAG_DOWN_REP, BUTTON_POWER|BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
357 { ACTION_USB_HID_MOUSE_RDRAG_LEFT, BUTTON_POWER|BUTTON_LEFT, BUTTON_NONE },
358 { ACTION_USB_HID_MOUSE_RDRAG_LEFT_REP, BUTTON_POWER|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
359 { ACTION_USB_HID_MOUSE_RDRAG_RIGHT, BUTTON_POWER|BUTTON_RIGHT, BUTTON_NONE },
360 { ACTION_USB_HID_MOUSE_RDRAG_RIGHT_REP, BUTTON_POWER|BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
361 { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_UP, BUTTON_VOL_UP, BUTTON_NONE },
362 { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_UP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
363 { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_DOWN, BUTTON_VOL_DOWN, BUTTON_NONE },
364 { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_DOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
366 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
367 }; /* button_context_usb_hid_mode_mouse */
368 #endif
369 #endif
371 /* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */
372 const struct button_mapping* get_context_mapping(int context)
374 switch (context)
376 case CONTEXT_STD:
377 return button_context_standard;
379 case CONTEXT_WPS:
380 return button_context_wps;
382 case CONTEXT_LIST:
383 return button_context_list;
384 case CONTEXT_TREE:
385 case CONTEXT_MAINMENU:
386 return button_context_listtree_scroll_with_combo;
387 case CONTEXT_CUSTOM|CONTEXT_TREE:
388 return button_context_tree;
390 case CONTEXT_SETTINGS:
391 case CONTEXT_SETTINGS_TIME:
392 return button_context_settings;
393 case CONTEXT_CUSTOM|CONTEXT_SETTINGS:
394 case CONTEXT_SETTINGS_COLOURCHOOSER:
395 case CONTEXT_SETTINGS_EQ:
396 case CONTEXT_SETTINGS_RECTRIGGER:
397 return button_context_settings_right_is_inc;
399 case CONTEXT_YESNOSCREEN:
400 return button_context_yesno;
401 #if CONFIG_TUNER
402 case CONTEXT_FM:
403 return button_context_radio;
404 #endif
405 case CONTEXT_BOOKMARKSCREEN:
406 return button_context_bmark;
407 case CONTEXT_QUICKSCREEN:
408 return button_context_quickscreen;
409 case CONTEXT_PITCHSCREEN:
410 return button_context_pitchscreen;
411 #ifdef HAVE_RECORDING
412 case CONTEXT_RECSCREEN:
413 return button_context_recscreen;
414 #endif
415 case CONTEXT_KEYBOARD:
416 return button_context_keyboard;
417 #ifdef USB_ENABLE_HID
418 case CONTEXT_USB_HID:
419 return button_context_usb_hid;
420 case CONTEXT_USB_HID_MODE_MULTIMEDIA:
421 return button_context_usb_hid_mode_multimedia;
422 case CONTEXT_USB_HID_MODE_PRESENTATION:
423 return button_context_usb_hid_mode_presentation;
424 case CONTEXT_USB_HID_MODE_BROWSER:
425 return button_context_usb_hid_mode_browser;
426 #ifdef HAVE_USB_HID_MOUSE
427 case CONTEXT_USB_HID_MODE_MOUSE:
428 return button_context_usb_hid_mode_mouse;
429 #endif
430 #endif
431 default:
432 return button_context_standard;
434 return button_context_standard;