1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2006 Jonathan Gordon
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
20 /* Button Code Definitions for the Philips SA9200 target */
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
37 /* CONTEXT_CUSTOM's used in this file...
39 CONTEXT_CUSTOM|CONTEXT_TREE = the standard list/tree defines (without directions)
40 CONTEXT_CUSTOM|CONTEXT_SETTINGS = the direction keys for the eq/col picker screens
41 i.e where up/down is inc/dec
42 CONTEXT_SETTINGS = up/down is prev/next, l/r is inc/dec
47 static const struct button_mapping button_context_standard
[] = {
48 { ACTION_STD_PREV
, BUTTON_UP
, BUTTON_NONE
},
49 { ACTION_STD_PREVREPEAT
, BUTTON_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
50 { ACTION_STD_NEXT
, BUTTON_DOWN
, BUTTON_NONE
},
51 { ACTION_STD_NEXTREPEAT
, BUTTON_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
53 { ACTION_STD_CANCEL
, BUTTON_REW
, BUTTON_NONE
},
54 { ACTION_STD_CANCEL
, BUTTON_POWER
, BUTTON_NONE
},
56 { ACTION_STD_CONTEXT
, BUTTON_SELECT
|BUTTON_REPEAT
, BUTTON_SELECT
},
58 { ACTION_STD_QUICKSCREEN
, BUTTON_MENU
|BUTTON_REPEAT
, BUTTON_MENU
},
59 { ACTION_STD_MENU
, BUTTON_MENU
|BUTTON_REL
, BUTTON_MENU
},
61 { ACTION_STD_OK
, BUTTON_SELECT
|BUTTON_REL
, BUTTON_SELECT
},
62 { ACTION_STD_OK
, BUTTON_FFWD
, BUTTON_NONE
},
65 }; /* button_context_standard */
68 static const struct button_mapping button_context_wps
[] = {
69 { ACTION_WPS_PLAY
, BUTTON_RIGHT
|BUTTON_REL
, BUTTON_RIGHT
},
70 { ACTION_WPS_STOP
, BUTTON_POWER
|BUTTON_REL
, BUTTON_POWER
},
72 { ACTION_WPS_SKIPNEXT
, BUTTON_FFWD
|BUTTON_REL
, BUTTON_FFWD
},
73 { ACTION_WPS_SKIPPREV
, BUTTON_REW
|BUTTON_REL
, BUTTON_REW
},
75 { ACTION_WPS_SEEKBACK
, BUTTON_REW
|BUTTON_REPEAT
, BUTTON_NONE
},
76 { ACTION_WPS_SEEKFWD
, BUTTON_FFWD
|BUTTON_REPEAT
, BUTTON_NONE
},
77 { ACTION_WPS_STOPSEEK
, BUTTON_REW
|BUTTON_REL
, BUTTON_REW
|BUTTON_REPEAT
},
78 { ACTION_WPS_STOPSEEK
, BUTTON_FFWD
|BUTTON_REL
, BUTTON_FFWD
|BUTTON_REPEAT
},
80 { ACTION_WPS_ABSETB_NEXTDIR
, BUTTON_RIGHT
|BUTTON_FFWD
, BUTTON_NONE
},
81 { ACTION_WPS_ABSETA_PREVDIR
, BUTTON_RIGHT
|BUTTON_REW
, BUTTON_NONE
},
82 { ACTION_WPS_ABRESET
, BUTTON_RIGHT
|BUTTON_SELECT
, BUTTON_NONE
},
84 { ACTION_WPS_VOLDOWN
, BUTTON_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
85 { ACTION_WPS_VOLDOWN
, BUTTON_DOWN
, BUTTON_NONE
},
86 { ACTION_WPS_VOLDOWN
, BUTTON_VOL_DOWN
, BUTTON_NONE
},
87 { ACTION_WPS_VOLDOWN
, BUTTON_VOL_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
88 { ACTION_WPS_VOLUP
, BUTTON_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
89 { ACTION_WPS_VOLUP
, BUTTON_UP
, BUTTON_NONE
},
90 { ACTION_WPS_VOLUP
, BUTTON_VOL_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
91 { ACTION_WPS_VOLUP
, BUTTON_VOL_UP
, BUTTON_NONE
},
93 { ACTION_WPS_PITCHSCREEN
, BUTTON_RIGHT
|BUTTON_UP
, BUTTON_RIGHT
},
94 { ACTION_WPS_PITCHSCREEN
, BUTTON_RIGHT
|BUTTON_DOWN
, BUTTON_RIGHT
},
96 { ACTION_WPS_QUICKSCREEN
, BUTTON_MENU
|BUTTON_REPEAT
, BUTTON_MENU
},
97 { ACTION_WPS_MENU
, BUTTON_MENU
|BUTTON_REL
, BUTTON_MENU
},
98 { ACTION_WPS_CONTEXT
, BUTTON_SELECT
|BUTTON_REPEAT
, BUTTON_SELECT
},
100 { ACTION_WPS_ID3SCREEN
, BUTTON_RIGHT
|BUTTON_MENU
, BUTTON_NONE
},
101 { ACTION_WPS_BROWSE
, BUTTON_SELECT
|BUTTON_REL
, BUTTON_SELECT
},
104 }; /* button_context_wps */
106 static const struct button_mapping button_context_list
[] = {
107 { ACTION_LISTTREE_PGUP
, BUTTON_RIGHT
|BUTTON_UP
, BUTTON_RIGHT
},
108 { ACTION_LISTTREE_PGUP
, BUTTON_UP
|BUTTON_REL
, BUTTON_RIGHT
|BUTTON_UP
},
109 { ACTION_LISTTREE_PGUP
, BUTTON_RIGHT
|BUTTON_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
110 { ACTION_LISTTREE_PGDOWN
, BUTTON_RIGHT
|BUTTON_DOWN
, BUTTON_RIGHT
},
111 { ACTION_LISTTREE_PGDOWN
, BUTTON_DOWN
|BUTTON_REL
, BUTTON_RIGHT
|BUTTON_DOWN
},
112 { ACTION_LISTTREE_PGDOWN
, BUTTON_RIGHT
|BUTTON_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
113 #ifdef HAVE_VOLUME_IN_LIST
114 { ACTION_LIST_VOLUP
, BUTTON_VOL_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
115 { ACTION_LIST_VOLUP
, BUTTON_VOL_UP
, BUTTON_NONE
},
116 { ACTION_LIST_VOLDOWN
, BUTTON_VOL_DOWN
, BUTTON_NONE
},
117 { ACTION_LIST_VOLDOWN
, BUTTON_VOL_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
120 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
121 }; /* button_context_list */
123 static const struct button_mapping button_context_tree
[] = {
124 { ACTION_TREE_WPS
, BUTTON_RIGHT
|BUTTON_REL
, BUTTON_RIGHT
},
125 { ACTION_TREE_STOP
, BUTTON_POWER
, BUTTON_NONE
},
126 { ACTION_TREE_STOP
, BUTTON_POWER
|BUTTON_REL
, BUTTON_POWER
},
127 { ACTION_TREE_STOP
, BUTTON_POWER
|BUTTON_REPEAT
, BUTTON_NONE
},
129 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST
)
130 }; /* button_context_tree */
132 static const struct button_mapping button_context_listtree_scroll_with_combo
[] = {
133 { ACTION_NONE
, BUTTON_RIGHT
, BUTTON_NONE
},
134 { ACTION_TREE_PGLEFT
, BUTTON_RIGHT
|BUTTON_REW
, BUTTON_RIGHT
},
135 { ACTION_TREE_PGLEFT
, BUTTON_REW
|BUTTON_REL
, BUTTON_RIGHT
|BUTTON_REW
},
136 { ACTION_TREE_PGLEFT
, BUTTON_RIGHT
|BUTTON_REW
, BUTTON_REW
|BUTTON_REL
},
137 { ACTION_TREE_ROOT_INIT
, BUTTON_RIGHT
|BUTTON_REW
|BUTTON_REPEAT
, BUTTON_RIGHT
|BUTTON_REW
},
138 { ACTION_TREE_PGLEFT
, BUTTON_RIGHT
|BUTTON_REW
|BUTTON_REPEAT
, BUTTON_NONE
},
139 { ACTION_TREE_PGRIGHT
, BUTTON_RIGHT
|BUTTON_FFWD
, BUTTON_RIGHT
},
140 { ACTION_TREE_PGRIGHT
, BUTTON_FFWD
|BUTTON_REL
, BUTTON_RIGHT
|BUTTON_FFWD
},
141 { ACTION_TREE_PGRIGHT
, BUTTON_RIGHT
|BUTTON_FFWD
, BUTTON_FFWD
|BUTTON_REL
},
142 { ACTION_TREE_PGRIGHT
, BUTTON_RIGHT
|BUTTON_FFWD
|BUTTON_REPEAT
, BUTTON_NONE
},
143 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM
|CONTEXT_TREE
),
146 static const struct button_mapping button_context_listtree_scroll_without_combo
[] = {
147 { ACTION_NONE
, BUTTON_REW
, BUTTON_NONE
},
148 { ACTION_STD_CANCEL
, BUTTON_REW
|BUTTON_REL
, BUTTON_REW
},
149 { ACTION_TREE_ROOT_INIT
, BUTTON_REW
|BUTTON_REPEAT
, BUTTON_REW
},
150 { ACTION_TREE_PGLEFT
, BUTTON_REW
|BUTTON_REPEAT
, BUTTON_NONE
},
151 { ACTION_TREE_PGLEFT
, BUTTON_REW
|BUTTON_REL
, BUTTON_REW
|BUTTON_REPEAT
},
152 { ACTION_NONE
, BUTTON_FFWD
, BUTTON_NONE
},
153 { ACTION_STD_OK
, BUTTON_FFWD
|BUTTON_REL
, BUTTON_FFWD
},
154 { ACTION_TREE_PGRIGHT
, BUTTON_FFWD
|BUTTON_REPEAT
, BUTTON_NONE
},
155 { ACTION_TREE_PGRIGHT
, BUTTON_FFWD
|BUTTON_REL
, BUTTON_FFWD
|BUTTON_REPEAT
},
156 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM
|CONTEXT_TREE
),
159 static const struct button_mapping button_context_settings
[] = {
160 { ACTION_SETTINGS_INC
, BUTTON_UP
, BUTTON_NONE
},
161 { ACTION_SETTINGS_INCREPEAT
, BUTTON_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
162 { ACTION_SETTINGS_DEC
, BUTTON_DOWN
, BUTTON_NONE
},
163 { ACTION_SETTINGS_DECREPEAT
, BUTTON_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
164 { ACTION_STD_PREV
, BUTTON_REW
, BUTTON_NONE
},
165 { ACTION_STD_PREVREPEAT
, BUTTON_REW
|BUTTON_REPEAT
, BUTTON_NONE
},
166 { ACTION_STD_NEXT
, BUTTON_FFWD
, BUTTON_NONE
},
167 { ACTION_STD_NEXTREPEAT
, BUTTON_FFWD
|BUTTON_REPEAT
, BUTTON_NONE
},
168 { ACTION_SETTINGS_RESET
, BUTTON_RIGHT
, BUTTON_NONE
},
170 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
171 }; /* button_context_settings */
173 static const struct button_mapping button_context_settings_right_is_inc
[] = {
174 { ACTION_SETTINGS_INC
, BUTTON_FFWD
, BUTTON_NONE
},
175 { ACTION_SETTINGS_INCREPEAT
, BUTTON_FFWD
|BUTTON_REPEAT
, BUTTON_NONE
},
176 { ACTION_SETTINGS_DEC
, BUTTON_REW
, BUTTON_NONE
},
177 { ACTION_SETTINGS_DECREPEAT
, BUTTON_REW
|BUTTON_REPEAT
, BUTTON_NONE
},
178 { ACTION_STD_PREV
, BUTTON_UP
, BUTTON_NONE
},
179 { ACTION_STD_PREVREPEAT
, BUTTON_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
180 { ACTION_STD_NEXT
, BUTTON_DOWN
, BUTTON_NONE
},
181 { ACTION_STD_NEXTREPEAT
, BUTTON_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
182 { ACTION_SETTINGS_RESET
, BUTTON_RIGHT
, BUTTON_NONE
},
184 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
185 }; /* button_context_settingsgraphical */
187 static const struct button_mapping button_context_yesno
[] = {
188 { ACTION_YESNO_ACCEPT
, BUTTON_SELECT
, BUTTON_NONE
},
189 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
190 }; /* button_context_settings_yesno */
192 static const struct button_mapping button_context_colorchooser
[] = {
193 { ACTION_STD_OK
, BUTTON_RIGHT
|BUTTON_REL
, BUTTON_NONE
},
194 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM
|CONTEXT_SETTINGS
),
195 }; /* button_context_colorchooser */
197 static const struct button_mapping button_context_eq
[] = {
198 { ACTION_STD_OK
, BUTTON_SELECT
|BUTTON_REL
, BUTTON_NONE
},
199 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM
|CONTEXT_SETTINGS
),
200 }; /* button_context_eq */
202 /** Bookmark Screen **/
203 static const struct button_mapping button_context_bmark
[] = {
204 { ACTION_BMS_DELETE
, BUTTON_RIGHT
, BUTTON_NONE
},
206 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST
),
207 }; /* button_context_bmark */
209 static const struct button_mapping button_context_time
[] = {
210 { ACTION_STD_CANCEL
, BUTTON_POWER
, BUTTON_NONE
},
211 { ACTION_STD_OK
, BUTTON_RIGHT
, BUTTON_NONE
},
212 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS
),
213 }; /* button_context_time */
215 static const struct button_mapping button_context_quickscreen
[] = {
216 { ACTION_QS_DOWNINV
, BUTTON_UP
, BUTTON_NONE
},
217 { ACTION_QS_DOWNINV
, BUTTON_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
218 { ACTION_QS_DOWN
, BUTTON_DOWN
, BUTTON_NONE
},
219 { ACTION_QS_DOWN
, BUTTON_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
220 { ACTION_QS_LEFT
, BUTTON_REW
, BUTTON_NONE
},
221 { ACTION_QS_LEFT
, BUTTON_REW
|BUTTON_REPEAT
, BUTTON_NONE
},
222 { ACTION_QS_RIGHT
, BUTTON_FFWD
, BUTTON_NONE
},
223 { ACTION_QS_RIGHT
, BUTTON_FFWD
|BUTTON_REPEAT
, BUTTON_NONE
},
224 { ACTION_STD_CANCEL
, BUTTON_MENU
, BUTTON_NONE
},
226 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
227 }; /* button_context_quickscreen */
229 static const struct button_mapping button_context_pitchscreen
[] = {
230 { ACTION_PS_INC_SMALL
, BUTTON_UP
, BUTTON_NONE
},
231 { ACTION_PS_INC_BIG
, BUTTON_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
232 { ACTION_PS_DEC_SMALL
, BUTTON_DOWN
, BUTTON_NONE
},
233 { ACTION_PS_DEC_BIG
, BUTTON_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
234 { ACTION_PS_NUDGE_LEFT
, BUTTON_REW
, BUTTON_NONE
},
235 { ACTION_PS_NUDGE_LEFTOFF
, BUTTON_REW
|BUTTON_REL
, BUTTON_NONE
},
236 { ACTION_PS_NUDGE_RIGHT
, BUTTON_FFWD
, BUTTON_NONE
},
237 { ACTION_PS_NUDGE_RIGHTOFF
, BUTTON_FFWD
|BUTTON_REL
, BUTTON_NONE
},
238 { ACTION_PS_TOGGLE_MODE
, BUTTON_MENU
, BUTTON_NONE
},
239 { ACTION_PS_RESET
, BUTTON_RIGHT
, BUTTON_NONE
},
240 { ACTION_PS_EXIT
, BUTTON_POWER
, BUTTON_NONE
},
242 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
243 }; /* button_context_pitchcreen */
245 static const struct button_mapping button_context_keyboard
[] = {
246 { ACTION_KBD_LEFT
, BUTTON_REW
, BUTTON_NONE
},
247 { ACTION_KBD_LEFT
, BUTTON_REW
|BUTTON_REPEAT
, BUTTON_NONE
},
248 { ACTION_KBD_RIGHT
, BUTTON_FFWD
, BUTTON_NONE
},
249 { ACTION_KBD_RIGHT
, BUTTON_FFWD
|BUTTON_REPEAT
, BUTTON_NONE
},
250 { ACTION_KBD_CURSOR_LEFT
, BUTTON_RIGHT
|BUTTON_REW
, BUTTON_NONE
},
251 { ACTION_KBD_CURSOR_LEFT
, BUTTON_RIGHT
|BUTTON_REW
|BUTTON_REPEAT
, BUTTON_NONE
},
252 { ACTION_KBD_CURSOR_RIGHT
, BUTTON_RIGHT
|BUTTON_FFWD
, BUTTON_NONE
},
253 { ACTION_KBD_CURSOR_RIGHT
, BUTTON_RIGHT
|BUTTON_FFWD
|BUTTON_REPEAT
, BUTTON_NONE
},
254 { ACTION_KBD_SELECT
, BUTTON_SELECT
, BUTTON_NONE
},
255 { ACTION_KBD_PAGE_FLIP
, BUTTON_RIGHT
|BUTTON_MENU
, BUTTON_NONE
},
256 { ACTION_KBD_DONE
, BUTTON_RIGHT
|BUTTON_REL
, BUTTON_RIGHT
},
257 { ACTION_KBD_ABORT
, BUTTON_POWER
|BUTTON_REL
, BUTTON_POWER
},
258 { ACTION_KBD_BACKSPACE
, BUTTON_MENU
, BUTTON_NONE
},
259 { ACTION_KBD_BACKSPACE
, BUTTON_MENU
|BUTTON_REPEAT
, BUTTON_NONE
},
260 { ACTION_KBD_UP
, BUTTON_UP
, BUTTON_NONE
},
261 { ACTION_KBD_UP
, BUTTON_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
262 { ACTION_KBD_DOWN
, BUTTON_DOWN
, BUTTON_NONE
},
263 { ACTION_KBD_DOWN
, BUTTON_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
264 { ACTION_KBD_MORSE_INPUT
, BUTTON_RIGHT
|BUTTON_POWER
, BUTTON_NONE
},
265 { ACTION_KBD_MORSE_SELECT
, BUTTON_SELECT
|BUTTON_REL
, BUTTON_NONE
},
268 }; /* button_context_keyboard */
270 const struct button_mapping
* get_context_mapping(int context
)
275 return button_context_standard
;
277 return button_context_wps
;
280 return button_context_list
;
281 case CONTEXT_MAINMENU
:
283 if (global_settings
.hold_lr_for_scroll_in_list
)
284 return button_context_listtree_scroll_without_combo
;
286 return button_context_listtree_scroll_with_combo
;
287 case CONTEXT_CUSTOM
|CONTEXT_TREE
:
288 return button_context_tree
;
290 case CONTEXT_SETTINGS
:
291 return button_context_settings
;
292 case CONTEXT_CUSTOM
|CONTEXT_SETTINGS
:
293 return button_context_settings_right_is_inc
;
295 case CONTEXT_SETTINGS_COLOURCHOOSER
:
296 return button_context_colorchooser
;
297 case CONTEXT_SETTINGS_EQ
:
298 return button_context_eq
;
300 case CONTEXT_SETTINGS_TIME
:
301 return button_context_time
;
303 case CONTEXT_YESNOSCREEN
:
304 return button_context_yesno
;
305 case CONTEXT_BOOKMARKSCREEN
:
306 return button_context_bmark
;
307 case CONTEXT_QUICKSCREEN
:
308 return button_context_quickscreen
;
309 case CONTEXT_PITCHSCREEN
:
310 return button_context_pitchscreen
;
311 case CONTEXT_KEYBOARD
:
312 return button_context_keyboard
;
314 return button_context_standard
;