1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
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 */
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
},
51 { ACTION_STD_OK
, BUTTON_SELECT
|BUTTON_REL
, BUTTON_SELECT
},
52 { ACTION_STD_MENU
, BUTTON_MENU
|BUTTON_REL
, BUTTON_MENU
},
53 { ACTION_STD_QUICKSCREEN
, BUTTON_MENU
|BUTTON_REPEAT
, BUTTON_MENU
},
54 { ACTION_STD_CONTEXT
, BUTTON_SELECT
|BUTTON_REPEAT
, BUTTON_SELECT
},
55 { ACTION_STD_CANCEL
, BUTTON_PLAY
|BUTTON_REPEAT
, BUTTON_NONE
},
58 }; /* 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
},
63 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
64 }; /* button_context_tree */
66 static const struct button_mapping button_context_tree_scroll_lr
[] = {
67 { ACTION_NONE
, BUTTON_LEFT
, BUTTON_NONE
},
68 { ACTION_STD_CANCEL
, BUTTON_LEFT
|BUTTON_REL
, BUTTON_LEFT
},
69 { ACTION_TREE_ROOT_INIT
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_LEFT
},
70 { ACTION_TREE_PGLEFT
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
71 { ACTION_TREE_PGLEFT
, BUTTON_LEFT
|BUTTON_REL
, BUTTON_LEFT
|BUTTON_REPEAT
},
72 { ACTION_NONE
, BUTTON_RIGHT
, BUTTON_NONE
},
73 { ACTION_STD_OK
, BUTTON_RIGHT
|BUTTON_REL
, BUTTON_RIGHT
},
74 { ACTION_TREE_PGRIGHT
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
75 { ACTION_TREE_PGRIGHT
, BUTTON_RIGHT
|BUTTON_REL
, BUTTON_RIGHT
|BUTTON_REPEAT
},
76 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM
|CONTEXT_TREE
),
79 static const struct button_mapping button_context_wps
[] = {
80 { ACTION_WPS_PLAY
, BUTTON_PLAY
|BUTTON_REL
, BUTTON_PLAY
},
81 { ACTION_WPS_STOP
, BUTTON_PLAY
|BUTTON_REPEAT
, BUTTON_PLAY
},
82 { ACTION_WPS_SKIPPREV
, BUTTON_LEFT
|BUTTON_REL
, BUTTON_LEFT
},
83 { ACTION_WPS_SEEKBACK
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
84 { ACTION_WPS_STOPSEEK
, BUTTON_LEFT
|BUTTON_REL
, BUTTON_LEFT
|BUTTON_REPEAT
},
85 { ACTION_WPS_SKIPNEXT
, BUTTON_RIGHT
|BUTTON_REL
, BUTTON_RIGHT
},
86 { ACTION_WPS_SEEKFWD
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
87 { ACTION_WPS_STOPSEEK
, BUTTON_RIGHT
|BUTTON_REL
, BUTTON_RIGHT
|BUTTON_REPEAT
},
88 { ACTION_WPS_VOLDOWN
, BUTTON_SCROLL_BACK
, BUTTON_NONE
},
89 { ACTION_WPS_VOLDOWN
, BUTTON_SCROLL_BACK
|BUTTON_REPEAT
, BUTTON_NONE
},
90 { ACTION_WPS_VOLUP
, BUTTON_SCROLL_FWD
, BUTTON_NONE
},
91 { ACTION_WPS_VOLUP
, BUTTON_SCROLL_FWD
|BUTTON_REPEAT
, BUTTON_NONE
},
92 { ACTION_WPS_BROWSE
, BUTTON_SELECT
|BUTTON_REL
, BUTTON_SELECT
},
93 { ACTION_WPS_CONTEXT
, BUTTON_SELECT
|BUTTON_REPEAT
, BUTTON_SELECT
},
94 { ACTION_WPS_MENU
, BUTTON_MENU
|BUTTON_REL
, BUTTON_MENU
},
95 { ACTION_WPS_QUICKSCREEN
, BUTTON_MENU
|BUTTON_REPEAT
, BUTTON_MENU
},
98 }; /* button_context_wps */
100 static const struct button_mapping button_context_settings
[] = {
101 { ACTION_SETTINGS_INC
, BUTTON_SCROLL_FWD
, BUTTON_NONE
},
102 { ACTION_SETTINGS_INCREPEAT
, BUTTON_SCROLL_FWD
|BUTTON_REPEAT
, BUTTON_NONE
},
103 { ACTION_SETTINGS_DEC
, BUTTON_SCROLL_BACK
, BUTTON_NONE
},
104 { ACTION_SETTINGS_DECREPEAT
, BUTTON_SCROLL_BACK
|BUTTON_REPEAT
, BUTTON_NONE
},
105 { ACTION_STD_PREV
, BUTTON_LEFT
, BUTTON_NONE
},
106 { ACTION_STD_PREVREPEAT
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
107 { ACTION_STD_NEXT
, BUTTON_RIGHT
, BUTTON_NONE
},
108 { ACTION_STD_NEXTREPEAT
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
109 { ACTION_STD_OK
, BUTTON_SELECT
|BUTTON_REL
, BUTTON_NONE
},
110 { ACTION_STD_CANCEL
, BUTTON_MENU
|BUTTON_REL
, BUTTON_MENU
},
112 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
113 }; /* button_context_settings */
115 static const struct button_mapping button_context_yesno
[] = {
116 { ACTION_YESNO_ACCEPT
, BUTTON_SELECT
, BUTTON_NONE
},
118 }; /* button_context_settings_yesno */
120 static const struct button_mapping button_context_bmark
[] = {
121 { ACTION_BMS_DELETE
, BUTTON_MENU
|BUTTON_REPEAT
, BUTTON_MENU
},
122 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST
),
123 }; /* button_context_settings_bmark */
125 static const struct button_mapping button_context_quickscreen
[] = {
126 { ACTION_QS_DOWN
, BUTTON_PLAY
, BUTTON_NONE
},
127 { ACTION_QS_DOWN
, BUTTON_PLAY
|BUTTON_REPEAT
, BUTTON_NONE
},
128 { ACTION_QS_LEFT
, BUTTON_LEFT
, BUTTON_NONE
},
129 { ACTION_QS_LEFT
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
130 { ACTION_QS_RIGHT
, BUTTON_RIGHT
, BUTTON_NONE
},
131 { ACTION_QS_RIGHT
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
132 { ACTION_STD_CANCEL
, BUTTON_MENU
, BUTTON_NONE
},
134 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
135 }; /* button_context_quickscreen */
137 static const struct button_mapping button_context_pitchscreen
[] = {
138 { ACTION_PS_INC_SMALL
, BUTTON_SCROLL_FWD
, BUTTON_NONE
},
139 { ACTION_PS_INC_BIG
, BUTTON_SCROLL_FWD
|BUTTON_REPEAT
, BUTTON_NONE
},
140 { ACTION_PS_DEC_SMALL
, BUTTON_SCROLL_BACK
, BUTTON_NONE
},
141 { ACTION_PS_DEC_BIG
, BUTTON_SCROLL_BACK
|BUTTON_REPEAT
, BUTTON_NONE
},
142 { ACTION_PS_NUDGE_LEFT
, BUTTON_LEFT
, BUTTON_NONE
},
143 { ACTION_PS_NUDGE_LEFTOFF
, BUTTON_LEFT
|BUTTON_REL
, BUTTON_NONE
},
144 { ACTION_PS_NUDGE_RIGHT
, BUTTON_RIGHT
, BUTTON_NONE
},
145 { ACTION_PS_NUDGE_RIGHTOFF
, BUTTON_RIGHT
|BUTTON_REL
, BUTTON_NONE
},
146 { ACTION_PS_TOGGLE_MODE
, BUTTON_PLAY
, BUTTON_NONE
},
147 { ACTION_PS_RESET
, BUTTON_MENU
, BUTTON_NONE
},
148 { ACTION_PS_EXIT
, BUTTON_SELECT
, BUTTON_NONE
},
149 { ACTION_PS_SLOWER
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
150 { ACTION_PS_FASTER
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
152 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
153 }; /* button_context_pitchscreen */
155 static const struct button_mapping button_context_keyboard
[] = {
156 { ACTION_KBD_LEFT
, BUTTON_LEFT
, BUTTON_NONE
},
157 { ACTION_KBD_LEFT
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
158 { ACTION_KBD_RIGHT
, BUTTON_RIGHT
, BUTTON_NONE
},
159 { ACTION_KBD_RIGHT
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
160 { ACTION_KBD_SELECT
, BUTTON_SELECT
, BUTTON_NONE
},
161 { ACTION_KBD_DONE
, BUTTON_PLAY
, BUTTON_NONE
},
162 { ACTION_KBD_ABORT
, BUTTON_MENU
|BUTTON_REL
, BUTTON_MENU
},
163 { ACTION_KBD_UP
, BUTTON_SCROLL_BACK
, BUTTON_NONE
},
164 { ACTION_KBD_UP
, BUTTON_SCROLL_BACK
|BUTTON_REPEAT
, BUTTON_NONE
},
165 { ACTION_KBD_DOWN
, BUTTON_SCROLL_FWD
, BUTTON_NONE
},
166 { ACTION_KBD_DOWN
, BUTTON_SCROLL_FWD
|BUTTON_REPEAT
, BUTTON_NONE
},
167 { ACTION_KBD_MORSE_INPUT
, BUTTON_MENU
|BUTTON_REPEAT
, BUTTON_MENU
},
168 { ACTION_KBD_MORSE_SELECT
, BUTTON_SELECT
|BUTTON_REL
, BUTTON_NONE
},
170 }; /* button_context_keyboard */
172 #ifdef HAVE_RECORDING
173 const struct button_mapping button_context_recscreen
[] = {
175 { ACTION_REC_NEWFILE
, BUTTON_SELECT
|BUTTON_REL
, BUTTON_SELECT
},
176 { ACTION_STD_MENU
, BUTTON_SELECT
|BUTTON_REPEAT
, BUTTON_SELECT
},
177 { ACTION_REC_PAUSE
, BUTTON_PLAY
|BUTTON_REL
, BUTTON_PLAY
},
178 { ACTION_STD_CANCEL
, BUTTON_PLAY
|BUTTON_REPEAT
, BUTTON_NONE
},
179 { ACTION_STD_CANCEL
, BUTTON_MENU
, BUTTON_NONE
},
180 { ACTION_STD_NEXT
, BUTTON_SCROLL_FWD
, BUTTON_NONE
},
181 { ACTION_STD_NEXT
, BUTTON_SCROLL_FWD
|BUTTON_REPEAT
, BUTTON_NONE
},
182 { ACTION_STD_PREV
, BUTTON_SCROLL_BACK
, BUTTON_NONE
},
183 { ACTION_STD_PREV
, BUTTON_SCROLL_BACK
|BUTTON_REPEAT
, BUTTON_NONE
},
184 { ACTION_SETTINGS_INC
, BUTTON_RIGHT
, BUTTON_NONE
},
185 { ACTION_SETTINGS_INCREPEAT
, BUTTON_RIGHT
|BUTTON_REPEAT
, BUTTON_NONE
},
186 { ACTION_SETTINGS_DEC
, BUTTON_LEFT
, BUTTON_NONE
},
187 { ACTION_SETTINGS_DECREPEAT
, BUTTON_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
190 }; /* button_context_recscreen */
194 static const struct button_mapping button_context_usb_hid
[] = {
195 { ACTION_USB_HID_PLAY
, BUTTON_PLAY
|BUTTON_REL
, BUTTON_PLAY
},
196 { ACTION_USB_HID_STOP
, BUTTON_PLAY
|BUTTON_REPEAT
, BUTTON_PLAY
},
197 { ACTION_USB_HID_SKIPPREV
, BUTTON_LEFT
, BUTTON_NONE
},
198 { ACTION_USB_HID_SKIPNEXT
, BUTTON_RIGHT
, BUTTON_NONE
},
199 { ACTION_USB_HID_VOLUP
, BUTTON_SCROLL_FWD
, BUTTON_NONE
},
200 { ACTION_USB_HID_VOLUP
, BUTTON_SCROLL_FWD
|BUTTON_REPEAT
, BUTTON_NONE
},
201 { ACTION_USB_HID_VOLDOWN
, BUTTON_SCROLL_BACK
, BUTTON_NONE
},
202 { ACTION_USB_HID_VOLDOWN
, BUTTON_SCROLL_BACK
|BUTTON_REPEAT
, BUTTON_NONE
},
203 { ACTION_USB_HID_MUTE
, BUTTON_SELECT
, BUTTON_NONE
},
204 { ACTION_USB_HID_MENU
, BUTTON_MENU
, BUTTON_NONE
},
207 }; /* button_context_usb_hid */
210 #if BUTTON_REMOTE != 0
211 /*****************************************************************************
212 * Remote control mappings
213 *****************************************************************************/
215 static const struct button_mapping remote_button_context_standard
[] = {
216 { ACTION_STD_PREV
, BUTTON_RC_LEFT
, BUTTON_NONE
},
217 { ACTION_STD_NEXT
, BUTTON_RC_RIGHT
, BUTTON_NONE
},
218 { ACTION_STD_CANCEL
, BUTTON_RC_STOP
, BUTTON_NONE
},
219 { ACTION_STD_OK
, BUTTON_RC_PLAY
, BUTTON_NONE
},
224 static const struct button_mapping remote_button_context_wps
[] = {
225 { ACTION_WPS_VOLDOWN
, BUTTON_RC_VOL_DOWN
, BUTTON_NONE
},
226 { ACTION_WPS_VOLDOWN
, BUTTON_RC_VOL_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
227 { ACTION_WPS_VOLUP
, BUTTON_RC_VOL_UP
, BUTTON_NONE
},
228 { ACTION_WPS_VOLUP
, BUTTON_RC_VOL_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
230 { ACTION_WPS_PLAY
, BUTTON_RC_PLAY
|BUTTON_REL
, BUTTON_RC_PLAY
},
231 { ACTION_WPS_STOP
, BUTTON_RC_PLAY
|BUTTON_REPEAT
, BUTTON_NONE
},
232 { ACTION_WPS_SKIPNEXT
, BUTTON_RC_RIGHT
|BUTTON_REL
, BUTTON_RC_RIGHT
},
233 { ACTION_WPS_SEEKFWD
, BUTTON_RC_RIGHT
|BUTTON_REPEAT
,BUTTON_NONE
},
234 { ACTION_WPS_STOPSEEK
, BUTTON_RC_RIGHT
|BUTTON_REL
, BUTTON_RC_RIGHT
|BUTTON_REPEAT
},
235 { ACTION_WPS_SKIPPREV
, BUTTON_RC_LEFT
|BUTTON_REL
, BUTTON_RC_LEFT
},
236 { ACTION_WPS_SEEKBACK
, BUTTON_RC_LEFT
|BUTTON_REPEAT
, BUTTON_NONE
},
237 { ACTION_WPS_STOPSEEK
, BUTTON_RC_LEFT
|BUTTON_REL
, BUTTON_RC_LEFT
|BUTTON_REPEAT
},
239 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
243 static const struct button_mapping remote_button_context_usb_hid
[] = {
244 { ACTION_USB_HID_PLAY
, BUTTON_RC_PLAY
, BUTTON_NONE
},
245 { ACTION_USB_HID_STOP
, BUTTON_RC_PLAY
|BUTTON_REPEAT
, BUTTON_NONE
},
246 { ACTION_USB_HID_SKIPPREV
, BUTTON_RC_LEFT
, BUTTON_NONE
},
247 { ACTION_USB_HID_SKIPNEXT
, BUTTON_RC_RIGHT
, BUTTON_NONE
},
248 { ACTION_USB_HID_VOLUP
, BUTTON_RC_VOL_UP
, BUTTON_NONE
},
249 { ACTION_USB_HID_VOLUP
, BUTTON_RC_VOL_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
250 { ACTION_USB_HID_VOLDOWN
, BUTTON_RC_VOL_DOWN
, BUTTON_NONE
},
251 { ACTION_USB_HID_VOLDOWN
, BUTTON_RC_VOL_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
254 }; /* remote_button_context_usb_hid */
257 static const struct button_mapping
* get_context_mapping_remote( int context
)
259 context
^= CONTEXT_REMOTE
;
264 return remote_button_context_wps
;
266 case CONTEXT_USB_HID
:
267 return remote_button_context_usb_hid
;
270 return remote_button_context_standard
;
273 #endif /* BUTTON_REMOTE != 0 */
275 /* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */
276 const struct button_mapping
* get_context_mapping(int context
)
278 #if BUTTON_REMOTE != 0
279 if (context
&CONTEXT_REMOTE
)
280 return get_context_mapping_remote(context
);
286 return button_context_standard
;
288 return button_context_wps
;
291 case CONTEXT_MAINMENU
:
292 if (global_settings
.hold_lr_for_scroll_in_list
)
293 return button_context_tree_scroll_lr
;
294 /* else fall through to CUSTOM|CONTEXT_TREE */
295 case CONTEXT_CUSTOM
|CONTEXT_TREE
:
296 return button_context_tree
;
299 return button_context_standard
;
301 case CONTEXT_SETTINGS_EQ
:
302 case CONTEXT_SETTINGS_COLOURCHOOSER
:
303 case CONTEXT_SETTINGS_TIME
:
304 case CONTEXT_SETTINGS
:
305 case CONTEXT_SETTINGS_RECTRIGGER
:
306 return button_context_settings
;
307 case CONTEXT_YESNOSCREEN
:
308 return button_context_yesno
;
309 case CONTEXT_BOOKMARKSCREEN
:
310 return button_context_bmark
;
311 case CONTEXT_QUICKSCREEN
:
312 return button_context_quickscreen
;
313 case CONTEXT_PITCHSCREEN
:
314 return button_context_pitchscreen
;
315 case CONTEXT_KEYBOARD
:
316 return button_context_keyboard
;
317 #ifdef HAVE_RECORDING
318 case CONTEXT_RECSCREEN
:
319 return button_context_recscreen
;
322 case CONTEXT_USB_HID
:
323 return button_context_usb_hid
;
326 return button_context_standard
;
328 return button_context_standard
;