1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2009 by Maurus Cuelenaere
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 the Onda VX747 target */
23 /* NB: Up/Down/Left/Right are not physical buttons - touchscreen emulation */
35 * The format of the list is as follows
36 * { Action Code, Button code, Prereq button code }
37 * if there's no need to check the previous button's value, use BUTTON_NONE
38 * Insert LAST_ITEM_IN_LIST at the end of each mapping
41 static const struct button_mapping button_context_standard
[] = {
42 { ACTION_STD_PREV
, BUTTON_VOL_DOWN
, BUTTON_NONE
},
43 { ACTION_STD_PREVREPEAT
, BUTTON_VOL_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
44 { ACTION_STD_NEXT
, BUTTON_VOL_UP
, BUTTON_NONE
},
45 { ACTION_STD_NEXTREPEAT
, BUTTON_VOL_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
47 { ACTION_STD_OK
, BUTTON_MENU
|BUTTON_REL
, BUTTON_MENU
},
48 { ACTION_STD_CANCEL
, BUTTON_POWER
, BUTTON_NONE
},
50 { ACTION_STD_QUICKSCREEN
, BUTTON_VOL_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
51 { ACTION_STD_CONTEXT
, BUTTON_MENU
|BUTTON_REPEAT
, BUTTON_NONE
},
54 }; /* button_context_standard */
57 static const struct button_mapping button_context_wps
[] = {
59 { ACTION_WPS_VOLDOWN
, BUTTON_VOL_DOWN
, BUTTON_NONE
},
60 { ACTION_WPS_VOLDOWN
, BUTTON_VOL_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
61 { ACTION_WPS_VOLUP
, BUTTON_VOL_UP
, BUTTON_NONE
},
62 { ACTION_WPS_VOLUP
, BUTTON_VOL_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
63 { ACTION_WPS_MENU
, BUTTON_MENU
|BUTTON_REL
, BUTTON_MENU
},
64 { ACTION_WPS_CONTEXT
, BUTTON_MENU
|BUTTON_REPEAT
, BUTTON_MENU
},
66 { ACTION_WPS_MENU
, BUTTON_POWER
, BUTTON_NONE
},
69 }; /* button_context_wps */
71 static const struct button_mapping button_context_list
[] = {
72 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
73 }; /* button_context_list */
75 static const struct button_mapping button_context_tree
[] = {
76 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST
)
77 }; /* button_context_tree */
79 static const struct button_mapping button_context_listtree_scroll_with_combo
[] = {
80 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM
|CONTEXT_TREE
),
83 static const struct button_mapping button_context_listtree_scroll_without_combo
[] = {
84 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM
|CONTEXT_TREE
),
87 static const struct button_mapping button_context_settings
[] = {
88 { ACTION_SETTINGS_INC
, BUTTON_VOL_UP
, BUTTON_NONE
},
89 { ACTION_SETTINGS_INCREPEAT
, BUTTON_VOL_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
90 { ACTION_SETTINGS_DEC
, BUTTON_VOL_DOWN
, BUTTON_NONE
},
91 { ACTION_SETTINGS_DECREPEAT
, BUTTON_VOL_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
92 { ACTION_STD_OK
, BUTTON_MENU
, BUTTON_NONE
},
93 { ACTION_STD_CANCEL
, BUTTON_POWER
, BUTTON_NONE
},
95 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
96 }; /* button_context_settings */
98 static const struct button_mapping button_context_settings_right_is_inc
[] = {
100 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
101 }; /* button_context_settingsgraphical */
103 static const struct button_mapping button_context_yesno
[] = {
104 { ACTION_YESNO_ACCEPT
, BUTTON_MENU
, BUTTON_NONE
},
105 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
106 }; /* button_context_settings_yesno */
108 static const struct button_mapping button_context_colorchooser
[] = {
109 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM
|CONTEXT_SETTINGS
),
110 }; /* button_context_colorchooser */
112 static const struct button_mapping button_context_eq
[] = {
113 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM
|CONTEXT_SETTINGS
),
114 }; /* button_context_eq */
116 /** Bookmark Screen **/
117 static const struct button_mapping button_context_bmark
[] = {
118 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST
),
119 }; /* button_context_bmark */
121 static const struct button_mapping button_context_time
[] = {
122 { ACTION_SETTINGS_INC
, BUTTON_VOL_UP
, BUTTON_NONE
},
123 { ACTION_SETTINGS_INCREPEAT
, BUTTON_VOL_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
124 { ACTION_SETTINGS_DEC
, BUTTON_VOL_DOWN
, BUTTON_NONE
},
125 { ACTION_SETTINGS_DECREPEAT
, BUTTON_VOL_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
126 { ACTION_STD_OK
, BUTTON_MENU
|BUTTON_REL
, BUTTON_MENU
},
127 { ACTION_STD_CANCEL
, BUTTON_POWER
|BUTTON_REL
, BUTTON_POWER
},
128 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS
),
129 }; /* button_context_time */
131 static const struct button_mapping button_context_quickscreen
[] = {
133 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
134 }; /* button_context_quickscreen */
136 static const struct button_mapping button_context_pitchscreen
[] = {
138 { ACTION_PS_INC_SMALL
, BUTTON_VOL_UP
, BUTTON_NONE
},
139 { ACTION_PS_INC_SMALL
, BUTTON_VOL_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
140 { ACTION_PS_DEC_SMALL
, BUTTON_VOL_DOWN
, BUTTON_NONE
},
141 { ACTION_PS_DEC_SMALL
, BUTTON_VOL_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
142 { ACTION_PS_EXIT
, BUTTON_POWER
, BUTTON_NONE
},
143 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
144 }; /* button_context_pitchcreen */
146 /** FM Radio Screen **/
147 static const struct button_mapping button_context_radio
[] = {
148 { ACTION_STD_PREV
, BUTTON_VOL_DOWN
, BUTTON_NONE
},
149 { ACTION_STD_PREVREPEAT
, BUTTON_VOL_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
150 { ACTION_STD_NEXT
, BUTTON_VOL_UP
, BUTTON_NONE
},
151 { ACTION_STD_NEXTREPEAT
, BUTTON_VOL_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
152 { ACTION_FM_MENU
, BUTTON_MENU
|BUTTON_REPEAT
, BUTTON_NONE
},
153 { ACTION_FM_PRESET
, BUTTON_MENU
|BUTTON_REL
, BUTTON_NONE
},
154 { ACTION_FM_MODE
, BUTTON_POWER
|BUTTON_REL
, BUTTON_POWER
},
155 { ACTION_FM_EXIT
, BUTTON_POWER
|BUTTON_REPEAT
, BUTTON_NONE
},
156 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS
)
157 }; /* button_context_radio */
159 static const struct button_mapping button_context_keyboard
[] = {
160 { ACTION_KBD_PAGE_FLIP
, BUTTON_MENU
, BUTTON_NONE
},
161 { ACTION_KBD_CURSOR_LEFT
, BUTTON_VOL_DOWN
, BUTTON_NONE
},
162 { ACTION_KBD_CURSOR_LEFT
, BUTTON_VOL_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
163 { ACTION_KBD_CURSOR_RIGHT
, BUTTON_VOL_UP
, BUTTON_NONE
},
164 { ACTION_KBD_CURSOR_RIGHT
, BUTTON_VOL_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
165 { ACTION_KBD_DONE
, BUTTON_MENU
|BUTTON_REPEAT
, BUTTON_NONE
},
166 { ACTION_KBD_ABORT
, BUTTON_POWER
, BUTTON_NONE
},
168 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD
)
169 }; /* button_context_keyboard */
171 #ifdef USB_ENABLE_HID
172 static const struct button_mapping button_context_usb_hid
[] = {
173 { ACTION_USB_HID_MODE_SWITCH_NEXT
, BUTTON_POWER
|BUTTON_REL
, BUTTON_POWER
},
174 { ACTION_USB_HID_MODE_SWITCH_PREV
, BUTTON_POWER
|BUTTON_REPEAT
, BUTTON_POWER
},
177 }; /* button_context_usb_hid */
179 static const struct button_mapping button_context_usb_hid_mode_multimedia
[] = {
180 { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN
, BUTTON_VOL_DOWN
, BUTTON_NONE
},
181 { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN
, BUTTON_VOL_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
182 { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP
, BUTTON_VOL_UP
, BUTTON_NONE
},
183 { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP
, BUTTON_VOL_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
184 { ACTION_USB_HID_MULTIMEDIA_VOLUME_MUTE
, BUTTON_VOL_DOWN
|BUTTON_VOL_UP
|BUTTON_REPEAT
, BUTTON_VOL_DOWN
|BUTTON_VOL_UP
},
185 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_PLAY_PAUSE
, BUTTON_MENU
|BUTTON_REL
, BUTTON_MENU
},
186 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_TRACK_PREV
, BUTTON_MENU
|BUTTON_LEFT
|BUTTON_REL
, BUTTON_MENU
|BUTTON_LEFT
},
187 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_TRACK_NEXT
, BUTTON_MENU
|BUTTON_RIGHT
|BUTTON_REL
, BUTTON_MENU
|BUTTON_RIGHT
},
189 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID
)
190 }; /* button_context_usb_hid_mode_multimedia */
192 static const struct button_mapping button_context_usb_hid_mode_presentation
[] = {
193 { ACTION_USB_HID_PRESENTATION_SLIDESHOW_START
, BUTTON_MENU
|BUTTON_REL
, BUTTON_MENU
},
194 { ACTION_USB_HID_PRESENTATION_SLIDESHOW_LEAVE
, BUTTON_MENU
|BUTTON_REPEAT
, BUTTON_MENU
},
195 { ACTION_USB_HID_PRESENTATION_SLIDE_PREV
, BUTTON_VOL_DOWN
|BUTTON_REL
, BUTTON_VOL_DOWN
},
196 { ACTION_USB_HID_PRESENTATION_SLIDE_NEXT
, BUTTON_VOL_UP
|BUTTON_REL
, BUTTON_VOL_UP
},
197 { ACTION_USB_HID_PRESENTATION_SLIDE_FIRST
, BUTTON_VOL_DOWN
|BUTTON_REPEAT
, BUTTON_VOL_DOWN
},
198 { ACTION_USB_HID_PRESENTATION_SLIDE_LAST
, BUTTON_VOL_UP
|BUTTON_REPEAT
, BUTTON_VOL_UP
},
199 { ACTION_USB_HID_PRESENTATION_SCREEN_BLACK
, BUTTON_VOL_DOWN
|BUTTON_VOL_UP
|BUTTON_REPEAT
, BUTTON_VOL_DOWN
|BUTTON_VOL_UP
},
201 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID
)
202 }; /* button_context_usb_hid_mode_presentation */
204 static const struct button_mapping button_context_usb_hid_mode_browser
[] = {
205 { ACTION_USB_HID_BROWSER_SCROLL_UP
, BUTTON_VOL_DOWN
, BUTTON_NONE
},
206 { ACTION_USB_HID_BROWSER_SCROLL_UP
, BUTTON_VOL_DOWN
|BUTTON_REPEAT
, BUTTON_NONE
},
207 { ACTION_USB_HID_BROWSER_SCROLL_DOWN
, BUTTON_VOL_UP
, BUTTON_NONE
},
208 { ACTION_USB_HID_BROWSER_SCROLL_DOWN
, BUTTON_VOL_UP
|BUTTON_REPEAT
, BUTTON_NONE
},
209 { ACTION_USB_HID_BROWSER_TAB_PREV
, BUTTON_MENU
|BUTTON_VOL_UP
|BUTTON_REL
, BUTTON_MENU
|BUTTON_VOL_UP
},
210 { ACTION_USB_HID_BROWSER_TAB_NEXT
, BUTTON_MENU
|BUTTON_VOL_DOWN
|BUTTON_REL
, BUTTON_MENU
|BUTTON_VOL_DOWN
},
211 { ACTION_USB_HID_BROWSER_VIEW_FULL_SCREEN
, BUTTON_MENU
|BUTTON_REL
, BUTTON_MENU
},
213 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID
)
214 }; /* button_context_usb_hid_mode_browser */
217 const struct button_mapping
* target_get_context_mapping(int context
)
222 return button_context_standard
;
224 return button_context_wps
;
227 return button_context_list
;
228 case CONTEXT_MAINMENU
:
230 if (global_settings
.hold_lr_for_scroll_in_list
)
231 return button_context_listtree_scroll_without_combo
;
233 return button_context_listtree_scroll_with_combo
;
234 case CONTEXT_CUSTOM
|CONTEXT_TREE
:
235 return button_context_tree
;
237 case CONTEXT_SETTINGS
:
238 return button_context_settings
;
239 case CONTEXT_CUSTOM
|CONTEXT_SETTINGS
:
240 case CONTEXT_SETTINGS_RECTRIGGER
:
241 return button_context_settings_right_is_inc
;
243 case CONTEXT_SETTINGS_COLOURCHOOSER
:
244 return button_context_colorchooser
;
245 case CONTEXT_SETTINGS_EQ
:
246 return button_context_eq
;
248 case CONTEXT_SETTINGS_TIME
:
249 return button_context_time
;
251 case CONTEXT_YESNOSCREEN
:
252 return button_context_yesno
;
254 return button_context_radio
;
255 case CONTEXT_BOOKMARKSCREEN
:
256 return button_context_bmark
;
257 case CONTEXT_QUICKSCREEN
:
258 return button_context_quickscreen
;
259 case CONTEXT_PITCHSCREEN
:
260 return button_context_pitchscreen
;
261 case CONTEXT_KEYBOARD
:
262 return button_context_keyboard
;
263 #ifdef USB_ENABLE_HID
264 case CONTEXT_USB_HID
:
265 return button_context_usb_hid
;
266 case CONTEXT_USB_HID_MODE_MULTIMEDIA
:
267 return button_context_usb_hid_mode_multimedia
;
268 case CONTEXT_USB_HID_MODE_PRESENTATION
:
269 return button_context_usb_hid_mode_presentation
;
270 case CONTEXT_USB_HID_MODE_BROWSER
:
271 return button_context_usb_hid_mode_browser
;
274 return button_context_standard
;