diff options
-rw-r--r-- | apps/action.h | 10 | ||||
-rw-r--r-- | apps/keymaps/keymap-c100.c | 18 | ||||
-rw-r--r-- | apps/keymaps/keymap-c200.c | 22 | ||||
-rw-r--r-- | apps/keymaps/keymap-clip.c | 22 | ||||
-rw-r--r-- | apps/keymaps/keymap-e200.c | 22 | ||||
-rw-r--r-- | apps/keymaps/keymap-gigabeat-s.c | 44 | ||||
-rw-r--r-- | apps/keymaps/keymap-h10.c | 63 | ||||
-rw-r--r-- | apps/keymaps/keymap-hdd1630.c | 25 | ||||
-rw-r--r-- | apps/keymaps/keymap-ipod.c | 40 | ||||
-rw-r--r-- | apps/keymaps/keymap-mr100.c | 39 | ||||
-rw-r--r-- | apps/keymaps/keymap-ondavx747.c | 17 | ||||
-rw-r--r-- | apps/keymaps/keymap-sa9200.c | 25 | ||||
-rw-r--r-- | apps/keymaps/keymap-touchscreen.c | 16 | ||||
-rw-r--r-- | apps/screens.c | 70 |
14 files changed, 422 insertions, 11 deletions
diff --git a/apps/action.h b/apps/action.h index bd215debb8..9869fb30b1 100644 --- a/apps/action.h +++ b/apps/action.h | |||
@@ -74,6 +74,7 @@ enum { | |||
74 | CONTEXT_RECSCREEN, | 74 | CONTEXT_RECSCREEN, |
75 | CONTEXT_KEYBOARD, | 75 | CONTEXT_KEYBOARD, |
76 | CONTEXT_FM, | 76 | CONTEXT_FM, |
77 | CONTEXT_USB_HID, | ||
77 | }; | 78 | }; |
78 | 79 | ||
79 | 80 | ||
@@ -237,6 +238,15 @@ enum { | |||
237 | ACTION_TOUCH_REPMODE, | 238 | ACTION_TOUCH_REPMODE, |
238 | #endif | 239 | #endif |
239 | 240 | ||
241 | /* USB HID codes */ | ||
242 | ACTION_USB_HID_PLAY, | ||
243 | ACTION_USB_HID_STOP, | ||
244 | ACTION_USB_HID_SKIPPREV, | ||
245 | ACTION_USB_HID_SKIPNEXT, | ||
246 | ACTION_USB_HID_VOLDOWN, | ||
247 | ACTION_USB_HID_VOLUP, | ||
248 | ACTION_USB_HID_MUTE, | ||
249 | ACTION_USB_HID_MENU, | ||
240 | 250 | ||
241 | LAST_ACTION_PLACEHOLDER, /* custom actions should be this + something */ | 251 | LAST_ACTION_PLACEHOLDER, /* custom actions should be this + something */ |
242 | }; | 252 | }; |
diff --git a/apps/keymaps/keymap-c100.c b/apps/keymaps/keymap-c100.c index 70cb17ae1a..087be8665f 100644 --- a/apps/keymaps/keymap-c100.c +++ b/apps/keymaps/keymap-c100.c | |||
@@ -269,6 +269,19 @@ static const struct button_mapping button_context_bmark[] = { | |||
269 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST), | 269 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST), |
270 | }; /* button_context_bmark */ | 270 | }; /* button_context_bmark */ |
271 | 271 | ||
272 | #ifdef HAVE_USBSTACK | ||
273 | static const struct button_mapping button_context_usb_hid[] = { | ||
274 | { ACTION_USB_HID_PLAY, BUTTON_VOLUP, BUTTON_NONE }, | ||
275 | { ACTION_USB_HID_STOP, BUTTON_VOLUP|BUTTON_REPEAT, BUTTON_NONE }, | ||
276 | { ACTION_USB_HID_SKIPPREV, BUTTON_LEFT, BUTTON_NONE }, | ||
277 | { ACTION_USB_HID_SKIPNEXT, BUTTON_RIGHT, BUTTON_NONE }, | ||
278 | { ACTION_USB_HID_MUTE, BUTTON_VOLDOWN, BUTTON_NONE }, | ||
279 | { ACTION_USB_HID_MENU, BUTTON_MENU, BUTTON_NONE }, | ||
280 | |||
281 | LAST_ITEM_IN_LIST | ||
282 | }; /* button_context_usb_hid */ | ||
283 | #endif | ||
284 | |||
272 | /* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */ | 285 | /* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */ |
273 | const struct button_mapping* get_context_mapping(int context) | 286 | const struct button_mapping* get_context_mapping(int context) |
274 | { | 287 | { |
@@ -317,7 +330,10 @@ const struct button_mapping* get_context_mapping(int context) | |||
317 | #endif | 330 | #endif |
318 | case CONTEXT_KEYBOARD: | 331 | case CONTEXT_KEYBOARD: |
319 | return button_context_keyboard; | 332 | return button_context_keyboard; |
320 | 333 | #ifdef HAVE_USBSTACK | |
334 | case CONTEXT_USB_HID: | ||
335 | return button_context_usb_hid; | ||
336 | #endif | ||
321 | default: | 337 | default: |
322 | return button_context_standard; | 338 | return button_context_standard; |
323 | } | 339 | } |
diff --git a/apps/keymaps/keymap-c200.c b/apps/keymaps/keymap-c200.c index 430ca50e59..56504584f8 100644 --- a/apps/keymaps/keymap-c200.c +++ b/apps/keymaps/keymap-c200.c | |||
@@ -281,6 +281,23 @@ static const struct button_mapping button_context_bmark[] = { | |||
281 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST), | 281 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST), |
282 | }; /* button_context_bmark */ | 282 | }; /* button_context_bmark */ |
283 | 283 | ||
284 | #ifdef HAVE_USBSTACK | ||
285 | static const struct button_mapping button_context_usb_hid[] = { | ||
286 | { ACTION_USB_HID_PLAY, BUTTON_UP, BUTTON_NONE }, | ||
287 | { ACTION_USB_HID_STOP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, | ||
288 | { ACTION_USB_HID_SKIPPREV, BUTTON_LEFT, BUTTON_NONE }, | ||
289 | { ACTION_USB_HID_SKIPNEXT, BUTTON_RIGHT, BUTTON_NONE }, | ||
290 | { ACTION_USB_HID_VOLUP, BUTTON_VOL_UP, BUTTON_NONE }, | ||
291 | { ACTION_USB_HID_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, | ||
292 | { ACTION_USB_HID_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE }, | ||
293 | { ACTION_USB_HID_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, | ||
294 | { ACTION_USB_HID_MUTE, BUTTON_DOWN, BUTTON_NONE }, | ||
295 | { ACTION_USB_HID_MENU, BUTTON_POWER, BUTTON_NONE }, | ||
296 | |||
297 | LAST_ITEM_IN_LIST | ||
298 | }; /* button_context_usb_hid */ | ||
299 | #endif | ||
300 | |||
284 | /* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */ | 301 | /* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */ |
285 | const struct button_mapping* get_context_mapping(int context) | 302 | const struct button_mapping* get_context_mapping(int context) |
286 | { | 303 | { |
@@ -330,7 +347,10 @@ const struct button_mapping* get_context_mapping(int context) | |||
330 | #endif | 347 | #endif |
331 | case CONTEXT_KEYBOARD: | 348 | case CONTEXT_KEYBOARD: |
332 | return button_context_keyboard; | 349 | return button_context_keyboard; |
333 | 350 | #ifdef HAVE_USBSTACK | |
351 | case CONTEXT_USB_HID: | ||
352 | return button_context_usb_hid; | ||
353 | #endif | ||
334 | default: | 354 | default: |
335 | return button_context_standard; | 355 | return button_context_standard; |
336 | } | 356 | } |
diff --git a/apps/keymaps/keymap-clip.c b/apps/keymaps/keymap-clip.c index e1d31cb398..4b778beeb7 100644 --- a/apps/keymaps/keymap-clip.c +++ b/apps/keymaps/keymap-clip.c | |||
@@ -265,6 +265,23 @@ static const struct button_mapping button_context_bmark[] = { | |||
265 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST), | 265 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST), |
266 | }; /* button_context_bmark */ | 266 | }; /* button_context_bmark */ |
267 | 267 | ||
268 | #ifdef HAVE_USBSTACK | ||
269 | static const struct button_mapping button_context_usb_hid[] = { | ||
270 | { ACTION_USB_HID_PLAY, BUTTON_UP, BUTTON_NONE }, | ||
271 | { ACTION_USB_HID_STOP, BUTTON_POWER, BUTTON_NONE }, | ||
272 | { ACTION_USB_HID_SKIPPREV, BUTTON_LEFT, BUTTON_NONE }, | ||
273 | { ACTION_USB_HID_SKIPNEXT, BUTTON_RIGHT, BUTTON_NONE }, | ||
274 | { ACTION_USB_HID_VOLUP, BUTTON_VOL_UP, BUTTON_NONE }, | ||
275 | { ACTION_USB_HID_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, | ||
276 | { ACTION_USB_HID_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE }, | ||
277 | { ACTION_USB_HID_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, | ||
278 | { ACTION_USB_HID_MUTE, BUTTON_SELECT, BUTTON_NONE }, | ||
279 | { ACTION_USB_HID_MENU, BUTTON_DOWN, BUTTON_NONE }, | ||
280 | |||
281 | LAST_ITEM_IN_LIST | ||
282 | }; /* button_context_usb_hid */ | ||
283 | #endif | ||
284 | |||
268 | /* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */ | 285 | /* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */ |
269 | const struct button_mapping* get_context_mapping(int context) | 286 | const struct button_mapping* get_context_mapping(int context) |
270 | { | 287 | { |
@@ -310,7 +327,10 @@ const struct button_mapping* get_context_mapping(int context) | |||
310 | return button_context_recscreen; | 327 | return button_context_recscreen; |
311 | case CONTEXT_KEYBOARD: | 328 | case CONTEXT_KEYBOARD: |
312 | return button_context_keyboard; | 329 | return button_context_keyboard; |
313 | 330 | #ifdef HAVE_USBSTACK | |
331 | case CONTEXT_USB_HID: | ||
332 | return button_context_usb_hid; | ||
333 | #endif | ||
314 | default: | 334 | default: |
315 | return button_context_standard; | 335 | return button_context_standard; |
316 | } | 336 | } |
diff --git a/apps/keymaps/keymap-e200.c b/apps/keymaps/keymap-e200.c index c94ae03802..a2017de6f3 100644 --- a/apps/keymaps/keymap-e200.c +++ b/apps/keymaps/keymap-e200.c | |||
@@ -271,6 +271,23 @@ static const struct button_mapping button_context_bmark[] = { | |||
271 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST), | 271 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST), |
272 | }; /* button_context_bmark */ | 272 | }; /* button_context_bmark */ |
273 | 273 | ||
274 | #ifdef HAVE_USBSTACK | ||
275 | static const struct button_mapping button_context_usb_hid[] = { | ||
276 | { ACTION_USB_HID_PLAY, BUTTON_UP, BUTTON_NONE }, | ||
277 | { ACTION_USB_HID_STOP, BUTTON_POWER, BUTTON_NONE }, | ||
278 | { ACTION_USB_HID_SKIPPREV, BUTTON_LEFT, BUTTON_NONE }, | ||
279 | { ACTION_USB_HID_SKIPNEXT, BUTTON_RIGHT, BUTTON_NONE }, | ||
280 | { ACTION_USB_HID_VOLUP, BUTTON_SCROLL_FWD, BUTTON_NONE }, | ||
281 | { ACTION_USB_HID_VOLUP, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE }, | ||
282 | { ACTION_USB_HID_VOLDOWN, BUTTON_SCROLL_BACK, BUTTON_NONE }, | ||
283 | { ACTION_USB_HID_VOLDOWN, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE }, | ||
284 | { ACTION_USB_HID_MUTE, BUTTON_SELECT, BUTTON_NONE }, | ||
285 | { ACTION_USB_HID_MENU, BUTTON_DOWN, BUTTON_NONE }, | ||
286 | |||
287 | LAST_ITEM_IN_LIST | ||
288 | }; /* button_context_usb_hid */ | ||
289 | #endif | ||
290 | |||
274 | /* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */ | 291 | /* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */ |
275 | const struct button_mapping* get_context_mapping(int context) | 292 | const struct button_mapping* get_context_mapping(int context) |
276 | { | 293 | { |
@@ -318,7 +335,10 @@ const struct button_mapping* get_context_mapping(int context) | |||
318 | return button_context_recscreen; | 335 | return button_context_recscreen; |
319 | case CONTEXT_KEYBOARD: | 336 | case CONTEXT_KEYBOARD: |
320 | return button_context_keyboard; | 337 | return button_context_keyboard; |
321 | 338 | #ifdef HAVE_USBSTACK | |
339 | case CONTEXT_USB_HID: | ||
340 | return button_context_usb_hid; | ||
341 | #endif | ||
322 | default: | 342 | default: |
323 | return button_context_standard; | 343 | return button_context_standard; |
324 | } | 344 | } |
diff --git a/apps/keymaps/keymap-gigabeat-s.c b/apps/keymaps/keymap-gigabeat-s.c index f431f5fc02..4fc7e8d469 100644 --- a/apps/keymaps/keymap-gigabeat-s.c +++ b/apps/keymaps/keymap-gigabeat-s.c | |||
@@ -464,6 +464,42 @@ static const struct button_mapping remote_button_context_right_is_inc[] = { | |||
464 | LAST_ITEM_IN_LIST | 464 | LAST_ITEM_IN_LIST |
465 | }; /* remote_button_context_right_is_inc */ | 465 | }; /* remote_button_context_right_is_inc */ |
466 | 466 | ||
467 | #ifdef HAVE_USBSTACK | ||
468 | static const struct button_mapping button_context_usb_hid[] = { | ||
469 | { ACTION_USB_HID_PLAY, BUTTON_PLAY, BUTTON_NONE }, | ||
470 | { ACTION_USB_HID_STOP, BUTTON_POWER, BUTTON_NONE }, | ||
471 | { ACTION_USB_HID_SKIPPREV, BUTTON_LEFT, BUTTON_NONE }, | ||
472 | { ACTION_USB_HID_SKIPNEXT, BUTTON_RIGHT, BUTTON_NONE }, | ||
473 | { ACTION_USB_HID_VOLUP, BUTTON_UP, BUTTON_NONE }, | ||
474 | { ACTION_USB_HID_VOLUP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, | ||
475 | { ACTION_USB_HID_VOLUP, BUTTON_VOL_UP, BUTTON_NONE }, | ||
476 | { ACTION_USB_HID_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, | ||
477 | { ACTION_USB_HID_VOLDOWN, BUTTON_DOWN, BUTTON_NONE }, | ||
478 | { ACTION_USB_HID_VOLDOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, | ||
479 | { ACTION_USB_HID_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE }, | ||
480 | { ACTION_USB_HID_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, | ||
481 | { ACTION_USB_HID_MUTE, BUTTON_SELECT, BUTTON_NONE }, | ||
482 | { ACTION_USB_HID_MENU, BUTTON_MENU, BUTTON_NONE }, | ||
483 | |||
484 | LAST_ITEM_IN_LIST | ||
485 | }; /* button_context_usb_hid */ | ||
486 | |||
487 | static const struct button_mapping remote_button_context_usb_hid[] = { | ||
488 | { ACTION_USB_HID_PLAY, BUTTON_RC_PLAY, BUTTON_NONE }, | ||
489 | { ACTION_USB_HID_STOP, BUTTON_RC_POWER, BUTTON_NONE }, | ||
490 | { ACTION_USB_HID_SKIPPREV, BUTTON_RC_REW, BUTTON_NONE }, | ||
491 | { ACTION_USB_HID_SKIPNEXT, BUTTON_RC_FF, BUTTON_NONE }, | ||
492 | { ACTION_USB_HID_VOLUP, BUTTON_RC_VOL_UP, BUTTON_NONE }, | ||
493 | { ACTION_USB_HID_VOLUP, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, | ||
494 | { ACTION_USB_HID_VOLDOWN, BUTTON_RC_VOL_DOWN, BUTTON_NONE }, | ||
495 | { ACTION_USB_HID_VOLDOWN, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, | ||
496 | { ACTION_USB_HID_MUTE, BUTTON_RC_DSP|BUTTON_REPEAT, BUTTON_NONE }, | ||
497 | { ACTION_USB_HID_MENU, BUTTON_RC_DSP, BUTTON_NONE }, | ||
498 | |||
499 | LAST_ITEM_IN_LIST | ||
500 | }; /* remote_button_context_usb_hid */ | ||
501 | #endif | ||
502 | |||
467 | static const struct button_mapping* get_context_mapping_remote( int context ) | 503 | static const struct button_mapping* get_context_mapping_remote( int context ) |
468 | { | 504 | { |
469 | context &= ~CONTEXT_REMOTE; | 505 | context &= ~CONTEXT_REMOTE; |
@@ -506,6 +542,10 @@ static const struct button_mapping* get_context_mapping_remote( int context ) | |||
506 | case CONTEXT_FM: | 542 | case CONTEXT_FM: |
507 | return remote_button_context_radio; | 543 | return remote_button_context_radio; |
508 | 544 | ||
545 | #ifdef HAVE_USBSTACK | ||
546 | case CONTEXT_USB_HID: | ||
547 | return remote_button_context_usb_hid; | ||
548 | #endif | ||
509 | default: | 549 | default: |
510 | return remote_button_context_standard; | 550 | return remote_button_context_standard; |
511 | } | 551 | } |
@@ -573,6 +613,10 @@ const struct button_mapping* get_context_mapping(int context) | |||
573 | case CONTEXT_FM: | 613 | case CONTEXT_FM: |
574 | return button_context_radio; | 614 | return button_context_radio; |
575 | 615 | ||
616 | #ifdef HAVE_USBSTACK | ||
617 | case CONTEXT_USB_HID: | ||
618 | return button_context_usb_hid; | ||
619 | #endif | ||
576 | default: | 620 | default: |
577 | return button_context_standard; | 621 | return button_context_standard; |
578 | } | 622 | } |
diff --git a/apps/keymaps/keymap-h10.c b/apps/keymaps/keymap-h10.c index 9afca4e61c..77247d35d8 100644 --- a/apps/keymaps/keymap-h10.c +++ b/apps/keymaps/keymap-h10.c | |||
@@ -332,6 +332,61 @@ static const struct button_mapping button_context_radio[] = { | |||
332 | 332 | ||
333 | }; | 333 | }; |
334 | 334 | ||
335 | |||
336 | |||
337 | |||
338 | |||
339 | |||
340 | static const struct button_mapping remote_button_context_wps[] = { | ||
341 | { ACTION_WPS_PLAY, BUTTON_RC_PLAY|BUTTON_REL, BUTTON_RC_PLAY }, | ||
342 | { ACTION_WPS_STOP, BUTTON_RC_PLAY|BUTTON_REPEAT,BUTTON_RC_PLAY }, | ||
343 | { ACTION_WPS_SKIPPREV, BUTTON_RC_REW|BUTTON_REL, BUTTON_RC_REW}, | ||
344 | { ACTION_WPS_SEEKBACK, BUTTON_RC_REW|BUTTON_REPEAT, BUTTON_NONE }, | ||
345 | { ACTION_WPS_STOPSEEK, BUTTON_RC_REW|BUTTON_REL, BUTTON_RC_REW|BUTTON_REPEAT }, | ||
346 | { ACTION_WPS_SKIPNEXT, BUTTON_RC_FF|BUTTON_REL, BUTTON_RC_FF }, | ||
347 | { ACTION_WPS_SEEKFWD, BUTTON_RC_FF|BUTTON_REPEAT, BUTTON_NONE }, | ||
348 | { ACTION_WPS_STOPSEEK, BUTTON_RC_FF|BUTTON_REL, BUTTON_RC_FF|BUTTON_REPEAT }, | ||
349 | |||
350 | { ACTION_WPS_VOLDOWN, BUTTON_RC_VOL_DOWN, BUTTON_NONE }, | ||
351 | { ACTION_WPS_VOLDOWN, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, | ||
352 | { ACTION_WPS_VOLUP, BUTTON_RC_VOL_UP, BUTTON_NONE }, | ||
353 | { ACTION_WPS_VOLUP, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, | ||
354 | |||
355 | { ACTION_WPS_PITCHSCREEN, BUTTON_RC_PLAY|BUTTON_LEFT, BUTTON_RC_PLAY }, | ||
356 | { ACTION_WPS_ID3SCREEN, BUTTON_RC_PLAY|BUTTON_RIGHT, BUTTON_RC_PLAY }, | ||
357 | |||
358 | LAST_ITEM_IN_LIST | ||
359 | }; /* remote_button_context_wps */ | ||
360 | |||
361 | #ifdef HAVE_USBSTACK | ||
362 | static const struct button_mapping button_context_usb_hid[] = { | ||
363 | { ACTION_USB_HID_PLAY, BUTTON_PLAY, BUTTON_NONE }, | ||
364 | { ACTION_USB_HID_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE }, | ||
365 | { ACTION_USB_HID_SKIPPREV, BUTTON_REW, BUTTON_NONE }, | ||
366 | { ACTION_USB_HID_SKIPNEXT, BUTTON_FF, BUTTON_NONE }, | ||
367 | { ACTION_USB_HID_VOLUP, BUTTON_SCROLL_UP, BUTTON_NONE }, | ||
368 | { ACTION_USB_HID_VOLUP, BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE }, | ||
369 | { ACTION_USB_HID_VOLDOWN, BUTTON_SCROLL_DOWN, BUTTON_NONE }, | ||
370 | { ACTION_USB_HID_VOLDOWN, BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, | ||
371 | { ACTION_USB_HID_MENU, BUTTON_POWER, BUTTON_NONE }, | ||
372 | |||
373 | LAST_ITEM_IN_LIST | ||
374 | }; /* button_context_usb_hid */ | ||
375 | |||
376 | static const struct button_mapping remote_button_context_usb_hid[] = { | ||
377 | { ACTION_USB_HID_PLAY, BUTTON_RC_PLAY, BUTTON_NONE }, | ||
378 | { ACTION_USB_HID_STOP, BUTTON_RC_PLAY|BUTTON_REPEAT, BUTTON_NONE }, | ||
379 | { ACTION_USB_HID_SKIPPREV, BUTTON_RC_REW, BUTTON_NONE }, | ||
380 | { ACTION_USB_HID_SKIPNEXT, BUTTON_RC_FF, BUTTON_NONE }, | ||
381 | { ACTION_USB_HID_VOLUP, BUTTON_RC_SCROLL_UP, BUTTON_NONE }, | ||
382 | { ACTION_USB_HID_VOLUP, BUTTON_RC_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE }, | ||
383 | { ACTION_USB_HID_VOLDOWN, BUTTON_RC_SCROLL_DOWN, BUTTON_NONE }, | ||
384 | { ACTION_USB_HID_VOLDOWN, BUTTON_RC_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, | ||
385 | |||
386 | LAST_ITEM_IN_LIST | ||
387 | }; /* remote_button_context_usb_hid */ | ||
388 | #endif | ||
389 | |||
335 | static const struct button_mapping* get_context_mapping_remote( int context ) | 390 | static const struct button_mapping* get_context_mapping_remote( int context ) |
336 | { | 391 | { |
337 | context ^= CONTEXT_REMOTE; | 392 | context ^= CONTEXT_REMOTE; |
@@ -361,6 +416,10 @@ static const struct button_mapping* get_context_mapping_remote( int context ) | |||
361 | return remote_button_context_pitchscreen; | 416 | return remote_button_context_pitchscreen; |
362 | case CONTEXT_RECSCREEN: | 417 | case CONTEXT_RECSCREEN: |
363 | return button_context_recscreen; | 418 | return button_context_recscreen; |
419 | #ifdef HAVE_USBSTACK | ||
420 | case CONTEXT_USB_HID: | ||
421 | return remote_button_context_usb_hid; | ||
422 | #endif | ||
364 | 423 | ||
365 | default: | 424 | default: |
366 | return remote_button_context_standard; | 425 | return remote_button_context_standard; |
@@ -415,6 +474,10 @@ const struct button_mapping* get_context_mapping(int context) | |||
415 | return button_context_recscreen; | 474 | return button_context_recscreen; |
416 | case CONTEXT_FM: | 475 | case CONTEXT_FM: |
417 | return button_context_radio; | 476 | return button_context_radio; |
477 | #ifdef HAVE_USBSTACK | ||
478 | case CONTEXT_USB_HID: | ||
479 | return button_context_usb_hid; | ||
480 | #endif | ||
418 | default: | 481 | default: |
419 | return button_context_standard; | 482 | return button_context_standard; |
420 | } | 483 | } |
diff --git a/apps/keymaps/keymap-hdd1630.c b/apps/keymaps/keymap-hdd1630.c index 6b38983d08..deb77307b8 100644 --- a/apps/keymaps/keymap-hdd1630.c +++ b/apps/keymaps/keymap-hdd1630.c | |||
@@ -282,6 +282,27 @@ static const struct button_mapping button_context_radio[] = { | |||
282 | }; | 282 | }; |
283 | #endif | 283 | #endif |
284 | 284 | ||
285 | #ifdef HAVE_USBSTACK | ||
286 | static const struct button_mapping button_context_usb_hid[] = { | ||
287 | { ACTION_USB_HID_PLAY, BUTTON_VIEW, BUTTON_NONE }, | ||
288 | { ACTION_USB_HID_STOP, BUTTON_POWER, BUTTON_NONE }, | ||
289 | { ACTION_USB_HID_SKIPPREV, BUTTON_LEFT, BUTTON_NONE }, | ||
290 | { ACTION_USB_HID_SKIPNEXT, BUTTON_RIGHT, BUTTON_NONE }, | ||
291 | { ACTION_USB_HID_VOLUP, BUTTON_UP, BUTTON_NONE }, | ||
292 | { ACTION_USB_HID_VOLUP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, | ||
293 | { ACTION_USB_HID_VOLUP, BUTTON_VOL_UP, BUTTON_NONE }, | ||
294 | { ACTION_USB_HID_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, | ||
295 | { ACTION_USB_HID_VOLDOWN, BUTTON_DOWN, BUTTON_NONE }, | ||
296 | { ACTION_USB_HID_VOLDOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, | ||
297 | { ACTION_USB_HID_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE }, | ||
298 | { ACTION_USB_HID_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, | ||
299 | { ACTION_USB_HID_MUTE, BUTTON_SELECT, BUTTON_NONE }, | ||
300 | { ACTION_USB_HID_MENU, BUTTON_MENU, BUTTON_NONE }, | ||
301 | |||
302 | LAST_ITEM_IN_LIST | ||
303 | }; /* button_context_usb_hid */ | ||
304 | #endif | ||
305 | |||
285 | const struct button_mapping* get_context_mapping(int context) | 306 | const struct button_mapping* get_context_mapping(int context) |
286 | { | 307 | { |
287 | switch (context) | 308 | switch (context) |
@@ -329,6 +350,10 @@ const struct button_mapping* get_context_mapping(int context) | |||
329 | case CONTEXT_FM: | 350 | case CONTEXT_FM: |
330 | return button_context_radio; | 351 | return button_context_radio; |
331 | #endif | 352 | #endif |
353 | #ifdef HAVE_USBSTACK | ||
354 | case CONTEXT_USB_HID: | ||
355 | return button_context_usb_hid; | ||
356 | #endif | ||
332 | } | 357 | } |
333 | return button_context_standard; | 358 | return button_context_standard; |
334 | } | 359 | } |
diff --git a/apps/keymaps/keymap-ipod.c b/apps/keymaps/keymap-ipod.c index a7aeb27568..163a810036 100644 --- a/apps/keymaps/keymap-ipod.c +++ b/apps/keymaps/keymap-ipod.c | |||
@@ -188,6 +188,23 @@ const struct button_mapping button_context_recscreen[] = { | |||
188 | }; /* button_context_recscreen */ | 188 | }; /* button_context_recscreen */ |
189 | #endif | 189 | #endif |
190 | 190 | ||
191 | #ifdef HAVE_USBSTACK | ||
192 | static const struct button_mapping button_context_usb_hid[] = { | ||
193 | { ACTION_USB_HID_PLAY, BUTTON_PLAY, BUTTON_NONE }, | ||
194 | { ACTION_USB_HID_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE }, | ||
195 | { ACTION_USB_HID_SKIPPREV, BUTTON_LEFT, BUTTON_NONE }, | ||
196 | { ACTION_USB_HID_SKIPNEXT, BUTTON_RIGHT, BUTTON_NONE }, | ||
197 | { ACTION_USB_HID_VOLUP, BUTTON_SCROLL_FWD, BUTTON_NONE }, | ||
198 | { ACTION_USB_HID_VOLUP, BUTTON_SCROLL_FWD|BUTTON_REPEAT, BUTTON_NONE }, | ||
199 | { ACTION_USB_HID_VOLDOWN, BUTTON_SCROLL_BACK, BUTTON_NONE }, | ||
200 | { ACTION_USB_HID_VOLDOWN, BUTTON_SCROLL_BACK|BUTTON_REPEAT, BUTTON_NONE }, | ||
201 | { ACTION_USB_HID_MUTE, BUTTON_SELECT, BUTTON_NONE }, | ||
202 | { ACTION_USB_HID_MENU, BUTTON_MENU, BUTTON_NONE }, | ||
203 | |||
204 | LAST_ITEM_IN_LIST | ||
205 | }; /* button_context_usb_hid */ | ||
206 | #endif | ||
207 | |||
191 | #if BUTTON_REMOTE != 0 | 208 | #if BUTTON_REMOTE != 0 |
192 | /***************************************************************************** | 209 | /***************************************************************************** |
193 | * Remote control mappings | 210 | * Remote control mappings |
@@ -220,6 +237,20 @@ static const struct button_mapping remote_button_context_wps[] = { | |||
220 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) | 237 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) |
221 | }; | 238 | }; |
222 | 239 | ||
240 | #ifdef HAVE_USBSTACK | ||
241 | static const struct button_mapping remote_button_context_usb_hid[] = { | ||
242 | { ACTION_USB_HID_PLAY, BUTTON_RC_PLAY, BUTTON_NONE }, | ||
243 | { ACTION_USB_HID_STOP, BUTTON_RC_PLAY|BUTTON_REPEAT, BUTTON_NONE }, | ||
244 | { ACTION_USB_HID_SKIPPREV, BUTTON_RC_LEFT, BUTTON_NONE }, | ||
245 | { ACTION_USB_HID_SKIPNEXT, BUTTON_RC_RIGHT, BUTTON_NONE }, | ||
246 | { ACTION_USB_HID_VOLUP, BUTTON_RC_VOL_UP, BUTTON_NONE }, | ||
247 | { ACTION_USB_HID_VOLUP, BUTTON_RC_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, | ||
248 | { ACTION_USB_HID_VOLDOWN, BUTTON_RC_VOL_DOWN, BUTTON_NONE }, | ||
249 | { ACTION_USB_HID_VOLDOWN, BUTTON_RC_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, | ||
250 | |||
251 | LAST_ITEM_IN_LIST | ||
252 | }; /* remote_button_context_usb_hid */ | ||
253 | #endif | ||
223 | 254 | ||
224 | static const struct button_mapping* get_context_mapping_remote( int context ) | 255 | static const struct button_mapping* get_context_mapping_remote( int context ) |
225 | { | 256 | { |
@@ -229,7 +260,10 @@ static const struct button_mapping* get_context_mapping_remote( int context ) | |||
229 | { | 260 | { |
230 | case CONTEXT_WPS: | 261 | case CONTEXT_WPS: |
231 | return remote_button_context_wps; | 262 | return remote_button_context_wps; |
232 | 263 | #ifdef HAVE_USBSTACK | |
264 | case CONTEXT_USB_HID: | ||
265 | return remote_button_context_usb_hid; | ||
266 | #endif | ||
233 | default: | 267 | default: |
234 | return remote_button_context_standard; | 268 | return remote_button_context_standard; |
235 | } | 269 | } |
@@ -282,6 +316,10 @@ const struct button_mapping* get_context_mapping(int context) | |||
282 | case CONTEXT_RECSCREEN: | 316 | case CONTEXT_RECSCREEN: |
283 | return button_context_recscreen; | 317 | return button_context_recscreen; |
284 | #endif | 318 | #endif |
319 | #ifdef HAVE_USBSTACK | ||
320 | case CONTEXT_USB_HID: | ||
321 | return button_context_usb_hid; | ||
322 | #endif | ||
285 | default: | 323 | default: |
286 | return button_context_standard; | 324 | return button_context_standard; |
287 | } | 325 | } |
diff --git a/apps/keymaps/keymap-mr100.c b/apps/keymaps/keymap-mr100.c index 8b7b74d19b..aff235a480 100644 --- a/apps/keymaps/keymap-mr100.c +++ b/apps/keymaps/keymap-mr100.c | |||
@@ -313,6 +313,37 @@ static const struct button_mapping remote_button_context_tree[] = { | |||
313 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) | 313 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) |
314 | }; | 314 | }; |
315 | 315 | ||
316 | #ifdef HAVE_USBSTACK | ||
317 | static const struct button_mapping button_context_usb_hid[] = { | ||
318 | { ACTION_USB_HID_PLAY, BUTTON_PLAY, BUTTON_NONE }, | ||
319 | { ACTION_USB_HID_STOP, BUTTON_POWER, BUTTON_NONE }, | ||
320 | { ACTION_USB_HID_SKIPPREV, BUTTON_LEFT, BUTTON_NONE }, | ||
321 | { ACTION_USB_HID_SKIPNEXT, BUTTON_RIGHT, BUTTON_NONE }, | ||
322 | { ACTION_USB_HID_VOLUP, BUTTON_UP, BUTTON_NONE }, | ||
323 | { ACTION_USB_HID_VOLUP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, | ||
324 | { ACTION_USB_HID_VOLDOWN, BUTTON_DOWN, BUTTON_NONE }, | ||
325 | { ACTION_USB_HID_VOLDOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, | ||
326 | { ACTION_USB_HID_MUTE, BUTTON_SELECT, BUTTON_NONE }, | ||
327 | { ACTION_USB_HID_MENU, BUTTON_MENU, BUTTON_NONE }, | ||
328 | |||
329 | LAST_ITEM_IN_LIST | ||
330 | }; /* button_context_usb_hid */ | ||
331 | |||
332 | static const struct button_mapping remote_button_context_usb_hid[] = { | ||
333 | { ACTION_USB_HID_PLAY, BUTTON_RC_PLAY, BUTTON_NONE }, | ||
334 | { ACTION_USB_HID_STOP, BUTTON_RC_PLAY|BUTTON_REPEAT, BUTTON_NONE }, | ||
335 | { ACTION_USB_HID_SKIPPREV, BUTTON_RC_REW, BUTTON_NONE }, | ||
336 | { ACTION_USB_HID_SKIPNEXT, BUTTON_RC_FF, BUTTON_NONE }, | ||
337 | { ACTION_USB_HID_VOLUP, BUTTON_RC_UP, BUTTON_NONE }, | ||
338 | { ACTION_USB_HID_VOLUP, BUTTON_RC_UP|BUTTON_REPEAT, BUTTON_NONE }, | ||
339 | { ACTION_USB_HID_VOLDOWN, BUTTON_RC_DOWN, BUTTON_NONE }, | ||
340 | { ACTION_USB_HID_VOLDOWN, BUTTON_RC_DOWN|BUTTON_REPEAT, BUTTON_NONE }, | ||
341 | { ACTION_USB_HID_MENU, BUTTON_RC_FAV, BUTTON_NONE }, | ||
342 | |||
343 | LAST_ITEM_IN_LIST | ||
344 | }; /* remote_button_context_usb_hid */ | ||
345 | #endif | ||
346 | |||
316 | static const struct button_mapping* get_context_mapping_remote( int context ) | 347 | static const struct button_mapping* get_context_mapping_remote( int context ) |
317 | { | 348 | { |
318 | context ^= CONTEXT_REMOTE; | 349 | context ^= CONTEXT_REMOTE; |
@@ -324,6 +355,10 @@ static const struct button_mapping* get_context_mapping_remote( int context ) | |||
324 | case CONTEXT_MAINMENU: | 355 | case CONTEXT_MAINMENU: |
325 | case CONTEXT_TREE: | 356 | case CONTEXT_TREE: |
326 | return remote_button_context_tree; | 357 | return remote_button_context_tree; |
358 | #ifdef HAVE_USBSTACK | ||
359 | case CONTEXT_USB_HID: | ||
360 | return remote_button_context_usb_hid; | ||
361 | #endif | ||
327 | } | 362 | } |
328 | return remote_button_context_standard; | 363 | return remote_button_context_standard; |
329 | } | 364 | } |
@@ -374,6 +409,10 @@ const struct button_mapping* get_context_mapping(int context) | |||
374 | return button_context_pitchscreen; | 409 | return button_context_pitchscreen; |
375 | case CONTEXT_KEYBOARD: | 410 | case CONTEXT_KEYBOARD: |
376 | return button_context_keyboard; | 411 | return button_context_keyboard; |
412 | #ifdef HAVE_USBSTACK | ||
413 | case CONTEXT_USB_HID: | ||
414 | return button_context_usb_hid; | ||
415 | #endif | ||
377 | } | 416 | } |
378 | return button_context_standard; | 417 | return button_context_standard; |
379 | } | 418 | } |
diff --git a/apps/keymaps/keymap-ondavx747.c b/apps/keymaps/keymap-ondavx747.c index 82fde820fb..0b7f1b3870 100644 --- a/apps/keymaps/keymap-ondavx747.c +++ b/apps/keymaps/keymap-ondavx747.c | |||
@@ -152,6 +152,19 @@ static const struct button_mapping button_context_keyboard[] = { | |||
152 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) | 152 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) |
153 | }; /* button_context_keyboard */ | 153 | }; /* button_context_keyboard */ |
154 | 154 | ||
155 | #ifdef HAVE_USBSTACK | ||
156 | static const struct button_mapping button_context_usb_hid[] = { | ||
157 | { ACTION_USB_HID_VOLUP, BUTTON_VOL_UP, BUTTON_NONE }, | ||
158 | { ACTION_USB_HID_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, | ||
159 | { ACTION_USB_HID_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE }, | ||
160 | { ACTION_USB_HID_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, | ||
161 | { ACTION_USB_HID_MUTE, BUTTON_POWER, BUTTON_NONE }, | ||
162 | { ACTION_USB_HID_MENU, BUTTON_MENU, BUTTON_NONE }, | ||
163 | |||
164 | LAST_ITEM_IN_LIST | ||
165 | }; /* button_context_usb_hid */ | ||
166 | #endif | ||
167 | |||
155 | const struct button_mapping* target_get_context_mapping(int context) | 168 | const struct button_mapping* target_get_context_mapping(int context) |
156 | { | 169 | { |
157 | switch (context) | 170 | switch (context) |
@@ -196,6 +209,10 @@ const struct button_mapping* target_get_context_mapping(int context) | |||
196 | return button_context_pitchscreen; | 209 | return button_context_pitchscreen; |
197 | case CONTEXT_KEYBOARD: | 210 | case CONTEXT_KEYBOARD: |
198 | return button_context_keyboard; | 211 | return button_context_keyboard; |
212 | #ifdef HAVE_USBSTACK | ||
213 | case CONTEXT_USB_HID: | ||
214 | return button_context_usb_hid; | ||
215 | #endif | ||
199 | } | 216 | } |
200 | return button_context_standard; | 217 | return button_context_standard; |
201 | } | 218 | } |
diff --git a/apps/keymaps/keymap-sa9200.c b/apps/keymaps/keymap-sa9200.c index 478eea3bfe..3091ec6156 100644 --- a/apps/keymaps/keymap-sa9200.c +++ b/apps/keymaps/keymap-sa9200.c | |||
@@ -269,6 +269,27 @@ static const struct button_mapping button_context_keyboard[] = { | |||
269 | LAST_ITEM_IN_LIST | 269 | LAST_ITEM_IN_LIST |
270 | }; /* button_context_keyboard */ | 270 | }; /* button_context_keyboard */ |
271 | 271 | ||
272 | #ifdef HAVE_USBSTACK | ||
273 | static const struct button_mapping button_context_usb_hid[] = { | ||
274 | { ACTION_USB_HID_PLAY, BUTTON_RIGHT, BUTTON_NONE }, | ||
275 | { ACTION_USB_HID_STOP, BUTTON_POWER, BUTTON_NONE }, | ||
276 | { ACTION_USB_HID_SKIPPREV, BUTTON_REW, BUTTON_NONE }, | ||
277 | { ACTION_USB_HID_SKIPNEXT, BUTTON_FFWD, BUTTON_NONE }, | ||
278 | { ACTION_USB_HID_VOLUP, BUTTON_UP, BUTTON_NONE }, | ||
279 | { ACTION_USB_HID_VOLUP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, | ||
280 | { ACTION_USB_HID_VOLUP, BUTTON_VOL_UP, BUTTON_NONE }, | ||
281 | { ACTION_USB_HID_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, | ||
282 | { ACTION_USB_HID_VOLDOWN, BUTTON_DOWN, BUTTON_NONE }, | ||
283 | { ACTION_USB_HID_VOLDOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, | ||
284 | { ACTION_USB_HID_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE }, | ||
285 | { ACTION_USB_HID_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, | ||
286 | { ACTION_USB_HID_MUTE, BUTTON_SELECT, BUTTON_NONE }, | ||
287 | { ACTION_USB_HID_MENU, BUTTON_MENU, BUTTON_NONE }, | ||
288 | |||
289 | LAST_ITEM_IN_LIST | ||
290 | }; /* button_context_usb_hid */ | ||
291 | #endif | ||
292 | |||
272 | const struct button_mapping* get_context_mapping(int context) | 293 | const struct button_mapping* get_context_mapping(int context) |
273 | { | 294 | { |
274 | switch (context) | 295 | switch (context) |
@@ -312,6 +333,10 @@ const struct button_mapping* get_context_mapping(int context) | |||
312 | return button_context_pitchscreen; | 333 | return button_context_pitchscreen; |
313 | case CONTEXT_KEYBOARD: | 334 | case CONTEXT_KEYBOARD: |
314 | return button_context_keyboard; | 335 | return button_context_keyboard; |
336 | #ifdef HAVE_USBSTACK | ||
337 | case CONTEXT_USB_HID: | ||
338 | return button_context_usb_hid; | ||
339 | #endif | ||
315 | } | 340 | } |
316 | return button_context_standard; | 341 | return button_context_standard; |
317 | } | 342 | } |
diff --git a/apps/keymaps/keymap-touchscreen.c b/apps/keymaps/keymap-touchscreen.c index ce5d01c9dc..70009794a5 100644 --- a/apps/keymaps/keymap-touchscreen.c +++ b/apps/keymaps/keymap-touchscreen.c | |||
@@ -245,6 +245,18 @@ static const struct button_mapping button_context_radio[] = { | |||
245 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_FM) | 245 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_FM) |
246 | }; /* button_context_radio */ | 246 | }; /* button_context_radio */ |
247 | 247 | ||
248 | #ifdef HAVE_USBSTACK | ||
249 | static const struct button_mapping button_context_usb_hid[] = { | ||
250 | { ACTION_USB_HID_PLAY, BUTTON_TOPRIGHT, BUTTON_NONE }, | ||
251 | { ACTION_USB_HID_SKIPPREV, BUTTON_MIDLEFT, BUTTON_NONE }, | ||
252 | { ACTION_USB_HID_SKIPNEXT, BUTTON_MIDRIGHT, BUTTON_NONE }, | ||
253 | { ACTION_USB_HID_MUTE, BUTTON_CENTER, BUTTON_NONE }, | ||
254 | { ACTION_USB_HID_MENU, BUTTON_TOPLEFT, BUTTON_NONE }, | ||
255 | |||
256 | LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM2|CONTEXT_USB_HID) | ||
257 | }; /* button_context_usb_hid */ | ||
258 | #endif | ||
259 | |||
248 | const struct button_mapping* get_context_mapping(int context) | 260 | const struct button_mapping* get_context_mapping(int context) |
249 | { | 261 | { |
250 | if (context & CONTEXT_CUSTOM2 | 262 | if (context & CONTEXT_CUSTOM2 |
@@ -297,6 +309,10 @@ const struct button_mapping* get_context_mapping(int context) | |||
297 | return button_context_pitchscreen; | 309 | return button_context_pitchscreen; |
298 | case CONTEXT_KEYBOARD: | 310 | case CONTEXT_KEYBOARD: |
299 | return button_context_keyboard; | 311 | return button_context_keyboard; |
312 | #ifdef HAVE_USBSTACK | ||
313 | case CONTEXT_USB_HID: | ||
314 | return button_context_usb_hid; | ||
315 | #endif | ||
300 | } | 316 | } |
301 | return button_context_standard; | 317 | return button_context_standard; |
302 | } | 318 | } |
diff --git a/apps/screens.c b/apps/screens.c index 8c2b145550..be7e29a0c9 100644 --- a/apps/screens.c +++ b/apps/screens.c | |||
@@ -34,6 +34,12 @@ | |||
34 | #include "audio.h" | 34 | #include "audio.h" |
35 | #include "mp3_playback.h" | 35 | #include "mp3_playback.h" |
36 | #include "usb.h" | 36 | #include "usb.h" |
37 | #if defined(HAVE_USBSTACK) | ||
38 | #include "usb_core.h" | ||
39 | #ifdef USB_CLASS_HID | ||
40 | #include "usbstack/usb_hid.h" | ||
41 | #endif | ||
42 | #endif | ||
37 | #include "settings.h" | 43 | #include "settings.h" |
38 | #include "status.h" | 44 | #include "status.h" |
39 | #include "playlist.h" | 45 | #include "playlist.h" |
@@ -90,23 +96,70 @@ static int clamp_value_wrap(int value, int max, int min) | |||
90 | #endif | 96 | #endif |
91 | 97 | ||
92 | #ifndef SIMULATOR | 98 | #ifndef SIMULATOR |
93 | static int handle_usb_events(struct event_queue *q) | 99 | static int handle_usb_events(void) |
94 | { | 100 | { |
95 | struct queue_event ev; | ||
96 | int next_update=0; | 101 | int next_update=0; |
102 | #ifdef HAVE_TOUCHSCREEN | ||
103 | enum touchscreen_mode old_mode = touchscreen_get_mode(); | ||
104 | |||
105 | /* TODO: Paint buttons on screens OR switch to point mode and use | ||
106 | * touchscreen as a touchpad to move the host's mouse cursor */ | ||
107 | touchscreen_set_mode(TOUCHSCREEN_BUTTON); | ||
108 | #endif | ||
97 | 109 | ||
98 | /* Don't return until we get SYS_USB_DISCONNECTED or SYS_TIMEOUT */ | 110 | /* Don't return until we get SYS_USB_DISCONNECTED or SYS_TIMEOUT */ |
99 | while(1) | 111 | while(1) |
100 | { | 112 | { |
101 | queue_wait_w_tmo(q, &ev, HZ/4); | 113 | int button; |
102 | switch(ev.id) | 114 | #if defined(HAVE_USBSTACK) && defined(USB_CLASS_HID) |
115 | bool hid_enabled = usb_core_driver_enabled(USB_DRIVER_HID); | ||
116 | |||
117 | if (hid_enabled) | ||
118 | { | ||
119 | consumer_usage_page_t cmd = UNASSIGNED; | ||
120 | button = get_action(CONTEXT_USB_HID, HZ/4); | ||
121 | |||
122 | switch (button) | ||
123 | { | ||
124 | case ACTION_USB_HID_PLAY: | ||
125 | cmd = PLAY_PAUSE; | ||
126 | break; | ||
127 | case ACTION_USB_HID_STOP: | ||
128 | cmd = STOP; | ||
129 | break; | ||
130 | case ACTION_USB_HID_SKIPPREV: | ||
131 | cmd = SCAN_PREVIOUS_TRACK; | ||
132 | break; | ||
133 | case ACTION_USB_HID_SKIPNEXT: | ||
134 | cmd = SCAN_NEXT_TRACK; | ||
135 | break; | ||
136 | case ACTION_USB_HID_VOLDOWN: | ||
137 | cmd = VOLUME_DECREMENT; | ||
138 | break; | ||
139 | case ACTION_USB_HID_VOLUP: | ||
140 | cmd = VOLUME_INCREMENT; | ||
141 | break; | ||
142 | case ACTION_USB_HID_MUTE: | ||
143 | cmd = MUTE; | ||
144 | break; | ||
145 | } | ||
146 | |||
147 | if (cmd != UNASSIGNED) | ||
148 | usb_hid_send_consumer_usage(cmd); | ||
149 | } | ||
150 | else | ||
151 | #endif | ||
152 | button = button_get_w_tmo(HZ/4); | ||
153 | |||
154 | switch(button) | ||
103 | { | 155 | { |
104 | case SYS_USB_DISCONNECTED: | 156 | case SYS_USB_DISCONNECTED: |
105 | usb_acknowledge(SYS_USB_DISCONNECTED_ACK); | 157 | usb_acknowledge(SYS_USB_DISCONNECTED_ACK); |
106 | return 0; | 158 | goto Exit; |
107 | case SYS_TIMEOUT: | 159 | case SYS_TIMEOUT: |
108 | break; | 160 | break; |
109 | } | 161 | } |
162 | |||
110 | if(TIME_AFTER(current_tick,next_update)) | 163 | if(TIME_AFTER(current_tick,next_update)) |
111 | { | 164 | { |
112 | if(usb_inserted()) { | 165 | if(usb_inserted()) { |
@@ -118,6 +171,11 @@ static int handle_usb_events(struct event_queue *q) | |||
118 | next_update=current_tick+HZ/2; | 171 | next_update=current_tick+HZ/2; |
119 | } | 172 | } |
120 | } | 173 | } |
174 | Exit: | ||
175 | #ifdef HAVE_TOUCHSCREEN | ||
176 | touchscreen_set_mode(old_mode); | ||
177 | #endif | ||
178 | return 0; | ||
121 | } | 179 | } |
122 | #endif | 180 | #endif |
123 | 181 | ||
@@ -172,7 +230,7 @@ void usb_screen(void) | |||
172 | while (button_get(true) & BUTTON_REL); | 230 | while (button_get(true) & BUTTON_REL); |
173 | #else | 231 | #else |
174 | usb_acknowledge(SYS_USB_CONNECTED_ACK); | 232 | usb_acknowledge(SYS_USB_CONNECTED_ACK); |
175 | while(handle_usb_events(&button_queue)); | 233 | while (handle_usb_events()); |
176 | #endif /* SIMULATOR */ | 234 | #endif /* SIMULATOR */ |
177 | #ifdef HAVE_LCD_CHARCELLS | 235 | #ifdef HAVE_LCD_CHARCELLS |
178 | status_set_usb(false); | 236 | status_set_usb(false); |