diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/export/usb_core.h | 5 | ||||
-rw-r--r-- | firmware/usbstack/usb_core.c | 13 |
2 files changed, 18 insertions, 0 deletions
diff --git a/firmware/export/usb_core.h b/firmware/export/usb_core.h index 3629645d53..a6cf086e18 100644 --- a/firmware/export/usb_core.h +++ b/firmware/export/usb_core.h | |||
@@ -57,5 +57,10 @@ int usb_core_ack_control(struct usb_ctrlrequest* req); | |||
57 | #ifdef HAVE_HOTSWAP | 57 | #ifdef HAVE_HOTSWAP |
58 | void usb_core_hotswap_event(int volume,bool inserted); | 58 | void usb_core_hotswap_event(int volume,bool inserted); |
59 | #endif | 59 | #endif |
60 | |||
61 | #ifdef HAVE_USB_POWER | ||
62 | unsigned short usb_allowed_current(void); | ||
63 | #endif | ||
64 | |||
60 | #endif | 65 | #endif |
61 | 66 | ||
diff --git a/firmware/usbstack/usb_core.c b/firmware/usbstack/usb_core.c index 759a342dd2..654ed95b4d 100644 --- a/firmware/usbstack/usb_core.c +++ b/firmware/usbstack/usb_core.c | |||
@@ -726,3 +726,16 @@ int usb_core_ack_control(struct usb_ctrlrequest* req) | |||
726 | return usb_drv_send(EP_CONTROL, NULL, 0); | 726 | return usb_drv_send(EP_CONTROL, NULL, 0); |
727 | } | 727 | } |
728 | 728 | ||
729 | #ifdef HAVE_USB_POWER | ||
730 | unsigned short usb_allowed_current() | ||
731 | { | ||
732 | if (usb_state == CONFIGURED) | ||
733 | { | ||
734 | return 500; | ||
735 | } | ||
736 | else | ||
737 | { | ||
738 | return 100; | ||
739 | } | ||
740 | } | ||
741 | #endif | ||