summaryrefslogtreecommitdiff
path: root/firmware/usbstack/usb_core.c
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2021-10-02 11:53:20 +0100
committerAidan MacDonald <amachronic@protonmail.com>2021-10-02 15:09:46 +0100
commit3a89fdee96eadda10a6024bd1162fae696654ae6 (patch)
tree2b10f6da1d5575e5ff5831ed173f8daa7069a771 /firmware/usbstack/usb_core.c
parentd435bb77b57a2c3ec1f3e447101bb6bbb7d163e1 (diff)
downloadrockbox-3a89fdee96eadda10a6024bd1162fae696654ae6.tar.gz
rockbox-3a89fdee96eadda10a6024bd1162fae696654ae6.zip
x1000: fix hang that may occur in USB mode
Upon getting a USB reset, the USB core will update charging current by calling usb_charging_maxcurrent_change(). On all current X1000 targets this may cause a hang, since changing the charge current involves a blocking I2C transaction. Eg. if the host issues a reset when we're already configured as part of error recovery, the change from 500 mA -> 100 mA will cause a hang. Change-Id: I5b45272c01fa16b179ae3d16bbc50c7fab9a416b
Diffstat (limited to 'firmware/usbstack/usb_core.c')
-rw-r--r--firmware/usbstack/usb_core.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/firmware/usbstack/usb_core.c b/firmware/usbstack/usb_core.c
index bf73c58abc..65bf7293c8 100644
--- a/firmware/usbstack/usb_core.c
+++ b/firmware/usbstack/usb_core.c
@@ -928,8 +928,14 @@ void usb_core_bus_reset(void)
928 usb_address = 0; 928 usb_address = 0;
929 usb_state = DEFAULT; 929 usb_state = DEFAULT;
930#ifdef HAVE_USB_CHARGING_ENABLE 930#ifdef HAVE_USB_CHARGING_ENABLE
931#ifdef HAVE_USB_CHARGING_IN_THREAD
932 /* On some targets usb_charging_maxcurrent_change() cannot be called
933 * from an interrupt handler; get the USB thread to do it instead. */
934 usb_charger_update();
935#else
931 usb_charging_maxcurrent_change(usb_charging_maxcurrent()); 936 usb_charging_maxcurrent_change(usb_charging_maxcurrent());
932#endif 937#endif
938#endif
933} 939}
934 940
935/* called by usb_drv_transfer_completed() */ 941/* called by usb_drv_transfer_completed() */