summaryrefslogtreecommitdiff
path: root/apps/keymaps
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2021-04-21 01:47:02 +0100
committerAidan MacDonald <amachronic@protonmail.com>2021-04-21 18:31:55 +0000
commit75cb8ba8a4c3b5f2a5bd7195ef3d61089151a6f5 (patch)
treec528789d595a3f410baaa595229094932c05d7ff /apps/keymaps
parent088ebb5fac02932178fe0da31dd8966472225bdf (diff)
downloadrockbox-75cb8ba8a4c3b5f2a5bd7195ef3d61089151a6f5.tar.gz
rockbox-75cb8ba8a4c3b5f2a5bd7195ef3d61089151a6f5.zip
FiiO M3K/X1000: add USB support
This only required a minor patch to the usb-designware driver due to DMA requiring physical addresses -- on the X1000, these differ from virtual addresses so we have to do the usual conversion. Both the mass storage and HID drivers work, but there are a few issues so this can't be considered 100% stable yet. - Mass storage might not be detected properly on insertion, and USB has to be replugged before it shows up - HID driver may occasionally panic or hang the machine Change-Id: Ia3ce7591d5928ec7cbca7953abfef01bdbd873ef
Diffstat (limited to 'apps/keymaps')
-rw-r--r--apps/keymaps/keymap-fiiom3k.c63
1 files changed, 63 insertions, 0 deletions
diff --git a/apps/keymaps/keymap-fiiom3k.c b/apps/keymaps/keymap-fiiom3k.c
index e562443227..440f851650 100644
--- a/apps/keymaps/keymap-fiiom3k.c
+++ b/apps/keymaps/keymap-fiiom3k.c
@@ -185,6 +185,61 @@ static const struct button_mapping button_context_keyboard[] = {
185 LAST_ITEM_IN_LIST 185 LAST_ITEM_IN_LIST
186}; /* button_context_keyboard */ 186}; /* button_context_keyboard */
187 187
188static const struct button_mapping button_context_usb_hid[] = {
189 {ACTION_USB_HID_MODE_SWITCH_NEXT, BUTTON_POWER, BUTTON_NONE},
190 LAST_ITEM_IN_LIST,
191}; /* button_context_usb_hid */
192
193static const struct button_mapping button_context_usb_hid_mode_multimedia[] = {
194 {ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_VOL_UP, BUTTON_NONE},
195 {ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE},
196 {ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_VOL_DOWN, BUTTON_NONE},
197 {ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE},
198 {ACTION_USB_HID_MULTIMEDIA_VOLUME_MUTE, BUTTON_VOL_DOWN|BUTTON_PLAY, BUTTON_NONE},
199 {ACTION_USB_HID_MULTIMEDIA_PLAYBACK_PLAY_PAUSE, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY},
200 {ACTION_USB_HID_MULTIMEDIA_PLAYBACK_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY},
201 {ACTION_USB_HID_MULTIMEDIA_PLAYBACK_TRACK_PREV, BUTTON_LEFT, BUTTON_NONE},
202 {ACTION_USB_HID_MULTIMEDIA_PLAYBACK_TRACK_NEXT, BUTTON_RIGHT, BUTTON_NONE},
203 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
204}; /* button_context_usb_hid_mode_multimedia */
205
206static const struct button_mapping button_context_usb_hid_mode_presentation[] = {
207 {ACTION_USB_HID_PRESENTATION_SLIDESHOW_START, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY},
208 {ACTION_USB_HID_PRESENTATION_SLIDESHOW_LEAVE, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY},
209 {ACTION_USB_HID_PRESENTATION_SLIDE_PREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT},
210 {ACTION_USB_HID_PRESENTATION_SLIDE_NEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT},
211 {ACTION_USB_HID_PRESENTATION_SLIDE_FIRST, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT},
212 {ACTION_USB_HID_PRESENTATION_SLIDE_LAST, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT},
213 {ACTION_USB_HID_PRESENTATION_SCREEN_BLACK, BUTTON_VOL_UP, BUTTON_NONE},
214 {ACTION_USB_HID_PRESENTATION_SCREEN_WHITE, BUTTON_VOL_DOWN, BUTTON_NONE},
215 {ACTION_USB_HID_PRESENTATION_LINK_PREV, BUTTON_MENU, BUTTON_NONE},
216 {ACTION_USB_HID_PRESENTATION_LINK_NEXT, BUTTON_BACK, BUTTON_NONE},
217 {ACTION_USB_HID_PRESENTATION_MOUSE_CLICK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT},
218 {ACTION_USB_HID_PRESENTATION_MOUSE_OVER, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT},
219 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
220}; /* button_context_usb_hid_mode_presentation */
221
222static const struct button_mapping button_context_usb_hid_mode_browser[] = {
223 {ACTION_USB_HID_BROWSER_SCROLL_UP, BUTTON_SCROLL_BACK, BUTTON_NONE},
224 {ACTION_USB_HID_BROWSER_SCROLL_UP, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE},
225 {ACTION_USB_HID_BROWSER_SCROLL_DOWN, BUTTON_SCROLL_FWD, BUTTON_NONE},
226 {ACTION_USB_HID_BROWSER_SCROLL_DOWN, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE},
227 {ACTION_USB_HID_BROWSER_SCROLL_PAGE_DOWN, BUTTON_DOWN, BUTTON_NONE},
228 {ACTION_USB_HID_BROWSER_SCROLL_PAGE_UP, BUTTON_UP, BUTTON_NONE},
229 {ACTION_USB_HID_BROWSER_SCROLL_PAGE_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE},
230 {ACTION_USB_HID_BROWSER_SCROLL_PAGE_UP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE},
231 {ACTION_USB_HID_BROWSER_ZOOM_IN, BUTTON_VOL_UP, BUTTON_NONE},
232 {ACTION_USB_HID_BROWSER_ZOOM_OUT, BUTTON_VOL_DOWN, BUTTON_NONE},
233 {ACTION_USB_HID_BROWSER_ZOOM_RESET, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY},
234 {ACTION_USB_HID_BROWSER_TAB_PREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT},
235 {ACTION_USB_HID_BROWSER_TAB_NEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT},
236 {ACTION_USB_HID_BROWSER_TAB_CLOSE, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT},
237 {ACTION_USB_HID_BROWSER_HISTORY_BACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT},
238 {ACTION_USB_HID_BROWSER_HISTORY_FORWARD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT},
239 {ACTION_USB_HID_BROWSER_VIEW_FULL_SCREEN, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY},
240 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
241}; /* button_context_usb_hid_mode_browser */
242
188const struct button_mapping* get_context_mapping(int context) 243const struct button_mapping* get_context_mapping(int context)
189{ 244{
190 switch (context) 245 switch (context)
@@ -215,5 +270,13 @@ const struct button_mapping* get_context_mapping(int context)
215 return button_context_yesnoscreen; 270 return button_context_yesnoscreen;
216 case CONTEXT_KEYBOARD: 271 case CONTEXT_KEYBOARD:
217 return button_context_keyboard; 272 return button_context_keyboard;
273 case CONTEXT_USB_HID:
274 return button_context_usb_hid;
275 case CONTEXT_USB_HID_MODE_MULTIMEDIA:
276 return button_context_usb_hid_mode_multimedia;
277 case CONTEXT_USB_HID_MODE_PRESENTATION:
278 return button_context_usb_hid_mode_presentation;
279 case CONTEXT_USB_HID_MODE_BROWSER:
280 return button_context_usb_hid_mode_browser;
218 } 281 }
219} 282}