summaryrefslogtreecommitdiffstats
path: root/bootloader
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2021-10-04 16:42:36 -0400
committerWilliam Wilgus <wilgus.william@gmail.com>2021-10-04 16:42:36 -0400
commit0a1d25d27a50fca95305c7d3ee3bdcfec8dbdae1 (patch)
treeeedbece22c999ab0dd4921e2c06db10b2bda84d8 /bootloader
parente6740ed562b49cd2a2825ae3461f83e4a23b4c68 (diff)
downloadrockbox-0a1d25d27a50fca95305c7d3ee3bdcfec8dbdae1.tar.gz
rockbox-0a1d25d27a50fca95305c7d3ee3bdcfec8dbdae1.zip
Sansa E200v1 Bootloader ensure USB unplug is detected
Change-Id: Ibec5bf5e0f7a518fafc7b9fb8b95d420ef4ddfc0
Diffstat (limited to 'bootloader')
-rw-r--r--bootloader/main-pp.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/bootloader/main-pp.c b/bootloader/main-pp.c
index d1b45dfb66..15f6ad4fb7 100644
--- a/bootloader/main-pp.c
+++ b/bootloader/main-pp.c
@@ -234,7 +234,18 @@ static int handle_usb(int connect_timeout)
usb = USB_HANDLED;
usb_acknowledge(SYS_USB_CONNECTED_ACK);
+#if defined(SANSA_E200) && defined(HAVE_BOOTLOADER_USB_MODE)
+ /* E200 misses unplug randomly
+ probably fine for other targets too but needs tested */
+ while (usb_wait_for_disconnect_w_tmo(&q, HZ * 5) > 0)
+ {
+ /* timeout */
+ if (!usb_plugged())
+ break;
+ }
+#else
usb_wait_for_disconnect(&q);
+#endif
break;
}