sd-as3525v2: working transfers, still awfully slow
[kugel-rb.git] / apps / keymaps / keymap-h10.c
blob8597e24023ae174ae228cbf05a3f0ed1b1d5291d
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) Barry Wardell 2006
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 iriver H10 target */
24 #include "config.h"
25 #include "action.h"
26 #include "button.h"
27 #include "settings.h"
29 /* {Action Code, Button code, Prereq button code } */
31 /*
32 * The format of the list is as follows
33 * { Action Code, Button code, Prereq button code }
34 * if there's no need to check the previous button's value, use BUTTON_NONE
35 * Insert LAST_ITEM_IN_LIST at the end of each mapping
37 static const struct button_mapping button_context_standard[] = {
38 { ACTION_STD_PREV, BUTTON_SCROLL_UP, BUTTON_NONE },
39 { ACTION_STD_PREVREPEAT, BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE },
40 { ACTION_STD_NEXT, BUTTON_SCROLL_DOWN, BUTTON_NONE },
41 { ACTION_STD_NEXTREPEAT, BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
43 { ACTION_STD_MENU, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
44 { ACTION_STD_OK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
45 { ACTION_STD_CONTEXT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
46 { ACTION_STD_CANCEL, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
47 { ACTION_STD_QUICKSCREEN, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
49 /* TODO: this is a bit of a hack so that we can exit some debug screens
50 * (audio, tagcache, dircache, hwinfo, stack, ports). They don't like it
51 * when ACTION_STD_CANCEL has anything other than BUTTON_NONE for prereq.
53 { ACTION_STD_CANCEL, BUTTON_POWER|BUTTON_RIGHT, BUTTON_NONE },
55 LAST_ITEM_IN_LIST
56 }; /* button_context_standard */
58 static const struct button_mapping remote_button_context_standard[] = {
59 { ACTION_STD_PREV, BUTTON_RC_VOL_UP, BUTTON_NONE },
60 { ACTION_STD_PREVREPEAT, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
61 { ACTION_STD_NEXT, BUTTON_RC_VOL_DOWN, BUTTON_NONE },
62 { ACTION_STD_NEXTREPEAT, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
64 LAST_ITEM_IN_LIST
65 }; /* remote_button_context_standard */
67 static const struct button_mapping button_context_wps[] = {
68 { ACTION_WPS_PLAY, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
69 { ACTION_WPS_STOP, BUTTON_PLAY|BUTTON_REPEAT,BUTTON_PLAY },
70 { ACTION_WPS_SKIPPREV, BUTTON_REW|BUTTON_REL, BUTTON_REW},
71 { ACTION_WPS_SEEKBACK, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE },
72 { ACTION_WPS_STOPSEEK, BUTTON_REW|BUTTON_REL, BUTTON_REW|BUTTON_REPEAT },
73 { ACTION_WPS_SKIPNEXT, BUTTON_FF|BUTTON_REL, BUTTON_FF },
74 { ACTION_WPS_SEEKFWD, BUTTON_FF|BUTTON_REPEAT, BUTTON_NONE },
75 { ACTION_WPS_STOPSEEK, BUTTON_FF|BUTTON_REL, BUTTON_FF|BUTTON_REPEAT },
77 { ACTION_WPS_ABSETB_NEXTDIR, BUTTON_POWER|BUTTON_FF, BUTTON_POWER },
78 { ACTION_WPS_ABSETA_PREVDIR, BUTTON_POWER|BUTTON_REW, BUTTON_POWER },
79 { ACTION_WPS_ABRESET, BUTTON_POWER|BUTTON_PLAY, BUTTON_POWER },
81 { ACTION_WPS_VOLDOWN, BUTTON_SCROLL_DOWN, BUTTON_NONE },
82 { ACTION_WPS_VOLDOWN, BUTTON_SCROLL_DOWN|BUTTON_REPEAT,BUTTON_NONE },
83 { ACTION_WPS_VOLUP, BUTTON_SCROLL_UP, BUTTON_NONE },
84 { ACTION_WPS_VOLUP, BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE },
86 { ACTION_WPS_BROWSE, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
87 { ACTION_WPS_CONTEXT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
88 { ACTION_WPS_QUICKSCREEN, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
89 { ACTION_WPS_MENU, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
90 { ACTION_WPS_VIEW_PLAYLIST, BUTTON_POWER|BUTTON_PLAY, BUTTON_NONE },
91 { ACTION_WPS_PITCHSCREEN, BUTTON_PLAY|BUTTON_LEFT, BUTTON_PLAY },
92 { ACTION_WPS_ID3SCREEN, BUTTON_PLAY|BUTTON_RIGHT, BUTTON_PLAY },
94 LAST_ITEM_IN_LIST
95 }; /* button_context_wps */
97 static const struct button_mapping remote_button_context_wps[] = {
98 { ACTION_WPS_PLAY, BUTTON_RC_PLAY|BUTTON_REL, BUTTON_RC_PLAY },
99 { ACTION_WPS_STOP, BUTTON_RC_PLAY|BUTTON_REPEAT,BUTTON_RC_PLAY },
100 { ACTION_WPS_SKIPPREV, BUTTON_RC_REW|BUTTON_REL, BUTTON_RC_REW},
101 { ACTION_WPS_SEEKBACK, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_NONE },
102 { ACTION_WPS_STOPSEEK, BUTTON_RC_REW|BUTTON_REL, BUTTON_RC_REW|BUTTON_REPEAT },
103 { ACTION_WPS_SKIPNEXT, BUTTON_RC_FF|BUTTON_REL, BUTTON_RC_FF },
104 { ACTION_WPS_SEEKFWD, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_NONE },
105 { ACTION_WPS_STOPSEEK, BUTTON_RC_FF|BUTTON_REL, BUTTON_RC_FF|BUTTON_REPEAT },
107 { ACTION_WPS_VOLDOWN, BUTTON_RC_VOL_DOWN, BUTTON_NONE },
108 { ACTION_WPS_VOLDOWN, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
109 { ACTION_WPS_VOLUP, BUTTON_RC_VOL_UP, BUTTON_NONE },
110 { ACTION_WPS_VOLUP, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
112 { ACTION_WPS_PITCHSCREEN, BUTTON_RC_PLAY|BUTTON_LEFT, BUTTON_RC_PLAY },
113 { ACTION_WPS_ID3SCREEN, BUTTON_RC_PLAY|BUTTON_RIGHT, BUTTON_RC_PLAY },
115 LAST_ITEM_IN_LIST
116 }; /* remote_button_context_wps */
118 static const struct button_mapping button_context_settings[] = {
119 { ACTION_SETTINGS_INC, BUTTON_SCROLL_UP, BUTTON_NONE },
120 { ACTION_SETTINGS_INCREPEAT,BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE },
121 { ACTION_SETTINGS_DEC, BUTTON_SCROLL_DOWN, BUTTON_NONE },
122 { ACTION_SETTINGS_DECREPEAT,BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
123 { ACTION_STD_PREV, BUTTON_FF, BUTTON_NONE },
124 { ACTION_STD_PREVREPEAT, BUTTON_FF|BUTTON_REPEAT, BUTTON_NONE },
125 { ACTION_STD_NEXT, BUTTON_REW, BUTTON_NONE },
126 { ACTION_STD_NEXTREPEAT, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE },
127 { ACTION_SETTINGS_RESET, BUTTON_PLAY, BUTTON_NONE },
129 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
130 }; /* button_context_settings */
132 static const struct button_mapping button_context_list[] = {
133 { ACTION_LISTTREE_PGUP, BUTTON_REW|BUTTON_REL, BUTTON_REW },
134 { ACTION_LISTTREE_PGDOWN, BUTTON_FF|BUTTON_REL, BUTTON_FF },
136 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
137 }; /* button_context_list */
139 static const struct button_mapping remote_button_context_list[] = {
140 { ACTION_LISTTREE_PGUP, BUTTON_RC_REW|BUTTON_REL, BUTTON_RC_REW },
141 { ACTION_LISTTREE_PGDOWN, BUTTON_RC_FF|BUTTON_REL, BUTTON_RC_FF },
143 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
144 }; /* button_context_list */
146 static const struct button_mapping button_context_tree[] = {
147 { ACTION_TREE_WPS, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
148 { ACTION_TREE_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
150 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
151 }; /* button_context_tree */
153 static const struct button_mapping remote_button_context_tree[] = {
154 { ACTION_TREE_WPS, BUTTON_RC_PLAY|BUTTON_REL, BUTTON_RC_PLAY },
155 { ACTION_TREE_STOP, BUTTON_RC_PLAY|BUTTON_REPEAT, BUTTON_RC_PLAY },
157 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
158 }; /* button_context_tree */
160 static const struct button_mapping button_context_listtree_scroll_without_combo[] = {
161 { ACTION_TREE_ROOT_INIT, BUTTON_REW|BUTTON_REPEAT, BUTTON_REW },
162 { ACTION_TREE_PGLEFT, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE },
163 { ACTION_TREE_PGRIGHT, BUTTON_FF|BUTTON_REPEAT, BUTTON_NONE },
164 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
165 }; /* button_context_listtree_scroll_without_combo */
167 static const struct button_mapping remote_button_context_listtree_scroll_without_combo[] = {
168 { ACTION_TREE_ROOT_INIT, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_RC_REW },
169 { ACTION_TREE_PGLEFT, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_NONE },
170 { ACTION_TREE_PGRIGHT, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_NONE },
171 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
172 }; /* button_context_listtree_scroll_without_combo */
174 static const struct button_mapping button_context_listtree_scroll_with_combo[] = {
175 { ACTION_LISTTREE_PGUP, BUTTON_REW|BUTTON_REPEAT, BUTTON_REW },
176 { ACTION_LISTTREE_PGDOWN, BUTTON_FF|BUTTON_REPEAT, BUTTON_FF },
177 { ACTION_TREE_PGLEFT, BUTTON_REW|BUTTON_PLAY, BUTTON_PLAY },
178 { ACTION_TREE_PGLEFT, BUTTON_REW|BUTTON_REL, BUTTON_REW|BUTTON_PLAY },
179 { ACTION_TREE_PGLEFT, BUTTON_REW|BUTTON_PLAY, BUTTON_REW|BUTTON_REL },
180 { ACTION_TREE_ROOT_INIT, BUTTON_REW|BUTTON_PLAY|BUTTON_REPEAT, BUTTON_REW|BUTTON_PLAY },
181 { ACTION_TREE_PGLEFT, BUTTON_REW|BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE },
182 { ACTION_TREE_PGRIGHT, BUTTON_FF|BUTTON_PLAY, BUTTON_PLAY },
183 { ACTION_TREE_PGRIGHT, BUTTON_FF|BUTTON_REL, BUTTON_FF|BUTTON_PLAY },
184 { ACTION_TREE_PGRIGHT, BUTTON_FF|BUTTON_PLAY, BUTTON_FF|BUTTON_REL },
185 { ACTION_TREE_PGRIGHT, BUTTON_FF|BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE },
186 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
187 }; /* button_context_listtree_scroll_with_combo */
189 static const struct button_mapping remote_button_context_listtree_scroll_with_combo[] = {
190 { ACTION_LISTTREE_PGUP, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_RC_REW },
191 { ACTION_LISTTREE_PGDOWN, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_RC_FF },
192 { ACTION_TREE_PGLEFT, BUTTON_RC_REW|BUTTON_RC_PLAY, BUTTON_RC_PLAY },
193 { ACTION_TREE_PGLEFT, BUTTON_RC_REW|BUTTON_REL, BUTTON_RC_REW|BUTTON_RC_PLAY },
194 { ACTION_TREE_PGLEFT, BUTTON_RC_REW|BUTTON_RC_PLAY, BUTTON_RC_REW|BUTTON_REL },
195 { ACTION_TREE_ROOT_INIT, BUTTON_RC_REW|BUTTON_RC_PLAY|BUTTON_REPEAT, BUTTON_RC_REW|BUTTON_RC_PLAY },
196 { ACTION_TREE_PGLEFT, BUTTON_RC_REW|BUTTON_RC_PLAY|BUTTON_REPEAT, BUTTON_NONE },
197 { ACTION_TREE_PGRIGHT, BUTTON_RC_FF|BUTTON_RC_PLAY, BUTTON_RC_PLAY },
198 { ACTION_TREE_PGRIGHT, BUTTON_RC_FF|BUTTON_REL, BUTTON_RC_FF|BUTTON_RC_PLAY },
199 { ACTION_TREE_PGRIGHT, BUTTON_RC_FF|BUTTON_RC_PLAY, BUTTON_RC_FF|BUTTON_REL },
200 { ACTION_TREE_PGRIGHT, BUTTON_RC_FF|BUTTON_RC_PLAY|BUTTON_REPEAT, BUTTON_NONE },
201 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
202 }; /* button_context_listtree_scroll_with_combo */
204 static const struct button_mapping button_context_yesno[] = {
205 { ACTION_YESNO_ACCEPT, BUTTON_RIGHT, BUTTON_NONE },
206 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
207 }; /* button_context_settings_yesno */
209 static const struct button_mapping button_context_quickscreen[] = {
210 { ACTION_QS_TOP, BUTTON_SCROLL_UP, BUTTON_NONE },
211 { ACTION_QS_TOP, BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE },
212 { ACTION_QS_DOWN, BUTTON_SCROLL_DOWN, BUTTON_NONE },
213 { ACTION_QS_DOWN, BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
214 { ACTION_QS_LEFT, BUTTON_REW, BUTTON_NONE },
215 { ACTION_QS_LEFT, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE },
216 { ACTION_QS_RIGHT, BUTTON_FF, BUTTON_NONE },
217 { ACTION_QS_RIGHT, BUTTON_FF|BUTTON_REPEAT, BUTTON_NONE },
219 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
220 }; /* button_context_quickscreen */
222 static const struct button_mapping remote_button_context_quickscreen[] = {
223 { ACTION_QS_TOP, BUTTON_RC_VOL_UP, BUTTON_NONE },
224 { ACTION_QS_TOP, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
225 { ACTION_QS_DOWN, BUTTON_RC_VOL_DOWN, BUTTON_NONE },
226 { ACTION_QS_DOWN, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
227 { ACTION_QS_LEFT, BUTTON_RC_REW, BUTTON_NONE },
228 { ACTION_QS_LEFT, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_NONE },
229 { ACTION_QS_RIGHT, BUTTON_RC_FF, BUTTON_NONE },
230 { ACTION_QS_RIGHT, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_NONE },
232 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
233 }; /* button_context_quickscreen */
235 static const struct button_mapping button_context_settings_right_is_inc[] = {
236 { ACTION_SETTINGS_INC, BUTTON_SCROLL_UP, BUTTON_NONE },
237 { ACTION_SETTINGS_INCREPEAT, BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE },
238 { ACTION_SETTINGS_DEC, BUTTON_SCROLL_DOWN, BUTTON_NONE },
239 { ACTION_SETTINGS_DECREPEAT, BUTTON_SCROLL_DOWN|BUTTON_REPEAT,BUTTON_NONE },
240 { ACTION_STD_PREV, BUTTON_REW, BUTTON_NONE },
241 { ACTION_STD_PREVREPEAT, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE },
242 { ACTION_STD_NEXT, BUTTON_FF, BUTTON_NONE },
243 { ACTION_STD_NEXTREPEAT, BUTTON_FF|BUTTON_REPEAT, BUTTON_NONE },
244 { ACTION_NONE, BUTTON_RIGHT, BUTTON_NONE },
245 { ACTION_STD_OK, BUTTON_RIGHT, BUTTON_NONE },
246 { ACTION_NONE, BUTTON_LEFT, BUTTON_NONE },
247 { ACTION_STD_CANCEL, BUTTON_LEFT, BUTTON_NONE },
249 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
250 }; /* button_context_settings_right_is_inc */
252 static const struct button_mapping button_context_pitchscreen[] = {
253 { ACTION_PS_INC_SMALL, BUTTON_SCROLL_UP, BUTTON_NONE },
254 { ACTION_PS_INC_BIG, BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE },
255 { ACTION_PS_DEC_SMALL, BUTTON_SCROLL_DOWN, BUTTON_NONE },
256 { ACTION_PS_DEC_BIG, BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
257 { ACTION_PS_NUDGE_LEFT, BUTTON_REW, BUTTON_NONE },
258 { ACTION_PS_NUDGE_LEFTOFF, BUTTON_REW|BUTTON_REL, BUTTON_NONE },
259 { ACTION_PS_NUDGE_RIGHT, BUTTON_FF, BUTTON_NONE },
260 { ACTION_PS_NUDGE_RIGHTOFF, BUTTON_FF|BUTTON_REL, BUTTON_NONE },
261 { ACTION_PS_TOGGLE_MODE, BUTTON_POWER, BUTTON_NONE },
262 { ACTION_PS_RESET, BUTTON_PLAY, BUTTON_NONE },
263 { ACTION_PS_EXIT, BUTTON_LEFT, BUTTON_NONE },
264 { ACTION_PS_SLOWER, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE },
265 { ACTION_PS_FASTER, BUTTON_FF|BUTTON_REPEAT, BUTTON_NONE },
267 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
268 }; /* button_context_pitchscreen */
270 static const struct button_mapping remote_button_context_pitchscreen[] = {
271 { ACTION_PS_INC_SMALL, BUTTON_RC_VOL_UP, BUTTON_NONE },
272 { ACTION_PS_INC_BIG, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
273 { ACTION_PS_DEC_SMALL, BUTTON_RC_VOL_DOWN, BUTTON_NONE },
274 { ACTION_PS_DEC_BIG, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
275 { ACTION_PS_NUDGE_LEFT, BUTTON_RC_REW, BUTTON_NONE },
276 { ACTION_PS_NUDGE_LEFTOFF, BUTTON_RC_REW|BUTTON_REL, BUTTON_NONE },
277 { ACTION_PS_NUDGE_RIGHT, BUTTON_RC_FF, BUTTON_NONE },
278 { ACTION_PS_NUDGE_RIGHTOFF, BUTTON_RC_FF|BUTTON_REL, BUTTON_NONE },
279 { ACTION_PS_RESET, BUTTON_RC_PLAY, BUTTON_NONE },
280 { ACTION_PS_SLOWER, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_NONE },
281 { ACTION_PS_FASTER, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_NONE },
283 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
284 }; /* button_context_pitchscreen */
286 static const struct button_mapping button_context_keyboard[] = {
287 { ACTION_KBD_LEFT, BUTTON_LEFT, BUTTON_NONE },
288 { ACTION_KBD_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
289 { ACTION_KBD_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
290 { ACTION_KBD_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
291 { ACTION_KBD_SELECT, BUTTON_REW, BUTTON_NONE },
292 { ACTION_KBD_DONE, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
293 { ACTION_KBD_ABORT, BUTTON_POWER, BUTTON_NONE },
294 { ACTION_KBD_UP, BUTTON_SCROLL_UP, BUTTON_NONE },
295 { ACTION_KBD_UP, BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE },
296 { ACTION_KBD_DOWN, BUTTON_SCROLL_DOWN, BUTTON_NONE },
297 { ACTION_KBD_DOWN, BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
298 { ACTION_KBD_MORSE_INPUT, BUTTON_REW|BUTTON_PLAY, BUTTON_NONE },
299 { ACTION_KBD_MORSE_SELECT, BUTTON_REW|BUTTON_REL, BUTTON_NONE },
301 LAST_ITEM_IN_LIST
302 }; /* button_context_keyboard */
304 static const struct button_mapping button_context_bmark[] = {
305 { ACTION_BMS_DELETE, BUTTON_REW, BUTTON_NONE },
306 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
307 }; /* button_context_bmark */
309 const struct button_mapping button_context_recscreen[] = {
310 { ACTION_REC_PAUSE, BUTTON_PLAY, BUTTON_NONE },
311 { ACTION_REC_NEWFILE, BUTTON_RIGHT, BUTTON_NONE },
312 { ACTION_STD_PREV, BUTTON_REW, BUTTON_NONE },
313 { ACTION_STD_PREVREPEAT, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE },
314 { ACTION_STD_NEXT, BUTTON_FF, BUTTON_NONE },
315 { ACTION_STD_NEXTREPEAT, BUTTON_FF|BUTTON_REPEAT, BUTTON_NONE },
317 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
318 }; /* button_context_recscreen */
320 static const struct button_mapping button_context_radio[] = {
321 { ACTION_FM_PRESET, BUTTON_RIGHT | BUTTON_REL, BUTTON_RIGHT },
322 { ACTION_FM_MENU, BUTTON_RIGHT | BUTTON_REPEAT, BUTTON_NONE },
323 { ACTION_FM_MODE, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
324 { ACTION_FM_QUICKSCREEN, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
325 { ACTION_FM_STOP, BUTTON_PLAY | BUTTON_REPEAT, BUTTON_PLAY },
326 { ACTION_FM_EXIT, BUTTON_POWER, BUTTON_NONE },
327 { ACTION_FM_PLAY, BUTTON_PLAY | BUTTON_REL, BUTTON_PLAY },
328 { ACTION_SETTINGS_INC, BUTTON_SCROLL_UP, BUTTON_NONE },
329 { ACTION_SETTINGS_INCREPEAT, BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE },
330 { ACTION_SETTINGS_DEC, BUTTON_SCROLL_DOWN, BUTTON_NONE },
331 { ACTION_SETTINGS_DECREPEAT, BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
332 { ACTION_STD_PREV, BUTTON_REW, BUTTON_NONE },
333 { ACTION_STD_PREVREPEAT, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE },
334 { ACTION_STD_NEXT, BUTTON_FF, BUTTON_NONE },
335 { ACTION_STD_NEXTREPEAT, BUTTON_FF|BUTTON_REPEAT, BUTTON_NONE },
337 LAST_ITEM_IN_LIST
341 #ifdef USB_ENABLE_HID
342 static const struct button_mapping button_context_usb_hid[] = {
343 { ACTION_USB_HID_MODE_SWITCH_NEXT, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
344 { ACTION_USB_HID_MODE_SWITCH_PREV, BUTTON_POWER|BUTTON_REPEAT, BUTTON_POWER },
346 LAST_ITEM_IN_LIST
347 }; /* button_context_usb_hid */
349 static const struct button_mapping button_context_usb_hid_mode_multimedia[] = {
350 { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_SCROLL_DOWN, BUTTON_NONE },
351 { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
352 { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_SCROLL_UP, BUTTON_NONE },
353 { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE },
354 { ACTION_USB_HID_MULTIMEDIA_VOLUME_MUTE, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
355 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_PLAY_PAUSE, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
356 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
357 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_STOP, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
358 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_TRACK_PREV, BUTTON_REW|BUTTON_REL, BUTTON_REW },
359 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_TRACK_NEXT, BUTTON_FF|BUTTON_REL, BUTTON_FF },
361 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
362 }; /* button_context_usb_hid_mode_multimedia */
364 static const struct button_mapping button_context_usb_hid_mode_presentation[] = {
365 { ACTION_USB_HID_PRESENTATION_SLIDESHOW_START, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
366 { ACTION_USB_HID_PRESENTATION_SLIDESHOW_LEAVE, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
367 { ACTION_USB_HID_PRESENTATION_SLIDE_PREV, BUTTON_REW|BUTTON_REL, BUTTON_REW },
368 { ACTION_USB_HID_PRESENTATION_SLIDE_NEXT, BUTTON_FF|BUTTON_REL, BUTTON_FF },
369 { ACTION_USB_HID_PRESENTATION_SLIDE_FIRST, BUTTON_REW|BUTTON_REPEAT, BUTTON_REW },
370 { ACTION_USB_HID_PRESENTATION_SLIDE_LAST, BUTTON_FF|BUTTON_REPEAT, BUTTON_FF },
371 { ACTION_USB_HID_PRESENTATION_SCREEN_BLACK, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
372 { ACTION_USB_HID_PRESENTATION_SCREEN_WHITE, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
373 { ACTION_USB_HID_PRESENTATION_LINK_PREV, BUTTON_SCROLL_UP, BUTTON_NONE },
374 { ACTION_USB_HID_PRESENTATION_LINK_PREV, BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE },
375 { ACTION_USB_HID_PRESENTATION_LINK_NEXT, BUTTON_SCROLL_DOWN, BUTTON_NONE },
376 { ACTION_USB_HID_PRESENTATION_LINK_NEXT, BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
377 { ACTION_USB_HID_PRESENTATION_MOUSE_CLICK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
378 { ACTION_USB_HID_PRESENTATION_MOUSE_OVER, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
380 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
381 }; /* button_context_usb_hid_mode_presentation */
383 static const struct button_mapping button_context_usb_hid_mode_browser[] = {
384 { ACTION_USB_HID_BROWSER_SCROLL_UP, BUTTON_SCROLL_UP, BUTTON_NONE },
385 { ACTION_USB_HID_BROWSER_SCROLL_UP, BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE },
386 { ACTION_USB_HID_BROWSER_SCROLL_DOWN, BUTTON_SCROLL_DOWN, BUTTON_NONE },
387 { ACTION_USB_HID_BROWSER_SCROLL_DOWN, BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
388 { ACTION_USB_HID_BROWSER_SCROLL_PAGE_UP, BUTTON_REW|BUTTON_REL, BUTTON_REW },
389 { ACTION_USB_HID_BROWSER_SCROLL_PAGE_DOWN, BUTTON_FF|BUTTON_REL, BUTTON_FF },
390 { ACTION_USB_HID_BROWSER_ZOOM_IN, BUTTON_REW|BUTTON_REPEAT, BUTTON_REW },
391 { ACTION_USB_HID_BROWSER_ZOOM_OUT, BUTTON_FF|BUTTON_REPEAT, BUTTON_FF },
392 { ACTION_USB_HID_BROWSER_ZOOM_RESET, BUTTON_REW|BUTTON_FF|BUTTON_REPEAT, BUTTON_REW|BUTTON_FF },
393 { ACTION_USB_HID_BROWSER_TAB_PREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
394 { ACTION_USB_HID_BROWSER_TAB_NEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
395 { ACTION_USB_HID_BROWSER_TAB_CLOSE, BUTTON_LEFT|BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_LEFT|BUTTON_RIGHT },
396 { ACTION_USB_HID_BROWSER_HISTORY_BACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
397 { ACTION_USB_HID_BROWSER_HISTORY_FORWARD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
398 { ACTION_USB_HID_BROWSER_VIEW_FULL_SCREEN, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
400 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
401 }; /* button_context_usb_hid_mode_browser */
403 #ifdef HAVE_USB_HID_MOUSE
404 static const struct button_mapping button_context_usb_hid_mode_mouse[] = {
405 { ACTION_USB_HID_MOUSE_UP, BUTTON_SCROLL_UP, BUTTON_NONE },
406 { ACTION_USB_HID_MOUSE_UP_REP, BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE },
407 { ACTION_USB_HID_MOUSE_DOWN, BUTTON_SCROLL_DOWN, BUTTON_NONE },
408 { ACTION_USB_HID_MOUSE_DOWN_REP, BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
409 { ACTION_USB_HID_MOUSE_LEFT, BUTTON_LEFT, BUTTON_NONE },
410 { ACTION_USB_HID_MOUSE_LEFT_REP, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
411 { ACTION_USB_HID_MOUSE_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
412 { ACTION_USB_HID_MOUSE_RIGHT_REP, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
413 { ACTION_USB_HID_MOUSE_BUTTON_LEFT, BUTTON_PLAY, BUTTON_NONE },
414 { ACTION_USB_HID_MOUSE_BUTTON_LEFT_REL, BUTTON_PLAY|BUTTON_REL, BUTTON_NONE },
415 { ACTION_USB_HID_MOUSE_LDRAG_UP, BUTTON_PLAY|BUTTON_SCROLL_UP, BUTTON_NONE },
416 { ACTION_USB_HID_MOUSE_LDRAG_UP_REP, BUTTON_PLAY|BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE },
417 { ACTION_USB_HID_MOUSE_LDRAG_DOWN, BUTTON_PLAY|BUTTON_SCROLL_DOWN, BUTTON_NONE },
418 { ACTION_USB_HID_MOUSE_LDRAG_DOWN_REP, BUTTON_PLAY|BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
419 { ACTION_USB_HID_MOUSE_LDRAG_LEFT, BUTTON_PLAY|BUTTON_LEFT, BUTTON_NONE },
420 { ACTION_USB_HID_MOUSE_LDRAG_LEFT_REP, BUTTON_PLAY|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
421 { ACTION_USB_HID_MOUSE_LDRAG_RIGHT, BUTTON_PLAY|BUTTON_RIGHT, BUTTON_NONE },
422 { ACTION_USB_HID_MOUSE_LDRAG_RIGHT_REP, BUTTON_PLAY|BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
423 { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_UP, BUTTON_REW, BUTTON_NONE },
424 { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_UP, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE },
425 { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_DOWN, BUTTON_FF, BUTTON_NONE },
426 { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_DOWN, BUTTON_FF|BUTTON_REPEAT, BUTTON_NONE },
428 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
429 }; /* button_context_usb_hid_mode_mouse */
430 #endif
431 #endif
433 static const struct button_mapping* get_context_mapping_remote( int context )
435 context ^= CONTEXT_REMOTE;
437 switch (context)
439 case CONTEXT_STD:
440 case CONTEXT_MAINMENU:
441 return remote_button_context_standard;
443 case CONTEXT_WPS:
444 return remote_button_context_wps;
446 case CONTEXT_LIST:
447 return remote_button_context_list;
448 case CONTEXT_TREE:
449 if (global_settings.hold_lr_for_scroll_in_list)
450 return remote_button_context_listtree_scroll_without_combo;
451 else
452 return remote_button_context_listtree_scroll_with_combo;
453 case CONTEXT_CUSTOM|CONTEXT_TREE:
454 return remote_button_context_tree;
456 case CONTEXT_QUICKSCREEN:
457 return remote_button_context_quickscreen;
458 case CONTEXT_PITCHSCREEN:
459 return remote_button_context_pitchscreen;
460 case CONTEXT_RECSCREEN:
461 return button_context_recscreen;
462 default:
463 return remote_button_context_standard;
467 /* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */
468 const struct button_mapping* get_context_mapping(int context)
470 if (context&CONTEXT_REMOTE)
471 return get_context_mapping_remote(context);
473 switch (context)
475 case CONTEXT_STD:
476 return button_context_standard;
478 case CONTEXT_WPS:
479 return button_context_wps;
481 case CONTEXT_LIST:
482 return button_context_list;
483 case CONTEXT_TREE:
484 case CONTEXT_MAINMENU:
485 if (global_settings.hold_lr_for_scroll_in_list)
486 return button_context_listtree_scroll_without_combo;
487 else
488 return button_context_listtree_scroll_with_combo;
489 case CONTEXT_CUSTOM|CONTEXT_TREE:
490 return button_context_tree;
492 case CONTEXT_SETTINGS:
493 return button_context_settings;
494 case CONTEXT_CUSTOM|CONTEXT_SETTINGS:
495 case CONTEXT_SETTINGS_COLOURCHOOSER:
496 case CONTEXT_SETTINGS_EQ:
497 case CONTEXT_SETTINGS_TIME:
498 case CONTEXT_SETTINGS_RECTRIGGER:
499 return button_context_settings_right_is_inc;
501 case CONTEXT_YESNOSCREEN:
502 return button_context_yesno;
503 case CONTEXT_BOOKMARKSCREEN:
504 return button_context_bmark;
505 case CONTEXT_QUICKSCREEN:
506 return button_context_quickscreen;
507 case CONTEXT_PITCHSCREEN:
508 return button_context_pitchscreen;
509 case CONTEXT_KEYBOARD:
510 case CONTEXT_MORSE_INPUT:
511 return button_context_keyboard;
512 case CONTEXT_RECSCREEN:
513 return button_context_recscreen;
514 case CONTEXT_FM:
515 return button_context_radio;
516 #ifdef USB_ENABLE_HID
517 case CONTEXT_USB_HID:
518 return button_context_usb_hid;
519 case CONTEXT_USB_HID_MODE_MULTIMEDIA:
520 return button_context_usb_hid_mode_multimedia;
521 case CONTEXT_USB_HID_MODE_PRESENTATION:
522 return button_context_usb_hid_mode_presentation;
523 case CONTEXT_USB_HID_MODE_BROWSER:
524 return button_context_usb_hid_mode_browser;
525 #ifdef HAVE_USB_HID_MOUSE
526 case CONTEXT_USB_HID_MODE_MOUSE:
527 return button_context_usb_hid_mode_mouse;
528 #endif
529 #endif
530 default:
531 return button_context_standard;
533 return button_context_standard;