as3525*: initialize cpu_frequency correctly
[kugel-rb.git] / apps / keymaps / keymap-ipod.c
blobb2697d86609cb389a30065d817bb36521bc978e3
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2006 Jonathan Gordon
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 /* Button Code Definitions for ipod target */
24 #include "config.h"
25 #include "action.h"
26 #include "button.h"
27 #include "settings.h"
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
36 /* CONTEXT_CUSTOM's used in this file...
38 CONTEXT_CUSTOM|CONTEXT_TREE = the standard list/tree defines (without directions)
43 static const struct button_mapping button_context_standard[] = {
44 { ACTION_STD_PREV, BUTTON_SCROLL_BACK, BUTTON_NONE },
45 { ACTION_STD_PREVREPEAT, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE },
46 { ACTION_STD_NEXT, BUTTON_SCROLL_FWD, BUTTON_NONE },
47 { ACTION_STD_NEXTREPEAT, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE },
48 { ACTION_STD_CANCEL, BUTTON_LEFT, BUTTON_NONE },
49 { ACTION_STD_OK, BUTTON_RIGHT, BUTTON_NONE },
50 { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
51 { ACTION_STD_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
52 { ACTION_STD_QUICKSCREEN, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
53 { ACTION_STD_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
54 { ACTION_STD_CANCEL, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE },
56 LAST_ITEM_IN_LIST
57 }; /* button_context_standard */
59 static const struct button_mapping button_context_tree[] = {
60 { ACTION_TREE_WPS, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
61 { ACTION_TREE_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
62 { ACTION_TREE_HOTKEY, BUTTON_SELECT|BUTTON_PLAY, BUTTON_NONE },
64 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
65 }; /* button_context_tree */
67 static const struct button_mapping button_context_tree_scroll_lr[] = {
68 { ACTION_NONE, BUTTON_LEFT, BUTTON_NONE },
69 { ACTION_STD_CANCEL, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
70 { ACTION_TREE_ROOT_INIT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
71 { ACTION_TREE_PGLEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
72 { ACTION_TREE_PGLEFT, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT },
73 { ACTION_NONE, BUTTON_RIGHT, BUTTON_NONE },
74 { ACTION_STD_OK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
75 { ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
76 { ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT },
77 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
78 }; /* button_context_tree_scroll_lr */
80 static const struct button_mapping button_context_wps[] = {
81 { ACTION_WPS_PLAY, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
82 { ACTION_WPS_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
83 { ACTION_WPS_SKIPPREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
84 { ACTION_WPS_SEEKBACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
85 { ACTION_WPS_STOPSEEK, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT },
86 { ACTION_WPS_SKIPNEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
87 { ACTION_WPS_SEEKFWD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
88 { ACTION_WPS_STOPSEEK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT },
89 { ACTION_WPS_VOLDOWN, BUTTON_SCROLL_BACK, BUTTON_NONE },
90 { ACTION_WPS_VOLDOWN, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE },
91 { ACTION_WPS_VOLUP, BUTTON_SCROLL_FWD, BUTTON_NONE },
92 { ACTION_WPS_VOLUP, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE },
93 { ACTION_WPS_BROWSE, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
94 { ACTION_WPS_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
95 { ACTION_WPS_HOTKEY, BUTTON_SELECT|BUTTON_PLAY, BUTTON_NONE },
96 { ACTION_WPS_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
97 { ACTION_WPS_QUICKSCREEN, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
99 LAST_ITEM_IN_LIST,
100 }; /* button_context_wps */
102 static const struct button_mapping button_context_settings[] = {
103 { ACTION_SETTINGS_INC, BUTTON_SCROLL_FWD, BUTTON_NONE },
104 { ACTION_SETTINGS_INCREPEAT, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE },
105 { ACTION_SETTINGS_DEC, BUTTON_SCROLL_BACK, BUTTON_NONE },
106 { ACTION_SETTINGS_DECREPEAT, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE },
107 { ACTION_STD_PREV, BUTTON_LEFT, BUTTON_NONE },
108 { ACTION_STD_PREVREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
109 { ACTION_STD_NEXT, BUTTON_RIGHT, BUTTON_NONE },
110 { ACTION_STD_NEXTREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
111 { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_NONE },
112 { ACTION_STD_CANCEL, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
114 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
115 }; /* button_context_settings */
117 static const struct button_mapping button_context_yesno[] = {
118 { ACTION_YESNO_ACCEPT, BUTTON_SELECT, BUTTON_NONE },
119 LAST_ITEM_IN_LIST
120 }; /* button_context_yesno */
122 static const struct button_mapping button_context_bmark[] = {
123 { ACTION_BMS_DELETE, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
124 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
125 }; /* button_context_bmark */
127 static const struct button_mapping button_context_quickscreen[] = {
128 { ACTION_QS_TOP, BUTTON_MENU, BUTTON_NONE },
129 { ACTION_QS_TOP, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE },
130 { ACTION_QS_DOWN, BUTTON_PLAY, BUTTON_NONE },
131 { ACTION_QS_DOWN, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE },
132 { ACTION_QS_LEFT, BUTTON_LEFT, BUTTON_NONE },
133 { ACTION_QS_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
134 { ACTION_QS_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
135 { ACTION_QS_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
136 { ACTION_STD_CANCEL, BUTTON_SELECT, BUTTON_NONE },
138 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
139 }; /* button_context_quickscreen */
141 static const struct button_mapping button_context_pitchscreen[] = {
142 { ACTION_PS_INC_SMALL, BUTTON_SCROLL_FWD, BUTTON_NONE },
143 { ACTION_PS_INC_BIG, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE },
144 { ACTION_PS_DEC_SMALL, BUTTON_SCROLL_BACK, BUTTON_NONE },
145 { ACTION_PS_DEC_BIG, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE },
146 { ACTION_PS_NUDGE_LEFT, BUTTON_LEFT, BUTTON_NONE },
147 { ACTION_PS_NUDGE_LEFTOFF, BUTTON_LEFT|BUTTON_REL, BUTTON_NONE },
148 { ACTION_PS_NUDGE_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
149 { ACTION_PS_NUDGE_RIGHTOFF, BUTTON_RIGHT|BUTTON_REL, BUTTON_NONE },
150 { ACTION_PS_TOGGLE_MODE, BUTTON_PLAY, BUTTON_NONE },
151 { ACTION_PS_RESET, BUTTON_MENU, BUTTON_NONE },
152 { ACTION_PS_EXIT, BUTTON_SELECT, BUTTON_NONE },
153 { ACTION_PS_SLOWER, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
154 { ACTION_PS_FASTER, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
156 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
157 }; /* button_context_pitchscreen */
159 static const struct button_mapping button_context_keyboard[] = {
160 { ACTION_KBD_LEFT, BUTTON_LEFT, BUTTON_NONE },
161 { ACTION_KBD_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
162 { ACTION_KBD_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
163 { ACTION_KBD_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
164 { ACTION_KBD_SELECT, BUTTON_SELECT, BUTTON_NONE },
165 { ACTION_KBD_DONE, BUTTON_PLAY, BUTTON_NONE },
166 { ACTION_KBD_ABORT, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
167 { ACTION_KBD_UP, BUTTON_SCROLL_BACK, BUTTON_NONE },
168 { ACTION_KBD_UP, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE },
169 { ACTION_KBD_DOWN, BUTTON_SCROLL_FWD, BUTTON_NONE },
170 { ACTION_KBD_DOWN, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE },
171 { ACTION_KBD_MORSE_INPUT, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
172 { ACTION_KBD_MORSE_SELECT, BUTTON_SELECT|BUTTON_REL, BUTTON_NONE },
173 LAST_ITEM_IN_LIST
174 }; /* button_context_keyboard */
176 #ifdef HAVE_RECORDING
177 const struct button_mapping button_context_recscreen[] = {
179 { ACTION_REC_NEWFILE, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
180 { ACTION_STD_MENU, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
181 { ACTION_REC_PAUSE, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
182 { ACTION_STD_CANCEL, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE },
183 { ACTION_STD_CANCEL, BUTTON_MENU, BUTTON_NONE },
184 { ACTION_STD_NEXT, BUTTON_SCROLL_FWD, BUTTON_NONE },
185 { ACTION_STD_NEXT, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE },
186 { ACTION_STD_PREV, BUTTON_SCROLL_BACK, BUTTON_NONE },
187 { ACTION_STD_PREV, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE },
188 { ACTION_SETTINGS_INC, BUTTON_RIGHT, BUTTON_NONE },
189 { ACTION_SETTINGS_INCREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
190 { ACTION_SETTINGS_DEC, BUTTON_LEFT, BUTTON_NONE },
191 { ACTION_SETTINGS_DECREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
193 LAST_ITEM_IN_LIST
194 }; /* button_context_recscreen */
195 #endif
197 /** FM Radio Screen **/
198 #if CONFIG_TUNER
199 static const struct button_mapping button_context_radio[] = {
200 { ACTION_FM_MENU, BUTTON_SELECT | BUTTON_REPEAT, BUTTON_NONE },
201 { ACTION_FM_STOP, BUTTON_PLAY | BUTTON_REPEAT, BUTTON_PLAY },
202 { ACTION_FM_MODE, BUTTON_SELECT, BUTTON_NONE },
203 { ACTION_FM_EXIT, BUTTON_MENU | BUTTON_REL, BUTTON_MENU },
204 { ACTION_FM_PLAY, BUTTON_PLAY | BUTTON_REL, BUTTON_PLAY },
205 { ACTION_SETTINGS_INC, BUTTON_SCROLL_FWD, BUTTON_NONE },
206 { ACTION_SETTINGS_INCREPEAT,BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE },
207 { ACTION_SETTINGS_DEC, BUTTON_SCROLL_BACK, BUTTON_NONE },
208 { ACTION_SETTINGS_DECREPEAT,BUTTON_SCROLL_BACK|BUTTON_REPEAT,BUTTON_NONE },
209 { ACTION_STD_NEXT, BUTTON_RIGHT, BUTTON_NONE },
210 { ACTION_STD_NEXTREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
211 { ACTION_STD_PREV, BUTTON_LEFT, BUTTON_NONE },
212 { ACTION_STD_PREVREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
213 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
214 }; /* button_context_radio */
215 #endif
217 #ifdef USB_ENABLE_HID
218 static const struct button_mapping button_context_usb_hid[] = {
219 { ACTION_USB_HID_MODE_SWITCH_NEXT, BUTTON_SELECT|BUTTON_RIGHT|BUTTON_REL, BUTTON_SELECT|BUTTON_RIGHT },
220 { ACTION_USB_HID_MODE_SWITCH_NEXT, BUTTON_SELECT|BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_SELECT|BUTTON_RIGHT },
221 { ACTION_USB_HID_MODE_SWITCH_PREV, BUTTON_SELECT|BUTTON_LEFT|BUTTON_REL, BUTTON_SELECT|BUTTON_LEFT },
222 { ACTION_USB_HID_MODE_SWITCH_PREV, BUTTON_SELECT|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_SELECT|BUTTON_LEFT },
224 LAST_ITEM_IN_LIST
225 }; /* button_context_usb_hid */
227 static const struct button_mapping button_context_usb_hid_mode_multimedia[] = {
228 { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_SCROLL_BACK, BUTTON_NONE },
229 { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE },
230 { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_SCROLL_FWD, BUTTON_NONE },
231 { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE },
232 { ACTION_USB_HID_MULTIMEDIA_VOLUME_MUTE, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
233 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_PLAY_PAUSE, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
234 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_STOP, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
235 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
236 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_TRACK_PREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
237 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_TRACK_NEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
239 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
240 }; /* button_context_usb_hid_mode_multimedia */
242 static const struct button_mapping button_context_usb_hid_mode_presentation[] = {
243 { ACTION_USB_HID_PRESENTATION_SLIDESHOW_START, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
244 { ACTION_USB_HID_PRESENTATION_SLIDESHOW_LEAVE, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
245 { ACTION_USB_HID_PRESENTATION_SLIDE_PREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
246 { ACTION_USB_HID_PRESENTATION_SLIDE_NEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
247 { ACTION_USB_HID_PRESENTATION_SLIDE_FIRST, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
248 { ACTION_USB_HID_PRESENTATION_SLIDE_LAST, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
249 { ACTION_USB_HID_PRESENTATION_SCREEN_BLACK, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
250 { ACTION_USB_HID_PRESENTATION_SCREEN_WHITE, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
251 { ACTION_USB_HID_PRESENTATION_LINK_PREV, BUTTON_SCROLL_BACK, BUTTON_NONE },
252 { ACTION_USB_HID_PRESENTATION_LINK_PREV, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE },
253 { ACTION_USB_HID_PRESENTATION_LINK_NEXT, BUTTON_SCROLL_FWD, BUTTON_NONE },
254 { ACTION_USB_HID_PRESENTATION_LINK_NEXT, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE },
255 { ACTION_USB_HID_PRESENTATION_MOUSE_CLICK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
256 { ACTION_USB_HID_PRESENTATION_MOUSE_OVER, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
258 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
259 }; /* button_context_usb_hid_mode_presentation */
261 static const struct button_mapping button_context_usb_hid_mode_browser[] = {
262 { ACTION_USB_HID_BROWSER_SCROLL_UP, BUTTON_SCROLL_BACK, BUTTON_NONE },
263 { ACTION_USB_HID_BROWSER_SCROLL_UP, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE },
264 { ACTION_USB_HID_BROWSER_SCROLL_DOWN, BUTTON_SCROLL_FWD, BUTTON_NONE },
265 { ACTION_USB_HID_BROWSER_SCROLL_DOWN, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE },
266 { ACTION_USB_HID_BROWSER_SCROLL_PAGE_UP, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
267 { ACTION_USB_HID_BROWSER_SCROLL_PAGE_DOWN, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
268 { ACTION_USB_HID_BROWSER_ZOOM_IN, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
269 { ACTION_USB_HID_BROWSER_ZOOM_OUT, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
270 { ACTION_USB_HID_BROWSER_ZOOM_RESET, BUTTON_PLAY|BUTTON_MENU|BUTTON_REPEAT, BUTTON_PLAY|BUTTON_MENU },
271 { ACTION_USB_HID_BROWSER_TAB_PREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
272 { ACTION_USB_HID_BROWSER_TAB_NEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
273 { ACTION_USB_HID_BROWSER_TAB_CLOSE, BUTTON_SELECT|BUTTON_MENU|BUTTON_REPEAT, BUTTON_SELECT|BUTTON_MENU },
274 { ACTION_USB_HID_BROWSER_HISTORY_BACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
275 { ACTION_USB_HID_BROWSER_HISTORY_FORWARD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
276 { ACTION_USB_HID_BROWSER_VIEW_FULL_SCREEN, BUTTON_SELECT|BUTTON_PLAY|BUTTON_REPEAT, BUTTON_SELECT|BUTTON_PLAY },
278 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
279 }; /* button_context_usb_hid_mode_browser */
281 #ifdef HAVE_USB_HID_MOUSE
282 static const struct button_mapping button_context_usb_hid_mode_mouse[] = {
283 { ACTION_USB_HID_MOUSE_UP, BUTTON_MENU, BUTTON_NONE },
284 { ACTION_USB_HID_MOUSE_UP_REP, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE },
285 { ACTION_USB_HID_MOUSE_DOWN, BUTTON_PLAY, BUTTON_NONE },
286 { ACTION_USB_HID_MOUSE_DOWN_REP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE },
287 { ACTION_USB_HID_MOUSE_LEFT, BUTTON_LEFT, BUTTON_NONE },
288 { ACTION_USB_HID_MOUSE_LEFT_REP, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
289 { ACTION_USB_HID_MOUSE_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
290 { ACTION_USB_HID_MOUSE_RIGHT_REP, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
291 { ACTION_USB_HID_MOUSE_BUTTON_LEFT, BUTTON_SELECT, BUTTON_NONE },
292 { ACTION_USB_HID_MOUSE_BUTTON_LEFT_REL, BUTTON_SELECT|BUTTON_REL, BUTTON_NONE },
293 { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_UP, BUTTON_SCROLL_BACK, BUTTON_NONE },
294 { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_UP, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE },
295 { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_DOWN, BUTTON_SCROLL_FWD, BUTTON_NONE },
296 { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_DOWN, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE },
298 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
299 }; /* button_context_usb_hid_mode_mouse */
300 #endif
301 #endif
303 #if BUTTON_REMOTE != 0
304 /*****************************************************************************
305 * Remote control mappings
306 *****************************************************************************/
308 static const struct button_mapping remote_button_context_standard[] = {
309 { ACTION_STD_PREV, BUTTON_RC_LEFT, BUTTON_NONE },
310 { ACTION_STD_NEXT, BUTTON_RC_RIGHT, BUTTON_NONE },
311 { ACTION_STD_CANCEL, BUTTON_RC_STOP, BUTTON_NONE },
312 { ACTION_STD_OK, BUTTON_RC_PLAY, BUTTON_NONE },
314 LAST_ITEM_IN_LIST
315 }; /* remote_button_context_standard */
317 static const struct button_mapping remote_button_context_wps[] = {
318 { ACTION_WPS_VOLDOWN, BUTTON_RC_VOL_DOWN, BUTTON_NONE },
319 { ACTION_WPS_VOLDOWN, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
320 { ACTION_WPS_VOLUP, BUTTON_RC_VOL_UP, BUTTON_NONE },
321 { ACTION_WPS_VOLUP, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
323 { ACTION_WPS_PLAY, BUTTON_RC_PLAY|BUTTON_REL, BUTTON_RC_PLAY },
324 { ACTION_WPS_STOP, BUTTON_RC_PLAY|BUTTON_REPEAT, BUTTON_NONE },
325 { ACTION_WPS_SKIPNEXT, BUTTON_RC_RIGHT|BUTTON_REL, BUTTON_RC_RIGHT },
326 { ACTION_WPS_SEEKFWD, BUTTON_RC_RIGHT|BUTTON_REPEAT,BUTTON_NONE },
327 { ACTION_WPS_STOPSEEK, BUTTON_RC_RIGHT|BUTTON_REL, BUTTON_RC_RIGHT|BUTTON_REPEAT },
328 { ACTION_WPS_SKIPPREV, BUTTON_RC_LEFT|BUTTON_REL, BUTTON_RC_LEFT },
329 { ACTION_WPS_SEEKBACK, BUTTON_RC_LEFT|BUTTON_REPEAT, BUTTON_NONE },
330 { ACTION_WPS_STOPSEEK, BUTTON_RC_LEFT|BUTTON_REL, BUTTON_RC_LEFT|BUTTON_REPEAT },
332 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
333 }; /* remote_button_context_wps */
335 static const struct button_mapping remote_button_context_tree[] = {
336 { ACTION_TREE_WPS, BUTTON_RC_PLAY|BUTTON_REL, BUTTON_RC_PLAY },
337 { ACTION_TREE_STOP, BUTTON_RC_PLAY|BUTTON_REPEAT, BUTTON_RC_PLAY },
339 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
340 }; /* remote_button_context_tree */
342 #if CONFIG_TUNER
343 static const struct button_mapping remote_button_context_radio[] = {
344 { ACTION_FM_STOP, BUTTON_RC_PLAY | BUTTON_REPEAT, BUTTON_NONE },
345 { ACTION_FM_PLAY, BUTTON_RC_PLAY | BUTTON_REL, BUTTON_RC_PLAY },
346 { ACTION_STD_NEXT, BUTTON_RC_RIGHT|BUTTON_REL, BUTTON_RC_RIGHT },
347 { ACTION_STD_NEXTREPEAT, BUTTON_RC_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
348 { ACTION_STD_PREV, BUTTON_RC_LEFT|BUTTON_REL, BUTTON_RC_LEFT },
349 { ACTION_STD_PREVREPEAT, BUTTON_RC_LEFT|BUTTON_REPEAT, BUTTON_NONE },
351 LAST_ITEM_IN_LIST
352 }; /* remote_button_context_radio */
353 #endif
355 static const struct button_mapping* get_context_mapping_remote( int context )
357 context ^= CONTEXT_REMOTE;
359 switch (context)
361 case CONTEXT_WPS:
362 return remote_button_context_wps;
363 case CONTEXT_TREE:
364 case CONTEXT_CUSTOM|CONTEXT_TREE:
365 return remote_button_context_tree;
367 #ifdef CONFIG_TUNER
368 case CONTEXT_FM:
369 return remote_button_context_radio;
370 #endif
371 default:
372 return remote_button_context_standard;
375 #endif /* BUTTON_REMOTE != 0 */
377 /* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */
378 const struct button_mapping* get_context_mapping(int context)
380 #if BUTTON_REMOTE != 0
381 if (context&CONTEXT_REMOTE)
382 return get_context_mapping_remote(context);
383 #endif
385 switch (context)
387 case CONTEXT_STD:
388 return button_context_standard;
389 case CONTEXT_WPS:
390 return button_context_wps;
392 case CONTEXT_TREE:
393 case CONTEXT_MAINMENU:
394 if (global_settings.hold_lr_for_scroll_in_list)
395 return button_context_tree_scroll_lr;
396 /* else fall through to CUSTOM|CONTEXT_TREE */
397 case CONTEXT_CUSTOM|CONTEXT_TREE:
398 return button_context_tree;
400 case CONTEXT_LIST:
401 return button_context_standard;
403 case CONTEXT_SETTINGS_EQ:
404 case CONTEXT_SETTINGS_COLOURCHOOSER:
405 case CONTEXT_SETTINGS_TIME:
406 case CONTEXT_SETTINGS:
407 case CONTEXT_SETTINGS_RECTRIGGER:
408 return button_context_settings;
409 case CONTEXT_YESNOSCREEN:
410 return button_context_yesno;
411 case CONTEXT_BOOKMARKSCREEN:
412 return button_context_bmark;
413 case CONTEXT_QUICKSCREEN:
414 return button_context_quickscreen;
415 case CONTEXT_PITCHSCREEN:
416 return button_context_pitchscreen;
417 case CONTEXT_KEYBOARD:
418 case CONTEXT_MORSE_INPUT:
419 return button_context_keyboard;
420 #ifdef HAVE_RECORDING
421 case CONTEXT_RECSCREEN:
422 return button_context_recscreen;
423 #endif
424 #if CONFIG_TUNER
425 case CONTEXT_FM:
426 return button_context_radio;
427 #endif
428 #ifdef USB_ENABLE_HID
429 case CONTEXT_USB_HID:
430 return button_context_usb_hid;
431 case CONTEXT_USB_HID_MODE_MULTIMEDIA:
432 return button_context_usb_hid_mode_multimedia;
433 case CONTEXT_USB_HID_MODE_PRESENTATION:
434 return button_context_usb_hid_mode_presentation;
435 case CONTEXT_USB_HID_MODE_BROWSER:
436 return button_context_usb_hid_mode_browser;
437 #ifdef HAVE_USB_HID_MOUSE
438 case CONTEXT_USB_HID_MODE_MOUSE:
439 return button_context_usb_hid_mode_mouse;
440 #endif
441 #endif
442 default:
443 return button_context_standard;
445 return button_context_standard;