timothycrosley / streamdeck-ui

A Linux compatible UI for the Elgato Stream Deck.
https://timothycrosley.github.io/streamdeck-ui/
MIT License
1.12k stars 241 forks source link

Ubuntu 20.04 - Streamdeck broken #69

Closed RobertBerger closed 3 years ago

RobertBerger commented 3 years ago
$ cat /etc/issue
Ubuntu 20.04.1 LTS \n \l
$ sudo apt upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
$ sudo apt install libhidapi-hidraw0 libudev-dev libusb-1.0-0-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libusb-1.0-0-dev is already the newest version (2:1.0.23-2build1).
libhidapi-hidraw0 is already the newest version (0.9.0+dfsg-1).
libudev-dev is already the newest version (245.4-4ubuntu3.2).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
$ lsusb | grep Elgato
Bus 001 Device 011: ID 0fd9:006d Elgato Systems GmbH Sierra Wireless EM7455 Qualcomm Snapdragon X7 LTE-A
$ cat /etc/udev/rules.d/99-streamdeck.rules
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="0060", MODE:="666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="0063", MODE:="666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="006c", MODE:="666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fd9", ATTRS{idProduct}=="006d", MODE:="666", GROUP="plugdev"
$ pip3 install --user streamdeck_ui
Collecting streamdeck_ui
  Using cached streamdeck_ui-1.0.2-py3-none-any.whl (1.2 MB)
Requirement already satisfied: pynput<2.0,>=1.4 in ./.local/lib/python3.8/site-packages (from streamdeck_ui) (1.6.8)
Requirement already satisfied: hidapi<0.8.0,>=0.7.99 in ./.local/lib/python3.8/site-packages (from streamdeck_ui) (0.7.99.post21)
Requirement already satisfied: pillow<7.0,>=6.1 in ./.local/lib/python3.8/site-packages (from streamdeck_ui) (6.2.2)
Requirement already satisfied: pyside2<6.0,>=5.13 in ./.local/lib/python3.8/site-packages (from streamdeck_ui) (5.15.0)
Requirement already satisfied: streamdeck<0.7.0,>=0.6.3 in ./.local/lib/python3.8/site-packages (from streamdeck_ui) (0.6.3)
Requirement already satisfied: six in /usr/lib/python3/dist-packages (from pynput<2.0,>=1.4->streamdeck_ui) (1.14.0)
Requirement already satisfied: python-xlib>=0.17; "linux" in sys_platform in ./.local/lib/python3.8/site-packages (from pynput<2.0,>=1.4->streamdeck_ui) (0.27)
Requirement already satisfied: setuptools>=19.0 in /usr/lib/python3/dist-packages (from hidapi<0.8.0,>=0.7.99->streamdeck_ui) (45.2.0)
Requirement already satisfied: shiboken2==5.15.0 in ./.local/lib/python3.8/site-packages (from pyside2<6.0,>=5.13->streamdeck_ui) (5.15.0)
Installing collected packages: streamdeck-ui
Successfully installed streamdeck-ui-1.0.2
$ sudo usermod -a -G plugdev `whoami`
$ which streamdeck
/home/rber/.local/bin/streamdeck
rber@t460s-4:~$ /home/rber/.local/bin/streamdeck
Traceback (most recent call last):
  File "/home/rber/.local/bin/streamdeck", line 8, in <module>
    sys.exit(start())
  File "/home/rber/.local/lib/python3.8/site-packages/streamdeck_ui/gui.py", line 266, in start
    for deck_id, deck in api.open_decks().items():
  File "/home/rber/.local/lib/python3.8/site-packages/streamdeck_ui/api.py", line 99, in open_decks
    for deck in DeviceManager.DeviceManager().enumerate():
  File "/home/rber/.local/lib/python3.8/site-packages/StreamDeck/DeviceManager.py", line 90, in __init__
    self.transport = self._get_transport(transport)
  File "/home/rber/.local/lib/python3.8/site-packages/StreamDeck/DeviceManager.py", line 82, in _get_transport
    raise ProbeError("Probe failed to find any functional HID backend.", probe_errors)
StreamDeck.DeviceManager.ProbeError: ('Probe failed to find any functional HID backend.', {'hid': OSError('The libhidapi-hidraw0 backend is currently blacklisted for StreamD
eck devices.'), 'hidapi': TypeError("enumerate() got an unexpected keyword argument 'vendor_id'")})
RobertBerger commented 3 years ago

I tried this:

$ sudo apt install -y python3-pip
[sudo] password for rber:
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-pip is already the newest version (20.0.2-5ubuntu1.1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
$ sudo apt remove --auto-remove libhidapi-hidraw0
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
  libhidapi-hidraw0 python3-cffi python3-hidapi python3-ply python3-pycparser
0 upgraded, 0 newly installed, 5 to remove and 0 not upgraded.
After this operation, 1289 kB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 220823 files and directories currently installed.)
Removing python3-hidapi (0.2.2-1.1build1) ...
Removing libhidapi-hidraw0:amd64 (0.9.0+dfsg-1) ...
Removing python3-cffi (1.14.0-1build1) ...
Removing python3-pycparser (2.19-1ubuntu1) ...
Removing python3-ply (3.11-3build1) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.1) ...
$ sudo apt install -y libudev-dev libusb-1.0-0-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
libusb-1.0-0-dev is already the newest version (2:1.0.23-2build1).
libudev-dev is already the newest version (245.4-4ubuntu3.2).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
$ pip3 install hidapi
Requirement already satisfied: hidapi in /home/rber/.local/lib/python3.8/site-packages (0.7.99.post21)
Requirement already satisfied: setuptools>=19.0 in /usr/lib/python3/dist-packages (from hidapi) (45.2.0)
$ pip3 install pillow
Requirement already satisfied: pillow in /home/rber/.local/lib/python3.8/site-packages (6.2.2)
$ pip3 install git+https://github.com/timothycrosley/streamdeck-ui
Collecting git+https://github.com/timothycrosley/streamdeck-ui
  Cloning https://github.com/timothycrosley/streamdeck-ui to /tmp/pip-req-build-a799cjzr
  Running command git clone -q https://github.com/timothycrosley/streamdeck-ui /tmp/pip-req-build-a799cjzr
  Installing build dependencies ... done 
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Requirement already satisfied: hidapi<0.8.0,>=0.7.99 in /home/rber/.local/lib/python3.8/site-packages (from streamdeck-ui==1.0.2) (0.7.99.post21)
Requirement already satisfied: streamdeck<0.7.0,>=0.6.3 in /home/rber/.local/lib/python3.8/site-packages (from streamdeck-ui==1.0.2) (0.6.3)
Requirement already satisfied: pillow<7.0,>=6.1 in /home/rber/.local/lib/python3.8/site-packages (from streamdeck-ui==1.0.2) (6.2.2)
Requirement already satisfied: pyside2<6.0,>=5.13 in /home/rber/.local/lib/python3.8/site-packages (from streamdeck-ui==1.0.2) (5.15.0)
Requirement already satisfied: pynput<2.0,>=1.4 in /home/rber/.local/lib/python3.8/site-packages (from streamdeck-ui==1.0.2) (1.6.8)
Requirement already satisfied: setuptools>=19.0 in /usr/lib/python3/dist-packages (from hidapi<0.8.0,>=0.7.99->streamdeck-ui==1.0.2) (45.2.0)
Requirement already satisfied: shiboken2==5.15.0 in /home/rber/.local/lib/python3.8/site-packages (from pyside2<6.0,>=5.13->streamdeck-ui==1.0.2) (5.15.0)
Requirement already satisfied: six in /usr/lib/python3/dist-packages (from pynput<2.0,>=1.4->streamdeck-ui==1.0.2) (1.14.0)
Requirement already satisfied: python-xlib>=0.17; "linux" in sys_platform in /home/rber/.local/lib/python3.8/site-packages (from pynput<2.0,>=1.4->streamdeck-ui==1.0.2) (0.27)
Building wheels for collected packages: streamdeck-ui
  Building wheel for streamdeck-ui (PEP 517) ... done
  Created wheel for streamdeck-ui: filename=streamdeck_ui-1.0.2-py3-none-any.whl size=1157010 sha256=50aec4b6e46dae7b4a6590beee5325ff25424b2a709af921461773eb2d812c17
  Stored in directory: /tmp/pip-ephem-wheel-cache-v8x7euvc/wheels/75/6f/8c/1fd7e2305bf0a41edc8293e897ceb39277ac7f5b0504931879
Successfully built streamdeck-ui
Installing collected packages: streamdeck-ui
Successfully installed streamdeck-ui-1.0.2
$ which streamdeck
/home/rber/.local/bin/streamdeck
$ /home/rber/.local/bin/streamdeck
Traceback (most recent call last):
  File "/home/rber/.local/bin/streamdeck", line 8, in <module>
    sys.exit(start())
  File "/home/rber/.local/lib/python3.8/site-packages/streamdeck_ui/gui.py", line 266, in start
    for deck_id, deck in api.open_decks().items():
  File "/home/rber/.local/lib/python3.8/site-packages/streamdeck_ui/api.py", line 99, in open_decks
    for deck in DeviceManager.DeviceManager().enumerate():
  File "/home/rber/.local/lib/python3.8/site-packages/StreamDeck/DeviceManager.py", line 90, in __init__
    self.transport = self._get_transport(transport)
  File "/home/rber/.local/lib/python3.8/site-packages/StreamDeck/DeviceManager.py", line 82, in _get_transport
    raise ProbeError("Probe failed to find any functional HID backend.", probe_errors)
StreamDeck.DeviceManager.ProbeError: ('Probe failed to find any functional HID backend.', {'hid': ImportError('Unable to load any of the following libraries:libhidapi-hidraw.so libhidapi-hidraw.so.0 libhidapi-libusb.so libhidapi-libusb.so.0 libhidapi-iohidmanager.so libhidapi-iohidmanager.so.0 libhidapi.dylib hidapi.dll libhidapi-0.dll'), 'hidapi': ImportError('Unable to load any of the following libraries:libhidapi-hidraw.so libhidapi-hidraw.so.0 libhidapi-libusb.so libhidapi-libusb.so.0 libhidapi-iohidmanager.so libhidapi-iohidmanager.so.0 libhidapi.dylib hidapi.dll libhidapi-0.dll')})
RobertBerger commented 3 years ago
$ sudo apt remove libhidapi-hidraw0
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package 'libhidapi-hidraw0' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
$ sudo apt install libhidapi-libusb0
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  libhidapi-libusb0
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 14,5 kB of archives.
After this operation, 61,4 kB of additional disk space will be used.
Get:1 http://gr.archive.ubuntu.com/ubuntu focal/universe amd64 libhidapi-libusb0 amd64 0.9.0+dfsg-1 [14,5 kB]
Fetched 14,5 kB in 1s (15,7 kB/s)            
Selecting previously unselected package libhidapi-libusb0:amd64.
(Reading database ... 220591 files and directories currently installed.)
Preparing to unpack .../libhidapi-libusb0_0.9.0+dfsg-1_amd64.deb ...
Unpacking libhidapi-libusb0:amd64 (0.9.0+dfsg-1) ...
Setting up libhidapi-libusb0:amd64 (0.9.0+dfsg-1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.1) ...

It looks like that made it work ;)

I highly recommend updating the instructions here[1]. And also it might help to inform people who package it for various distros. [1]https://timothycrosley.github.io/streamdeck-ui/

RobertBerger commented 3 years ago

One more thing:

Even after the fix there needs to be "enough bandwidth" on the USB port where Streamdeck is conntected to.

[  482.872455] usb 1-3.2: new high-speed USB device number 14 using xhci_hcd
[  482.973281] usb 1-3.2: New USB device found, idVendor=0fd9, idProduct=006d, bcdDevice= 2.00
[  482.973284] usb 1-3.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  482.973286] usb 1-3.2: Product: Stream Deck
[  482.973287] usb 1-3.2: Manufacturer: Elgato
[  482.973289] usb 1-3.2: SerialNumber: AL10J2C06779
[  482.973883] usb 1-3.2: Not enough bandwidth for new device state.

Connected to another free port and it worked again ;) Doc update?

cohan commented 3 years ago

Connected to another free port and it worked again

Perfect. Sorted it the problem I had. Thank you :smile:

hutber commented 3 years ago

Same issue for me, still trying to hunt down why.

hutber commented 3 years ago

Ok, so for me, it turns out that despite me thinking "No, that USB port 100% works... it turns out changing the USB port was the key to getting this working... shocked and stunned :D

RobertBerger commented 3 years ago

@hutber Might be speed limitations. For some reason, streamdeck seems to request a huge USB bandwidth for what it does.

dodgyrabbit commented 3 years ago

The usb library dependency stuff is quite a nightmare to be honest. I'll try explain it as best I can here for future reference:

Version 1.0.2 of streamdeck-ui uses version 0.6.3 of the streamdeck python library. This v 0.6.3, would "detect" which python library you installed for communicating with the streamdeck device. It would be either hid or hidapi. Some nuanced issues can crop up, mostly if you have both libhidapi-libusb0 and libhidapi-hidraw0 installed. The libhidapi-hidraw0 library is not compatible with all stream decks but libhidapi-libusb0 is, but sometimes it would pick the wrong one.

Fast forward to today: Version 1.0.3 (currently being worked on) uses version 0.8.3 of streamdeck. It no longer requires a python library to provide communication to the streamdeck device. Instead, it directly accesses the LibUSB HIDAPI Backend. That work started here.

TLDR: In the upcoming 1.0.3 release you just need libhidapi-libusb0 installed. It should work even if you had libhidapi-hidraw0 installed (it will choose the right one).