abcminiuser / python-elgato-streamdeck

Python library to control the Elgato Stream Deck.
Other
919 stars 137 forks source link

Pi Zero 2W Freezes after about 30 seconds #134

Open chazzawalla opened 9 months ago

chazzawalla commented 9 months ago

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:

[13:10:54] Updating key 7 for             home_assistant_streamdeck_yaml.py:1130
           light.kitchen_hue_zone_pendant
Traceback (most recent call last):
  File "/home/<username>/home-assistant-streamdeck-yaml/home_assistant_streamdeck_yaml.py", line 1943, in <module>
    main()
  File "/home/<username>/home-assistant-streamdeck-yaml/home_assistant_streamdeck_yaml.py", line 1932, in main
    asyncio.run(
  File "/usr/lib/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/home/<username>/home-assistant-streamdeck-yaml/home_assistant_streamdeck_yaml.py", line 1848, in run
    await handle_changes(websocket, complete_state, deck, config)
  File "/home/<username>/home-assistant-streamdeck-yaml/home_assistant_streamdeck_yaml.py", line 1092, in handle_changes
    await asyncio.gather(
  File "/home/<username>/home-assistant-streamdeck-yaml/home_assistant_streamdeck_yaml.py", line 1057, in process_websocket_messages
    _update_state(complete_state, data, config, deck)
  File "/home/<username>/home-assistant-streamdeck-yaml/home_assistant_streamdeck_yaml.py", line 1131, in _update_state
    update_key_image(
  File "/home/<username>/home-assistant-streamdeck-yaml/home_assistant_streamdeck_yaml.py", line 1476, in update_key_image
    deck.set_key_image(key, image)
  File "/home/<username>/.env/lib/python3.11/site-packages/StreamDeck/Devices/StreamDeckOriginalV2.py", line 139, in set_key_image
    self.device.write(payload + padding)
  File "/home/<username>/.env/lib/python3.11/site-packages/StreamDeck/Transport/LibUSBHIDAPI.py", line 407, in write
    return self.hidapi.write(self.device_handle, payload)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/<username>/.env/lib/python3.11/site-packages/StreamDeck/Transport/LibUSBHIDAPI.py", line 322, in write
    raise TransportError("Failed to write out report (%d)" % result)
StreamDeck.Transport.Transport.TransportError: Failed to write out 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)
(.env) <username>@ubuntu:~$

Any idea whats going on here?