summaryrefslogtreecommitdiff
path: root/firmware/usb.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/usb.c')
-rw-r--r--firmware/usb.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/firmware/usb.c b/firmware/usb.c
index 62a335f712..dd0ef9dfe4 100644
--- a/firmware/usb.c
+++ b/firmware/usb.c
@@ -218,6 +218,10 @@ static inline bool usb_reboot_button(void)
218#endif 218#endif
219#endif /* HAVE_USB_POWER */ 219#endif /* HAVE_USB_POWER */
220 220
221#ifdef USB_ENABLE_HID
222static bool usb_hid = true;
223#endif
224
221static void usb_thread(void) 225static void usb_thread(void)
222{ 226{
223 int num_acks_to_expect = 0; 227 int num_acks_to_expect = 0;
@@ -284,7 +288,7 @@ static void usb_thread(void)
284#ifdef USB_ENABLE_CHARGING_ONLY 288#ifdef USB_ENABLE_CHARGING_ONLY
285 usb_core_enable_driver(USB_DRIVER_HID, false); 289 usb_core_enable_driver(USB_DRIVER_HID, false);
286#else 290#else
287 usb_core_enable_driver(USB_DRIVER_HID, true); 291 usb_core_enable_driver(USB_DRIVER_HID, usb_hid);
288#endif /* USB_ENABLE_CHARGING_ONLY */ 292#endif /* USB_ENABLE_CHARGING_ONLY */
289#endif /* USB_ENABLE_HID */ 293#endif /* USB_ENABLE_HID */
290 294
@@ -307,7 +311,7 @@ static void usb_thread(void)
307 usb_core_enable_driver(USB_DRIVER_MASS_STORAGE, true); 311 usb_core_enable_driver(USB_DRIVER_MASS_STORAGE, true);
308#endif 312#endif
309#ifdef USB_ENABLE_HID 313#ifdef USB_ENABLE_HID
310 usb_core_enable_driver(USB_DRIVER_HID, true); 314 usb_core_enable_driver(USB_DRIVER_HID, usb_hid);
311#endif 315#endif
312#ifdef USB_ENABLE_CHARGING_ONLY 316#ifdef USB_ENABLE_CHARGING_ONLY
313 usb_core_enable_driver(USB_DRIVER_CHARGING_ONLY, false); 317 usb_core_enable_driver(USB_DRIVER_CHARGING_ONLY, false);
@@ -691,6 +695,14 @@ bool usb_powered(void)
691} 695}
692#endif 696#endif
693 697
698#ifdef USB_ENABLE_HID
699void usb_set_hid(bool enable)
700{
701 usb_hid = enable;
702 usb_core_enable_driver(USB_DRIVER_HID, usb_hid);
703}
704#endif
705
694#else 706#else
695 707
696#ifdef USB_NONE 708#ifdef USB_NONE