summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/debug_menu.c74
1 files changed, 56 insertions, 18 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index 6c6ed08596..f1a4c4d998 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -112,8 +112,11 @@
112#include "as3514.h" 112#include "as3514.h"
113#endif 113#endif
114 114
115#if defined(HAVE_USBSTACK) 115#ifdef HAVE_USBSTACK
116#include "usb_core.h" 116#include "usb_core.h"
117#ifdef USB_HID
118#include "usbstack/usb_hid.h"
119#endif
117#endif 120#endif
118 121
119/*---------------------------------------------------*/ 122/*---------------------------------------------------*/
@@ -191,7 +194,7 @@ static int dbg_threads_action_callback(int action, struct gui_synclist *lists)
191 int selpos = gui_synclist_get_sel_pos(lists); 194 int selpos = gui_synclist_get_sel_pos(lists);
192#if NUM_CORES > 1 195#if NUM_CORES > 1
193 if (selpos >= NUM_CORES) 196 if (selpos >= NUM_CORES)
194 remove_thread(&threads[selpos - NUM_CORES]); 197 remove_thread(threads[selpos - NUM_CORES].id);
195#else 198#else
196 remove_thread(&threads[selpos]); 199 remove_thread(&threads[selpos]);
197#endif 200#endif
@@ -2583,8 +2586,9 @@ static bool dbg_scrollwheel(void)
2583} 2586}
2584#endif 2587#endif
2585 2588
2586#if defined (HAVE_USBSTACK) \ 2589#if defined (HAVE_USBSTACK)
2587 && (defined(ROCKBOX_HAS_LOGF) && defined(USB_SERIAL) || defined(USB_HID)) 2590
2591#if defined(ROCKBOX_HAS_LOGF) && defined(USB_SERIAL)
2588static bool toggle_usb_core_driver(int driver, char *msg) 2592static bool toggle_usb_core_driver(int driver, char *msg)
2589{ 2593{
2590 bool enabled = !usb_core_driver_enabled(driver); 2594 bool enabled = !usb_core_driver_enabled(driver);
@@ -2594,24 +2598,55 @@ static bool toggle_usb_core_driver(int driver, char *msg)
2594 2598
2595 return false; 2599 return false;
2596} 2600}
2597#if 0 && defined(USB_STORAGE)
2598static bool toggle_usb_mass_storage(void)
2599{
2600 return toggle_usb_core_driver(USB_DRIVER_MASS_STORAGE,"USB Mass Storage");
2601}
2602#endif
2603 2601
2604#if defined(ROCKBOX_HAS_LOGF) && defined(USB_SERIAL)
2605static bool toggle_usb_serial(void) 2602static bool toggle_usb_serial(void)
2606{ 2603{
2607 return toggle_usb_core_driver(USB_DRIVER_SERIAL,"USB Serial"); 2604 return toggle_usb_core_driver(USB_DRIVER_SERIAL,"USB Serial");
2608} 2605}
2609#endif 2606#endif
2610 2607
2611#if defined(USB_HID) 2608#ifdef USB_HID
2612static bool toggle_usb_hid(void) 2609static bool hid_send_cmd(consumer_usage_page_t cmd, char *msg)
2613{ 2610{
2614 return toggle_usb_core_driver(USB_DRIVER_HID, "USB HID"); 2611 (void)msg;
2612
2613 if (!usb_core_driver_enabled(USB_DRIVER_HID)) {
2614 splashf(HZ, "Send failed. Driver is disabled");
2615 return false;
2616 }
2617
2618 usb_hid_send_consumer_usage(cmd);
2619 logf("Sent %s command", msg);
2620
2621 return false;
2622}
2623static bool usb_hid_send_play_pause(void)
2624{
2625 return hid_send_cmd(PLAY_PAUSE, "Play/Pause");
2626}
2627static bool usb_hid_send_stop(void)
2628{
2629 return hid_send_cmd(STOP, "Stop");
2630}
2631static bool usb_hid_send_scan_previous_track(void)
2632{
2633 return hid_send_cmd(SCAN_PREVIOUS_TRACK, "Scan previous track");
2634}
2635static bool usb_hid_send_scan_next_track(void)
2636{
2637 return hid_send_cmd(SCAN_NEXT_TRACK, "Scan next track");
2638}
2639static bool usb_hid_send_mute(void)
2640{
2641 return hid_send_cmd(MUTE, "Mute");
2642}
2643static bool usb_hid_send_volume_decrement(void)
2644{
2645 return hid_send_cmd(VOLUME_DECREMENT, "Vol Down");
2646}
2647static bool usb_hid_send_volume_increment(void)
2648{
2649 return hid_send_cmd(VOLUME_INCREMENT, "Vol Up");
2615} 2650}
2616#endif 2651#endif
2617#endif 2652#endif
@@ -2751,14 +2786,17 @@ static const struct the_menu_item menuitems[] = {
2751 {"logfdump", logfdump }, 2786 {"logfdump", logfdump },
2752#endif 2787#endif
2753#if defined(HAVE_USBSTACK) 2788#if defined(HAVE_USBSTACK)
2754#if 0 && defined(USB_STORAGE)
2755 {"USB Mass-Storage driver", toggle_usb_mass_storage },
2756#endif
2757#if defined(ROCKBOX_HAS_LOGF) && defined(USB_SERIAL) 2789#if defined(ROCKBOX_HAS_LOGF) && defined(USB_SERIAL)
2758 {"USB Serial driver (logf)", toggle_usb_serial }, 2790 {"USB Serial driver (logf)", toggle_usb_serial },
2759#endif 2791#endif
2760#if defined(USB_HID) 2792#if defined(USB_HID)
2761 {"USB HID driver", toggle_usb_hid }, 2793 {"USB HID play/pause", usb_hid_send_play_pause },
2794 {"USB HID stop", usb_hid_send_stop },
2795 {"USB HID prev track", usb_hid_send_scan_previous_track },
2796 {"USB HID next track", usb_hid_send_scan_next_track },
2797 {"USB HID mute", usb_hid_send_mute },
2798 {"USB HID vol down", usb_hid_send_volume_decrement },
2799 {"USB HID vol up", usb_hid_send_volume_increment },
2762#endif 2800#endif
2763#endif /* HAVE_USBSTACK */ 2801#endif /* HAVE_USBSTACK */
2764#ifdef CPU_BOOST_LOGGING 2802#ifdef CPU_BOOST_LOGGING