Repository navigation
Pi Zero 2W Freezes after about 30 seconds #134
Description
Activity
I had the same problem with Raspberry Pi 3B+ running Ubuntu 24.04 64-bit when interfacing Stream Deck Neo. It was running for several seconds, then all subsequent runs were failing with
StreamDeck.Transport.Transport.TransportErrorand only RPi reboot could help.It turns out that Ubuntu images ship with
dwc2,dr_mode=otgas default setting instead ofdwc2,dr_mode=host(default on Raspbian), which impacts the onboard USB controller (DWC2) ability to handle large HID Feature reports.To solve the issue, you need to append
dtoverlay=dwc2,dr_mode=hostto/boot/firmware/config.txtand reboot.
A few words on my debugging, maybe something will help maintainers.
Output from failing
example_neo.pyusually looks like that (but sometimes it can pass reset and fail on first write command):Found 1 Stream Deck(s). Traceback (most recent call last): File "/home/daniel/streamdeck/example_neo.py", line 145, in <module> deck.reset() File "/usr/local/lib/python3.12/dist-packages/StreamDeck/Devices/StreamDeckNeo.py", line 120, in reset self.device.write_feature(payload) File "/usr/local/lib/python3.12/dist-packages/StreamDeck/Transport/LibUSBHIDAPI.py", line 400, in write_feature return self.hidapi.send_feature_report(self.device_handle, payload) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/dist-packages/StreamDeck/Transport/LibUSBHIDAPI.py", line 260, in send_feature_report raise TransportError("Failed to write feature report (%d)" % result) StreamDeck.Transport.Transport.TransportError: Failed to write feature report (-1) python3: ../../libusb/os/threads_posix.h:46: usbi_mutex_lock: Assertion `pthread_mutex_lock(mutex) == 0' failed. python3: ../../libusb/os/threads_posix.h:58: usbi_mutex_destroy: Assertion `pthread_mutex_destroy(mutex) == 0' failed. Aborted (core dumped)Those assertions failures (last 3 lines) are not the root cause, rather symptom of improper exit. I suspect there's something out of order in handling HID device closure, but I know just a few things about USB. Anyway, removing
self.HIDAPI_INSTANCE.hid_exit()didn't impactFailed to write out report (-1), but assertions were gone. This could be fixed, as it's easy to trigger an ugly error withCtrl+Ceven if things still work.I also tried making payloads of
hidapi.send_feature_reportandhidapi.writetruncated, but writes were always failing.The problem is not with the device, I could make it fail on RPi, disconnect it, connect to some other computer with Elgato software, run it there, reconnect back to RPi, and it'd behave like before.
OP has "Stream Deck original V2" which seems to be "Stream Deck Mk.2" and I guess it may be similar to my Neo (both use USB-C). Thus, both devices may be similarly too new or too heavy for OTG mode.
If needed, I could do some USB traffic sniffing to help further, but for my scenario it's enough to keep
dwc2,dr_mode=host(dwc_otgdoes not work on my board).Some more context on https://raspberrypi.stackexchange.com/a/77061
I'm cross-posting this from the home_assistant_streamdeck_yaml git, which is the python script I'm running when this happens - but it looks like the issue might be related to the LibUSBHIDAPI code so thought it might be more relevant to the folks over here
Hi all, I went through two identical installs over the last week - first on an RPi 4 (works flawlessly), then on a Pi Zero 2 W so I can get that smaller footprint.
The problem is on the Pi Zero, it'll work great at first but after +/- 30 seconds the Streamdeck freezes up.
Sometimes I get some code in terminal, sometimes not. Here's what I saw last time:
Any idea whats going on here?