I found a fix, if you replace the line:
if lsmod | grep -q "dwc2"; then
with:
if [ -d /sys/class/udc ] && [ -n "$(ls -A /sys/class/udc)" ]; then
Apparently the problem is on some pi 2s since Foley said his worked with no issues.
I found a fix, if you replace the line:
if lsmod | grep -q "dwc2"; then
with:
if [ -d /sys/class/udc ] && [ -n "$(ls -A /sys/class/udc)" ]; then
Apparently the problem is on some pi 2s since Foley said his worked with no issues.
lsmod finds a dwc2 on my pi running the service
uname -a
Linux foley-rover 6.18.34+rpt-rpi-v7 #1 SMP Raspbian 1:6.18.34-1+rpt1 (2026-06-09) armv7l GNU/Linux
lsmod finds a dwc2 on my pi running the service
uname -a
Linux foley-rover 6.18.34+rpt-rpi-v7 #1 SMP Raspbian 1:6.18.34-1+rpt1 (2026-06-09) armv7l GNU/Linux
aleksa24@aleksa24-pi2:~$ uname -a
Linux aleksa24-pi2 6.18.39+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.18.39-1+rpt1 (2026-07-29) aarch64 GNU/Linux
This is mine, seems like a later version
aleksa24@aleksa24-pi2:~$ uname -a
Linux aleksa24-pi2 6.18.39+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.18.39-1+rpt1 (2026-07-29) aarch64 GNU/Linux
This is mine, seems like a later version
It looks like dwc2 is not built as a module on later kernels, so it does not show up as a module with lsmod. They also seem to have deprecated the USB serial gadget. g_serial is still a module, though, but marked legacy.
It looks like `dwc2` is not built as a module on later kernels, so it does not show up as a module with lsmod. They also seem to have deprecated the USB serial gadget. `g_serial` is still a module, though, but marked legacy.
I updated my (not fresh) install on a pi zero w 2 and still get dwc2
foley@foley-rover:~ $ lsmod | grep dwc
dwc2 176128 0
roles 16384 1 dwc2
foley@foley-rover:~ $ uname -a
Linux foley-rover 6.18.39+rpt-rpi-v7 #1 SMP Raspbian 1:6.18.39-1+rpt1 (2026-07-29) armv7l GNU/Linux
I updated my (not fresh) install on a pi zero w 2 and still get dwc2
foley@foley-rover:~ $ lsmod | grep dwc
dwc2 176128 0
roles 16384 1 dwc2
foley@foley-rover:~ $ uname -a
Linux foley-rover 6.18.39+rpt-rpi-v7 #1 SMP Raspbian 1:6.18.39-1+rpt1 (2026-07-29) armv7l GNU/Linux
Commit 9c49411159 now includes the check for udc. I need to figure out how best to "disable" it. I think I will have the script check for a DWC or gadget file in the /boot/firmware directory which can be changed directly on the SD card without booting the Pi.
Commit 9c49411159038efc998d723b9e31ccdb79b4ed23 now includes the check for udc. I need to figure out how best to "disable" it. I think I will have the script check for a DWC or gadget file in the `/boot/firmware` directory which can be changed directly on the SD card without booting the Pi.
commit e6a0556147 now has it look for a file called GADGET_MODE in /boot/firmware (accessible by an SD card reader) to enable or disable. My initial test says it works.
commit e6a0556147a62b18a81237024c9d8c5278a7ed31 now has it look for a file called GADGET_MODE in /boot/firmware (accessible by an SD card reader) to enable or disable. My initial test says it works.
@marcel reminds me that serial USB is depricated and perhaps we need to use the supported (and suggested) ethernet gadget which is documented in https://github.com/raspberrypi/rpi-usb-gadget
I just tested the pre-installed rpi-usb-gadget and it just worked. I think I'll change the directions to have people just use that instead of the serial method.
I just tested the pre-installed rpi-usb-gadget and it just worked. I think I'll change the directions to have people just use that instead of the serial method.
We have a system that works (but is tricky to turn back on offline) but I consider this bug fixed for now. I'll continue work on making that switch work in branch dwc-detect on Issue #1
We have a system that works (but is tricky to turn back on offline) but I consider this bug fixed for now. I'll continue work on making that switch work in branch dwc-detect on Issue #1
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
I found a fix, if you replace the line:
if lsmod | grep -q "dwc2"; then
with:
if [ -d /sys/class/udc ] && [ -n "$(ls -A /sys/class/udc)" ]; then
Apparently the problem is on some pi 2s since Foley said his worked with no issues.
lsmod finds a dwc2 on my pi running the service
uname -a
Linux foley-rover 6.18.34+rpt-rpi-v7 #1 SMP Raspbian 1:6.18.34-1+rpt1 (2026-06-09) armv7l GNU/Linux
aleksa24@aleksa24-pi2:~$ uname -a
Linux aleksa24-pi2 6.18.39+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.18.39-1+rpt1 (2026-07-29) aarch64 GNU/Linux
This is mine, seems like a later version
It looks like
dwc2is not built as a module on later kernels, so it does not show up as a module with lsmod. They also seem to have deprecated the USB serial gadget.g_serialis still a module, though, but marked legacy.I updated my (not fresh) install on a pi zero w 2 and still get dwc2
foley@foley-rover:~ $ lsmod | grep dwc
dwc2 176128 0
roles 16384 1 dwc2
foley@foley-rover:~ $ uname -a
Linux foley-rover 6.18.39+rpt-rpi-v7 #1 SMP Raspbian 1:6.18.39-1+rpt1 (2026-07-29) armv7l GNU/Linux
@marcel reminds me that he discovered this earlier. I will need to reflash a pi zero w 2 image on a SD and see if also happens to me.
Commit
9c49411159now includes the check for udc. I need to figure out how best to "disable" it. I think I will have the script check for a DWC or gadget file in the/boot/firmwaredirectory which can be changed directly on the SD card without booting the Pi.commit
e6a0556147now has it look for a file called GADGET_MODE in /boot/firmware (accessible by an SD card reader) to enable or disable. My initial test says it works.Weird. It's not coming back up. I need to do more debugging.
@marcel reminds me that serial USB is depricated and perhaps we need to use the supported (and suggested) ethernet gadget which is documented in https://github.com/raspberrypi/rpi-usb-gadget
I just tested the pre-installed rpi-usb-gadget and it just worked. I think I'll change the directions to have people just use that instead of the serial method.
dwc2-detectto dwc2-detectWe have a system that works (but is tricky to turn back on offline) but I consider this bug fixed for now. I'll continue work on making that switch work in branch dwc-detect on Issue #1