usb: remove need to unplug usb storage device to finish unloading usb libs
What changed, and why it matters
This commit fixes a small user-experience bug in how Blockstream Jade's USB storage feature shuts down. Previously, the device had to wait for the user to physically unplug the USB storage device before it could finish turning off its USB libraries. The change now actively cuts power to the connected USB device so the software can detect it as 'unplugged' and complete cleanup automatically. There is no direct security vulnerability here; it is a robustness/usability improvement.
No immediate security action required. Treat as a normal code-quality/usability fix. If reviewing, verify that disable_usb_host() is safe to call from this context and does not race with other USB operations.
Security signals we found
No security-relevant signals in the diff or commit message
Change is a usability/robustness fix for USB host library teardown
No mention of vulnerabilities, researchers, CVEs, or security advisories
Evidence from the diff
In main/usbhmsc/usbhmsc.c, inside usbstorage_task(), the code now calls disable_usb_host() before invoking msc_host_uninstall() when the storage task is stopping and the host-side uninstall requires the USB device to be detached. This forces a detach event by powering down the USB host, allowing msc_host_uninstall() to proceed without waiting for a physical disconnect. The change is local, adds a single function call, and does not alter authentication, cryptography, or data-handling paths.
Changed components
main/usbhmsc/usbhmsc.cUSB mass-storage host task (usbstorage_task)USB host power/detach handlingInspect captured patch +4 / −0
diff --git a/main/usbhmsc/usbhmsc.c b/main/usbhmsc/usbhmsc.c
index c7e67ac..14f9d8c 100644
--- a/main/usbhmsc/usbhmsc.c
+++ b/main/usbhmsc/usbhmsc.c
@@ -214,6 +214,10 @@ static void usbstorage_task(void* ignore)
done = !usbstorage_is_enabled;
break;
} else if (!ebt && requires_host_uninstall && !usb_device_installed) {
+
+ // Stop powering any connected usb device to trigger detach events
+ disable_usb_host();
+
USB_LOGI(500, "msc_host_uninstall.. (1)");
esp_err_t err = msc_host_uninstall();
if (err == ESP_OK) {
Why this scored 16/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.