Use DBOP to check for left button on C200v2 like we are supposed to instead of right...
[kugel-rb.git] / apps / keymaps / keymap-yh8xx_yh9xx.c
blob0bc197b9deff723279c667fe514c8044aab99838
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_NONE },
52 { ACTION_STD_CANCEL, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
54 { ACTION_STD_PREV, BUTTON_UP, BUTTON_NONE },
55 { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
56 { ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE },
57 { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
59 { ACTION_STD_CONTEXT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
60 /* kludge: pressing 2 directional buttons is easy on this target */
61 { ACTION_STD_QUICKSCREEN, BUTTON_LEFT|BUTTON_DOWN|BUTTON_REPEAT,
62 BUTTON_LEFT|BUTTON_DOWN|BUTTON_REPEAT },
64 { ACTION_STD_REC, BUTTON_REC|BUTTON_REPEAT, BUTTON_NONE },
66 LAST_ITEM_IN_LIST
67 }; /* button_context_standard */
69 static const struct button_mapping button_context_wps[] = {
70 { ACTION_WPS_PLAY, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
71 { ACTION_WPS_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
73 { ACTION_WPS_SKIPNEXT, BUTTON_FFWD|BUTTON_REL, BUTTON_FFWD },
74 { ACTION_WPS_SEEKFWD, BUTTON_FFWD|BUTTON_REPEAT, BUTTON_NONE },
75 { ACTION_WPS_STOPSEEK, BUTTON_FFWD|BUTTON_REL, BUTTON_FFWD|BUTTON_REPEAT },
77 { ACTION_WPS_SKIPPREV, BUTTON_REW|BUTTON_REL, BUTTON_REW },
78 { ACTION_WPS_SEEKBACK, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE },
79 { ACTION_WPS_STOPSEEK, BUTTON_REW|BUTTON_REL, BUTTON_REW|BUTTON_REPEAT },
81 { ACTION_WPS_ABSETB_NEXTDIR,BUTTON_PLAY|BUTTON_RIGHT, BUTTON_PLAY },
82 { ACTION_WPS_ABSETA_PREVDIR,BUTTON_PLAY|BUTTON_LEFT, BUTTON_PLAY },
83 { ACTION_WPS_ABRESET, BUTTON_PLAY|BUTTON_UP, BUTTON_PLAY },
85 { ACTION_WPS_VOLDOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
86 { ACTION_WPS_VOLDOWN, BUTTON_DOWN|BUTTON_REL, BUTTON_NONE },
87 { ACTION_WPS_VOLUP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
88 { ACTION_WPS_VOLUP, BUTTON_UP, BUTTON_NONE },
90 { ACTION_WPS_BROWSE, BUTTON_RIGHT|BUTTON_REL, BUTTON_NONE },
92 /* these match context_standard */
93 { ACTION_WPS_MENU, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
94 { ACTION_WPS_CONTEXT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT },
95 /* kludge: pressing 2 directional buttons is easy on this target */
96 { ACTION_WPS_QUICKSCREEN, BUTTON_LEFT|BUTTON_DOWN|BUTTON_REPEAT,
97 BUTTON_LEFT|BUTTON_DOWN|BUTTON_REPEAT },
99 { ACTION_WPS_HOTKEY, BUTTON_REC|BUTTON_REL, BUTTON_REC },
100 { ACTION_WPS_VIEW_PLAYLIST, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
101 { ACTION_WPS_REC, BUTTON_REC|BUTTON_REPEAT, BUTTON_NONE },
103 LAST_ITEM_IN_LIST
104 }; /* button_context_wps */
106 static const struct button_mapping button_context_list[] = {
107 #ifdef SAMSUNG_YH820
108 { ACTION_LISTTREE_PGUP, BUTTON_REC|BUTTON_UP, BUTTON_REC },
109 { ACTION_LISTTREE_PGDOWN, BUTTON_REC|BUTTON_DOWN, BUTTON_REC },
110 #else
111 { ACTION_LISTTREE_PGUP, BUTTON_FFWD, BUTTON_NONE },
112 { ACTION_LISTTREE_PGDOWN, BUTTON_REW, BUTTON_NONE },
113 #endif
115 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
116 }; /* button_context_list */
118 static const struct button_mapping button_context_tree[] = {
119 { ACTION_TREE_WPS, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
120 { ACTION_TREE_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
121 { ACTION_TREE_HOTKEY, BUTTON_REC|BUTTON_REL, BUTTON_REC },
123 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST)
124 }; /* button_context_tree */
126 static const struct button_mapping button_context_listtree_scroll_with_combo[] = {
127 { ACTION_TREE_ROOT_INIT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
129 { ACTION_TREE_PGLEFT, BUTTON_REC|BUTTON_LEFT, BUTTON_REC },
130 { ACTION_TREE_PGLEFT, BUTTON_REC|BUTTON_LEFT|BUTTON_REPEAT,BUTTON_NONE },
132 { ACTION_TREE_PGRIGHT, BUTTON_REC|BUTTON_RIGHT, BUTTON_REC },
133 { ACTION_TREE_PGRIGHT, BUTTON_REC|BUTTON_RIGHT|BUTTON_REPEAT,BUTTON_NONE },
135 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE)
138 static const struct button_mapping button_context_listtree_scroll_without_combo[] = {
139 { ACTION_NONE, BUTTON_LEFT, BUTTON_NONE },
140 { ACTION_STD_CANCEL, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
141 { ACTION_TREE_ROOT_INIT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
143 { ACTION_TREE_PGLEFT, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE },
144 { ACTION_TREE_PGLEFT, BUTTON_REW|BUTTON_REL, BUTTON_REW|BUTTON_REPEAT },
146 { ACTION_TREE_PGRIGHT, BUTTON_FFWD|BUTTON_REPEAT, BUTTON_NONE },
147 { ACTION_TREE_PGRIGHT, BUTTON_FFWD|BUTTON_REL, BUTTON_FFWD|BUTTON_REPEAT },
149 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE)
152 static const struct button_mapping button_context_settings[] = {
153 { ACTION_SETTINGS_INC, BUTTON_UP, BUTTON_NONE },
154 { ACTION_SETTINGS_INCREPEAT,BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
156 { ACTION_SETTINGS_DEC, BUTTON_DOWN, BUTTON_NONE },
157 { ACTION_SETTINGS_DECREPEAT,BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
159 { ACTION_NONE, BUTTON_LEFT, BUTTON_NONE },
160 { ACTION_STD_PREV, BUTTON_LEFT|BUTTON_REL, BUTTON_NONE },
161 { ACTION_STD_PREVREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
163 { ACTION_STD_NEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_NONE },
164 { ACTION_STD_NEXTREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
166 { ACTION_SETTINGS_RESET, BUTTON_PLAY, BUTTON_NONE },
168 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
169 }; /* button_context_settings */
171 static const struct button_mapping button_context_settings_right_is_inc[] = {
172 { ACTION_SETTINGS_INC, BUTTON_RIGHT, BUTTON_NONE },
173 { ACTION_SETTINGS_INCREPEAT,BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
175 { ACTION_SETTINGS_DEC, BUTTON_LEFT, BUTTON_NONE },
176 { ACTION_SETTINGS_DECREPEAT,BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
178 { ACTION_STD_PREV, BUTTON_UP, BUTTON_NONE },
179 { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
181 { ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE },
182 { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
184 { ACTION_SETTINGS_RESET, BUTTON_PLAY, BUTTON_NONE },
186 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
187 }; /* button_context_settingsgraphical */
189 static const struct button_mapping button_context_yesno[] = {
190 { ACTION_YESNO_ACCEPT, BUTTON_RIGHT, BUTTON_NONE },
192 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
193 }; /* button_context_settings_yesno */
195 static const struct button_mapping button_context_colorchooser[] = {
196 { ACTION_STD_OK, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
198 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS)
199 }; /* button_context_settings_colorchooser */
201 static const struct button_mapping button_context_eq[] = {
202 { ACTION_STD_OK, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
204 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS)
205 }; /* button_context_settings_context_eq */
207 static const struct button_mapping button_context_bmark[] = {
208 { ACTION_BMS_DELETE, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
210 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST)
211 }; /* button_context_settings_bmark */
213 static const struct button_mapping button_context_time[] = {
214 { ACTION_STD_OK, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
215 { ACTION_STD_CANCEL, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
217 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
218 }; /* button_context_settings_bmark */
220 static const struct button_mapping button_context_quickscreen[] = {
221 { ACTION_NONE, BUTTON_LEFT, BUTTON_NONE },
222 { ACTION_NONE, BUTTON_LEFT|BUTTON_DOWN|BUTTON_REL,BUTTON_NONE },
224 { ACTION_QS_TOP, BUTTON_UP|BUTTON_REL, BUTTON_UP },
225 { ACTION_QS_TOP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
227 { ACTION_QS_DOWN, BUTTON_DOWN|BUTTON_REL, BUTTON_DOWN },
228 { ACTION_QS_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
230 { ACTION_QS_LEFT, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
231 { ACTION_QS_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
233 { ACTION_QS_RIGHT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
234 { ACTION_QS_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
236 { ACTION_STD_CANCEL, BUTTON_PLAY, BUTTON_NONE },
237 { ACTION_STD_CANCEL, BUTTON_FFWD, BUTTON_NONE },
239 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
240 }; /* button_context_quickscreen */
242 static const struct button_mapping button_context_pitchscreen[] = {
243 { ACTION_PS_INC_SMALL, BUTTON_UP, BUTTON_NONE },
244 { ACTION_PS_INC_BIG, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
246 { ACTION_PS_DEC_SMALL, BUTTON_DOWN, BUTTON_NONE },
247 { ACTION_PS_DEC_BIG, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
249 { ACTION_PS_NUDGE_LEFT, BUTTON_LEFT, BUTTON_NONE },
250 { ACTION_PS_NUDGE_LEFTOFF, BUTTON_LEFT|BUTTON_REL, BUTTON_NONE },
252 { ACTION_PS_NUDGE_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
253 { ACTION_PS_NUDGE_RIGHTOFF, BUTTON_RIGHT|BUTTON_REL, BUTTON_NONE },
255 { ACTION_PS_TOGGLE_MODE, BUTTON_FFWD, BUTTON_NONE },
256 { ACTION_PS_RESET, BUTTON_REW, BUTTON_NONE },
257 { ACTION_PS_EXIT, BUTTON_PLAY, BUTTON_NONE },
259 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
260 }; /* button_context_pitchcreen */
262 static const struct button_mapping button_context_recscreen[] = {
263 { ACTION_REC_PAUSE, BUTTON_PLAY|BUTTON_REL, BUTTON_NONE },
264 #ifdef SAMSUNG_YH820
265 /* the yh-820 has a rec button */
266 { ACTION_REC_NEWFILE, BUTTON_REC, BUTTON_NONE },
267 #else
268 /* the yh-920 & yh-925 have a rec switch */
269 { ACTION_REC_NEWFILE, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE },
270 #endif
272 { ACTION_SETTINGS_INC, BUTTON_RIGHT, BUTTON_NONE },
273 { ACTION_SETTINGS_INCREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
275 { ACTION_SETTINGS_DEC, BUTTON_LEFT, BUTTON_NONE },
276 { ACTION_SETTINGS_DECREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
278 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
279 }; /* button_context_recscreen */
281 static const struct button_mapping button_context_keyboard[] = {
282 { ACTION_KBD_UP, BUTTON_UP, BUTTON_NONE },
283 { ACTION_KBD_UP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
285 { ACTION_KBD_DOWN, BUTTON_DOWN, BUTTON_NONE },
286 { ACTION_KBD_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
288 { ACTION_KBD_LEFT, BUTTON_LEFT, BUTTON_NONE },
289 { ACTION_KBD_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
291 { ACTION_KBD_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
292 { ACTION_KBD_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
294 { ACTION_KBD_CURSOR_LEFT, BUTTON_REW|BUTTON_REL, BUTTON_FFWD },
295 { ACTION_KBD_CURSOR_LEFT, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE },
297 { ACTION_KBD_CURSOR_RIGHT, BUTTON_FFWD|BUTTON_REL, BUTTON_FFWD },
298 { ACTION_KBD_CURSOR_RIGHT, BUTTON_FFWD|BUTTON_REPEAT, BUTTON_NONE },
300 { ACTION_KBD_SELECT, BUTTON_PLAY|BUTTON_REL, BUTTON_NONE },
301 { ACTION_KBD_PAGE_FLIP, BUTTON_PLAY|BUTTON_RIGHT, BUTTON_NONE },
303 { ACTION_KBD_DONE, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE },
304 { ACTION_KBD_ABORT, BUTTON_FFWD|BUTTON_PLAY, BUTTON_FFWD },
305 { ACTION_KBD_ABORT, BUTTON_FFWD|BUTTON_REW, BUTTON_FFWD },
307 LAST_ITEM_IN_LIST
308 }; /* button_context_keyboard */
310 const struct button_mapping* get_context_mapping(int context)
312 switch (context)
314 case CONTEXT_STD:
315 return button_context_standard;
316 case CONTEXT_WPS:
317 return button_context_wps;
319 case CONTEXT_LIST:
320 return button_context_list;
321 case CONTEXT_TREE:
322 case CONTEXT_MAINMENU:
323 if (global_settings.hold_lr_for_scroll_in_list)
324 return button_context_listtree_scroll_without_combo;
325 else
326 return button_context_listtree_scroll_with_combo;
327 case CONTEXT_CUSTOM|CONTEXT_TREE:
328 return button_context_tree;
330 case CONTEXT_SETTINGS:
331 return button_context_settings;
332 case CONTEXT_CUSTOM|CONTEXT_SETTINGS:
333 case CONTEXT_SETTINGS_RECTRIGGER:
334 return button_context_settings_right_is_inc;
336 case CONTEXT_SETTINGS_COLOURCHOOSER:
337 return button_context_colorchooser;
338 case CONTEXT_SETTINGS_EQ:
339 return button_context_eq;
341 case CONTEXT_SETTINGS_TIME:
342 return button_context_time;
344 case CONTEXT_YESNOSCREEN:
345 return button_context_yesno;
346 case CONTEXT_BOOKMARKSCREEN:
347 return button_context_bmark;
348 case CONTEXT_QUICKSCREEN:
349 return button_context_quickscreen;
350 case CONTEXT_PITCHSCREEN:
351 return button_context_pitchscreen;
352 case CONTEXT_RECSCREEN:
353 return button_context_recscreen;
354 case CONTEXT_KEYBOARD:
355 return button_context_keyboard;
357 return button_context_standard;