hibyr1: fix USB gadget UDC unbind (empty write is a no-op)

rockbox-gerrit-noreply--- via rockbox-cvs <[email protected]> Sat, 4 Jul 2026 13:50:02 -0400
Newsgroups gmane.comp.systems.archos.rockbox.cvs
Message-ID <[email protected]>
commit adbb185f7b96ab3e303af483a9a685c6acd09884
Author: Michael McAllister <[email protected]>
Date:   Thu Jul 2 20:56:29 2026 +0100

    hibyr1: fix USB gadget UDC unbind (empty write is a no-op)
    
    usb_enable(false) wrote "" to the gadget UDC attribute to unbind it, but
    sysfs_set_string("") doesn't do a write syscall.
    
    This meant that live USB-mode switches did nothing and required a reboot to take effect.
    
    
    Change-Id: I0fc9f54fdb2f529bfe24d5c1ed472c873401080e

diff --git a/firmware/target/hosted/hiby/usb-hiby-gadget.c b/firmware/target/hosted/hiby/usb-hiby-gadget.c
index 91e178dd03..651b25bb70 100644
--- a/firmware/target/hosted/hiby/usb-hiby-gadget.c
+++ b/firmware/target/hosted/hiby/usb-hiby-gadget.c
@@ -95,12 +95,8 @@ void usb_enable(bool on)
     logf(">>>>>>>>>>>>>>>>> usb_enable(%d)\n", on);
     logf("usb enable %d %d\n", on, _usb_mode);
 
-    /* Ignore usb enable/disable when ADB is enabled so we can fireup adb shell
-     * without entering ums mode
-     */
-    //if (_usb_mode != USB_MODE_ADB) {
-        sysfs_set_string("/sys/kernel/config/usb_gadget/adb_demo/UDC", on ? "13500000.otg_new" : "");
-    //}
+    sysfs_set_string("/sys/kernel/config/usb_gadget/adb_demo/UDC",
+                     on ? "13500000.otg_new" : "\n");
 }
 
 /* This is called by usb thread after usb extract in order to return
-- 
rockbox-cvs mailing list
[email protected]
https://lists.haxx.se/mailman/listinfo/rockbox-cvs