Onda VX747: don't enable software volume control in sims
[kugel-rb.git] / apps / keymaps / keymap-yh8xx_yh9xx.c
blob2cb7b4b67af2e1102e4e2fe9b39694eb3a91accc
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id: keymap-h1x0_h3x0.c 17847 2008-06-28 18:10:04Z bagder $
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 samsung yh-820 / yh-920 / yh-925 target */
23 #include <stdio.h>
24 #include <string.h>
25 #include <stdlib.h>
27 #include "config.h"
28 #include "action.h"
29 #include "button.h"
30 #include "settings.h"
32 /*
33 * The format of the list is as follows
34 * { Action Code, Button code, Prereq button code }
35 * if there's no need to check the previous button's value, use BUTTON_NONE
36 * Insert LAST_ITEM_IN_LIST at the end of each mapping
39 /* CONTEXT_CUSTOM's used in this file...
41 CONTEXT_CUSTOM|CONTEXT_TREE = the standard list/tree defines (without directions)
42 CONTEXT_CUSTOM|CONTEXT_SETTINGS = the direction keys for the eq/col picker screens
43 i.e where up/down is inc/dec
44 CONTEXT_SETTINGS = up/down is prev/next, l/r is inc/dec
49 static const struct button_mapping button_context_standard[] = {
50 { ACTION_STD_OK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
51 { ACTION_STD_CANCEL, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
53 { ACTION_STD_PREV, BUTTON_UP, BUTTON_NONE },
54 { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
55 { ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE },
56 { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
58 { ACTION_STD_MENU, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
59 { ACTION_STD_CONTEXT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
60 { ACTION_STD_QUICKSCREEN, BUTTON_FFWD|BUTTON_RIGHT, BUTTON_FFWD },
62 { ACTION_STD_REC, BUTTON_REC|BUTTON_REPEAT, BUTTON_NONE },
64 LAST_ITEM_IN_LIST
65 }; /* 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 },
71 { ACTION_WPS_SKIPNEXT, BUTTON_FFWD|BUTTON_REL, BUTTON_FFWD },
72 { ACTION_WPS_SEEKFWD, BUTTON_FFWD|BUTTON_REPEAT, BUTTON_NONE },
73 { ACTION_WPS_STOPSEEK, BUTTON_FFWD|BUTTON_REL, BUTTON_FFWD|BUTTON_REPEAT },
75 { ACTION_WPS_SKIPPREV, BUTTON_REW|BUTTON_REL, BUTTON_REW },
76 { ACTION_WPS_SEEKBACK, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE },
77 { ACTION_WPS_STOPSEEK, BUTTON_REW|BUTTON_REL, BUTTON_REW|BUTTON_REPEAT },
79 { ACTION_WPS_ABSETB_NEXTDIR,BUTTON_PLAY|BUTTON_RIGHT, BUTTON_PLAY },
80 { ACTION_WPS_ABSETA_PREVDIR,BUTTON_PLAY|BUTTON_LEFT, BUTTON_PLAY },
81 { ACTION_WPS_ABRESET, BUTTON_PLAY|BUTTON_UP, BUTTON_PLAY },
83 { ACTION_WPS_VOLDOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
84 { ACTION_WPS_VOLDOWN, BUTTON_DOWN, BUTTON_NONE },
85 { ACTION_WPS_VOLUP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
86 { ACTION_WPS_VOLUP, BUTTON_UP, BUTTON_NONE },
88 { ACTION_WPS_BROWSE, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
90 /* these match context_standard */
91 { ACTION_WPS_MENU, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
92 { ACTION_WPS_VIEW_PLAYLIST, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
93 { ACTION_WPS_CONTEXT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
94 { ACTION_WPS_QUICKSCREEN, BUTTON_FFWD|BUTTON_RIGHT, BUTTON_FFWD },
96 { ACTION_WPS_REC, BUTTON_REC|BUTTON_REPEAT, BUTTON_NONE },
98 LAST_ITEM_IN_LIST
99 }; /* button_context_wps */
101 static const struct button_mapping button_context_list[] = {
102 #ifdef SAMSUNG_YH820
103 { ACTION_LISTTREE_PGUP, BUTTON_REC|BUTTON_UP, BUTTON_REC },
104 { ACTION_LISTTREE_PGDOWN, BUTTON_REC|BUTTON_DOWN, BUTTON_REC },
105 #else
106 { ACTION_LISTTREE_PGUP, BUTTON_FFWD, BUTTON_NONE },
107 { ACTION_LISTTREE_PGDOWN, BUTTON_REW, BUTTON_NONE },
108 #endif
110 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
111 }; /* button_context_list */
113 static const struct button_mapping button_context_tree[] = {
114 { ACTION_TREE_WPS, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
115 { ACTION_TREE_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
117 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST)
118 }; /* button_context_tree */
120 static const struct button_mapping button_context_listtree_scroll_with_combo[] = {
121 { ACTION_TREE_ROOT_INIT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
123 { ACTION_TREE_PGLEFT, BUTTON_REC|BUTTON_LEFT, BUTTON_REC },
124 { ACTION_TREE_PGLEFT, BUTTON_REC|BUTTON_LEFT|BUTTON_REPEAT,BUTTON_NONE },
126 { ACTION_TREE_PGRIGHT, BUTTON_REC|BUTTON_RIGHT, BUTTON_REC },
127 { ACTION_TREE_PGRIGHT, BUTTON_REC|BUTTON_RIGHT|BUTTON_REPEAT,BUTTON_NONE },
129 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE)
132 static const struct button_mapping button_context_listtree_scroll_without_combo[] = {
133 { ACTION_NONE, BUTTON_LEFT, BUTTON_NONE },
134 { ACTION_STD_CANCEL, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
135 { ACTION_TREE_ROOT_INIT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
137 { ACTION_TREE_PGLEFT, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE },
138 { ACTION_TREE_PGLEFT, BUTTON_REW|BUTTON_REL, BUTTON_REW|BUTTON_REPEAT },
140 { ACTION_TREE_PGRIGHT, BUTTON_FFWD|BUTTON_REPEAT, BUTTON_NONE },
141 { ACTION_TREE_PGRIGHT, BUTTON_FFWD|BUTTON_REL, BUTTON_FFWD|BUTTON_REPEAT },
143 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE)
146 static const struct button_mapping button_context_settings[] = {
147 { ACTION_SETTINGS_INC, BUTTON_UP, BUTTON_NONE },
148 { ACTION_SETTINGS_INCREPEAT,BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
150 { ACTION_SETTINGS_DEC, BUTTON_DOWN, BUTTON_NONE },
151 { ACTION_SETTINGS_DECREPEAT,BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
153 { ACTION_STD_PREV, BUTTON_LEFT, BUTTON_NONE },
154 { ACTION_STD_PREVREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
156 { ACTION_STD_NEXT, BUTTON_RIGHT, BUTTON_NONE },
157 { ACTION_STD_NEXTREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
159 { ACTION_SETTINGS_RESET, BUTTON_PLAY, BUTTON_NONE },
161 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
162 }; /* button_context_settings */
164 static const struct button_mapping button_context_settings_right_is_inc[] = {
165 { ACTION_SETTINGS_INC, BUTTON_RIGHT, BUTTON_NONE },
166 { ACTION_SETTINGS_INCREPEAT,BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
168 { ACTION_SETTINGS_DEC, BUTTON_LEFT, BUTTON_NONE },
169 { ACTION_SETTINGS_DECREPEAT,BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
171 { ACTION_STD_PREV, BUTTON_UP, BUTTON_NONE },
172 { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
174 { ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE },
175 { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
177 { ACTION_SETTINGS_RESET, BUTTON_PLAY, BUTTON_NONE },
179 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
180 }; /* button_context_settingsgraphical */
182 static const struct button_mapping button_context_yesno[] = {
183 { ACTION_YESNO_ACCEPT, BUTTON_RIGHT, BUTTON_NONE },
185 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
186 }; /* button_context_settings_yesno */
188 static const struct button_mapping button_context_colorchooser[] = {
189 { ACTION_STD_OK, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
191 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS)
192 }; /* button_context_settings_colorchooser */
194 static const struct button_mapping button_context_eq[] = {
195 { ACTION_STD_OK, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
197 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS)
198 }; /* button_context_settings_context_eq */
200 static const struct button_mapping button_context_bmark[] = {
201 { ACTION_BMS_DELETE, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
203 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST)
204 }; /* button_context_settings_bmark */
206 static const struct button_mapping button_context_time[] = {
207 { ACTION_STD_OK, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
208 { ACTION_STD_CANCEL, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
210 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
211 }; /* button_context_settings_bmark */
213 static const struct button_mapping button_context_quickscreen[] = {
214 { ACTION_NONE, BUTTON_LEFT, BUTTON_NONE },
215 { ACTION_QS_DOWNINV, BUTTON_UP, BUTTON_NONE },
216 { ACTION_QS_DOWNINV, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
218 { ACTION_QS_DOWN, BUTTON_DOWN|BUTTON_REL, BUTTON_NONE },
219 { ACTION_QS_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
221 { ACTION_QS_LEFT, BUTTON_LEFT|BUTTON_REL, BUTTON_NONE },
222 { ACTION_QS_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
224 { ACTION_QS_RIGHT, BUTTON_RIGHT|BUTTON_REL, BUTTON_NONE },
225 { ACTION_QS_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
227 { ACTION_STD_CANCEL, BUTTON_PLAY, BUTTON_NONE },
228 { ACTION_STD_CANCEL, BUTTON_FFWD, BUTTON_NONE },
230 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
231 }; /* button_context_quickscreen */
233 static const struct button_mapping button_context_pitchscreen[] = {
234 { ACTION_PS_INC_SMALL, BUTTON_UP, BUTTON_NONE },
235 { ACTION_PS_INC_BIG, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
237 { ACTION_PS_DEC_SMALL, BUTTON_DOWN, BUTTON_NONE },
238 { ACTION_PS_DEC_BIG, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
240 { ACTION_PS_NUDGE_LEFT, BUTTON_LEFT, BUTTON_NONE },
241 { ACTION_PS_NUDGE_LEFTOFF, BUTTON_LEFT|BUTTON_REL, BUTTON_NONE },
243 { ACTION_PS_NUDGE_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
244 { ACTION_PS_NUDGE_RIGHTOFF, BUTTON_RIGHT|BUTTON_REL, BUTTON_NONE },
246 { ACTION_PS_TOGGLE_MODE, BUTTON_FFWD, BUTTON_NONE },
247 { ACTION_PS_RESET, BUTTON_REW, BUTTON_NONE },
248 { ACTION_PS_EXIT, BUTTON_PLAY, BUTTON_NONE },
250 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
251 }; /* button_context_pitchcreen */
253 static const struct button_mapping button_context_recscreen[] = {
254 { ACTION_REC_PAUSE, BUTTON_PLAY|BUTTON_REL, BUTTON_NONE },
255 #ifdef SAMSUNG_YH820
256 /* the yh-820 has a rec button */
257 { ACTION_REC_NEWFILE, BUTTON_REC, BUTTON_NONE },
258 #else
259 /* the yh-920 & yh-925 have a rec switch */
260 { ACTION_REC_NEWFILE, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE },
261 #endif
263 { ACTION_SETTINGS_INC, BUTTON_RIGHT, BUTTON_NONE },
264 { ACTION_SETTINGS_INCREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
266 { ACTION_SETTINGS_DEC, BUTTON_LEFT, BUTTON_NONE },
267 { ACTION_SETTINGS_DECREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
269 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
270 }; /* button_context_recscreen */
272 static const struct button_mapping button_context_keyboard[] = {
273 { ACTION_KBD_UP, BUTTON_UP, BUTTON_NONE },
274 { ACTION_KBD_UP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
276 { ACTION_KBD_DOWN, BUTTON_DOWN, BUTTON_NONE },
277 { ACTION_KBD_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
279 { ACTION_KBD_LEFT, BUTTON_LEFT, BUTTON_NONE },
280 { ACTION_KBD_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
282 { ACTION_KBD_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
283 { ACTION_KBD_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
285 { ACTION_KBD_CURSOR_LEFT, BUTTON_REW, BUTTON_NONE },
286 { ACTION_KBD_CURSOR_LEFT, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE },
288 { ACTION_KBD_CURSOR_RIGHT, BUTTON_FFWD, BUTTON_NONE },
289 { ACTION_KBD_CURSOR_RIGHT, BUTTON_FFWD|BUTTON_REPEAT, BUTTON_NONE },
291 { ACTION_KBD_BACKSPACE, BUTTON_LEFT|BUTTON_REW, BUTTON_NONE },
292 { ACTION_KBD_BACKSPACE, BUTTON_LEFT|BUTTON_REW|BUTTON_REPEAT,BUTTON_NONE },
294 { ACTION_KBD_SELECT, BUTTON_PLAY, BUTTON_NONE },
295 { ACTION_KBD_PAGE_FLIP, BUTTON_PLAY|BUTTON_RIGHT, BUTTON_NONE },
297 { ACTION_KBD_DONE, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
298 { ACTION_KBD_ABORT, BUTTON_PLAY|BUTTON_LEFT, BUTTON_PLAY },
300 { ACTION_KBD_MORSE_INPUT, BUTTON_PLAY|BUTTON_FFWD, BUTTON_NONE },
301 { ACTION_KBD_MORSE_SELECT, BUTTON_PLAY|BUTTON_REL, BUTTON_NONE },
303 LAST_ITEM_IN_LIST
304 }; /* button_context_keyboard */
306 const struct button_mapping* get_context_mapping(int context)
308 switch (context)
310 case CONTEXT_STD:
311 return button_context_standard;
312 case CONTEXT_WPS:
313 return button_context_wps;
315 case CONTEXT_LIST:
316 return button_context_list;
317 case CONTEXT_TREE:
318 case CONTEXT_MAINMENU:
319 if (global_settings.hold_lr_for_scroll_in_list)
320 return button_context_listtree_scroll_without_combo;
321 else
322 return button_context_listtree_scroll_with_combo;
323 case CONTEXT_CUSTOM|CONTEXT_TREE:
324 return button_context_tree;
326 case CONTEXT_SETTINGS:
327 return button_context_settings;
328 case CONTEXT_CUSTOM|CONTEXT_SETTINGS:
329 case CONTEXT_SETTINGS_RECTRIGGER:
330 return button_context_settings_right_is_inc;
332 case CONTEXT_SETTINGS_COLOURCHOOSER:
333 return button_context_colorchooser;
334 case CONTEXT_SETTINGS_EQ:
335 return button_context_eq;
337 case CONTEXT_SETTINGS_TIME:
338 return button_context_time;
340 case CONTEXT_YESNOSCREEN:
341 return button_context_yesno;
342 case CONTEXT_BOOKMARKSCREEN:
343 return button_context_bmark;
344 case CONTEXT_QUICKSCREEN:
345 return button_context_quickscreen;
346 case CONTEXT_PITCHSCREEN:
347 return button_context_pitchscreen;
348 case CONTEXT_RECSCREEN:
349 return button_context_recscreen;
350 case CONTEXT_KEYBOARD:
351 return button_context_keyboard;
353 return button_context_standard;