GithubHelp home page GithubHelp logo

Comments (22)

abcminiuser avatar abcminiuser commented on May 18, 2024 2

Too damned hot today to spin up any more machines in the house. Leaving some note here for when I get back to this.

  • The error (outside of the permissions error @xorbital gets that's likely due to a missing udev rule) is consistent.
  • Issue seems to only affect Linux systems, HID backend, and the StreamDeck XL.
  • Both @xorbital and @BS-Tek get the same behavior; feature reports work for reading the serial number, but writes to the data endpoint fail.

Digging into the HID library code:
https://github.com/libusb/hidapi/blob/master/linux/hid.c#L697

It looks like the write() to the device handle is returning -1, indicating an error (see https://linux.die.net/man/2/write). When write() fails it should populate errno which is then converted to a human readable string via strerror and stashed into the device context. When the python HID code receives the -1 return code it throws an exception and returns that stringified error (see https://github.com/apmorton/pyhidapi/blob/master/hid/__init__.py#L139) which returns None for both test cases.

That means that write() fails, and the code to retrieve the error is succeeding, but returning NULL. The only thing I can think of that could cause that would be either errno failing to be set correctly, or strerror() failing to return a readable string.

Current Linux hidraw implementation for the underlying write (assuming it's making it that far) has a few interesting failure paths: https://github.com/torvalds/linux/blob/master/drivers/hid/hidraw.c#L103

I might have to make a C/C++ test app for either of you to try to call the write() function and return the errno so I can try to figure out what's going on.

from python-elgato-streamdeck.

abcminiuser avatar abcminiuser commented on May 18, 2024 1

Thanks for the very detailed report @BS-Tek!

Strangely some users report that the 0.5.1 works on the XL (see #20) while you and @xorbital report that it doesn't work at all.

I suspect that this comes down to the HIDAPI library backend I was using - it has the benefits of very easy installation across the three major platforms, but comes with the downside of being old, unmaintaned and apparently contains quite a few bugs and compatibility issues.

I've just merged in my patch in aff0c2b that adds a new HID library backend. This one requires manual installation of a library DLL on Windows but is much more up to date -- can you please try it and report back if it fixes the issue for you please? Note that HID and HIDAPI libraries conflict with oneanother, so you'll have to remove one before installing the other.

from python-elgato-streamdeck.

xorbital avatar xorbital commented on May 18, 2024

I can confirm this behavior on multiple systems running Ubuntu and Arch, I couldn't get this library to work in any way sadly.
The only example that works is the one that reads the device info.
This affects the UI as well.

from python-elgato-streamdeck.

xorbital avatar xorbital commented on May 18, 2024

I've seen your patch and merged it locally a few days ago, that didn't do it either sadly. I've tried again, pulling the repo now and running python3 example_basic.py results in:

Traceback (most recent call last):
  File "src/example_basic.py", line 108, in <module>
    streamdecks = DeviceManager().enumerate()
  File "/home/xorbital/python-elgato-streamdeck/src/StreamDeck/DeviceManager.py", line 102, in enumerate
    found_devices = self.transport.enumerate(vid=vid, pid=pid)
  File "/home/xorbital/python-elgato-streamdeck/src/StreamDeck/Transport/HID.py", line 182, in enumerate
    return [HID.Device(d) for d in devices]
  File "/home/xorbital/python-elgato-streamdeck/src/StreamDeck/Transport/HID.py", line 182, in <listcomp>
    return [HID.Device(d) for d in devices]
  File "/home/xorbital/python-elgato-streamdeck/src/StreamDeck/Transport/HID.py", line 31, in __init__
    self.hid = hid.Device(vid=device_info['vendor_id'], pid=device_info['product_id'])
  File "/usr/lib/python3.7/site-packages/hid/__init__.py", line 130, in __init__
    raise HIDException('unable to open device')
hid.HIDException: unable to open device
Exception ignored in: <function HID.Device.__del__ at 0x7f31ce974830>
Traceback (most recent call last):
  File "/home/xorbital/python-elgato-streamdeck/src/StreamDeck/Transport/HID.py", line 39, in __del__
    self.hid.close()
AttributeError: 'Device' object has no attribute 'hid'

sudo python3 example_basic.py results in:

Found 1 Stream Deck(s).

Opened 'Stream Deck XL' device (serial number: '(display the correct serial number)')
Traceback (most recent call last):
  File "src/example_basic.py", line 123, in <module>
    update_key_image(deck, key, False)
  File "src/example_basic.py", line 82, in update_key_image
    deck.set_key_image(key, image)
  File "/home/xorbital/python-elgato-streamdeck/src/StreamDeck/Devices/StreamDeckXL.py", line 185, in set_key_image
    self.device.write(payload)
  File "/home/xorbital/python-elgato-streamdeck/src/StreamDeck/Transport/HID.py", line 134, in write
    return self.hid.write(payload)
  File "/usr/lib/python3.7/site-packages/hid/__init__.py", line 149, in write
    return self.__hidcall(hidapi.hid_write, self.__dev, data, len(data))
  File "/usr/lib/python3.7/site-packages/hid/__init__.py", line 140, in __hidcall
    raise HIDException(err)
hid.HIDException: None

Running Manjaro with package hidapi and libusb installed, I removed the python hidapi package and installed hid

from python-elgato-streamdeck.

BS-Tek avatar BS-Tek commented on May 18, 2024

After cloning version 0.6.0 I uninstalled HIDAPI and installed HID.

pip3 uninstall hidapi
pip3 install hid
sudo apt install libhidapi-hidraw0 libhidapi-libusb0

Running sudo ./example_basic.py with the XL connected detects and initializes the XL, the logo goes away and the backlight is changed but after about 5 seconds it returns the following error:

sudo ./example_basic.py
Found 1 Stream Deck(s).

Opened 'Stream Deck XL' device (serial number: 'CL30I1A03593')
Traceback (most recent call last):
  File "./example_basic.py", line 123, in <module>
    update_key_image(deck, key, False)
  File "./example_basic.py", line 82, in update_key_image
    deck.set_key_image(key, image)
  File "/home/pi/python-elgato-streamdeck/src/StreamDeck/Devices/StreamDeckXL.py", line 185, in set_key_image
    self.device.write(payload)
  File "/home/pi/python-elgato-streamdeck/src/StreamDeck/Transport/HID.py", line 134, in write
    return self.hid.write(payload)
  File "/usr/local/lib/python3.7/dist-packages/hid/__init__.py", line 149, in write
    return self.__hidcall(hidapi.hid_write, self.__dev, data, len(data))
  File "/usr/local/lib/python3.7/dist-packages/hid/__init__.py", line 140, in __hidcall
    raise HIDException(err)
hid.HIDException: None

On subsequent runs, the XL is detected and the following error is returned after a pause of about 5 seconds, it never returns from deck.open().

sudo ./example_basic.py
Found 1 Stream Deck(s).

Traceback (most recent call last):
  File "./example_basic.py", line 113, in <module>
    deck.open()
  File "/home/pi/python-elgato-streamdeck/src/StreamDeck/Devices/StreamDeck.py", line 116, in open
    self._reset_key_stream()
  File "/home/pi/python-elgato-streamdeck/src/StreamDeck/Devices/StreamDeckXL.py", line 99, in _reset_key_stream
    self.device.write(payload)
  File "/home/pi/python-elgato-streamdeck/src/StreamDeck/Transport/HID.py", line 134, in write
    return self.hid.write(payload)
  File "/usr/local/lib/python3.7/dist-packages/hid/__init__.py", line 149, in write
    return self.__hidcall(hidapi.hid_write, self.__dev, data, len(data))
  File "/usr/local/lib/python3.7/dist-packages/hid/__init__.py", line 140, in __hidcall
    raise HIDException(err)
hid.HIDException: None

It is necessary to unplug the XL to have the device opened again.

Connecting the Stream Deck Original and running sudo ./example_basic.py returns this error without any delay:

sudo ./example_basic.py
Found 1 Stream Deck(s).

Traceback (most recent call last):
  File "./example_basic.py", line 113, in <module>
    deck.open()
  File "/home/pi/python-elgato-streamdeck/src/StreamDeck/Devices/StreamDeck.py", line 116, in open
    self._reset_key_stream()
  File "/home/pi/python-elgato-streamdeck/src/StreamDeck/Devices/StreamDeckOriginal.py", line 79, in _reset_key_stream
    self.device.write(payload)
  File "/home/pi/python-elgato-streamdeck/src/StreamDeck/Transport/HID.py", line 134, in write
    return self.hid.write(payload)
  File "/usr/local/lib/python3.7/dist-packages/hid/__init__.py", line 149, in write
    return self.__hidcall(hidapi.hid_write, self.__dev, data, len(data))
  File "/usr/local/lib/python3.7/dist-packages/hid/__init__.py", line 140, in __hidcall
    raise HIDException(err)
hid.HIDException: None

Running sudo ./example_deckinfo.py with the XL connected returns the following without any errors and this can be run multiple times:

sudo ./example_deckinfo.py
Found 1 Stream Deck(s).

Deck 0 - Stream Deck XL.
         - ID: b'/dev/hidraw0'
         - Serial: 'CL30I1A03593'
         - Firmware Version: '1.00.006'
         - Key Count: 32 (4x8 grid)
         - Key Images: 96x96 pixels, JPEG format, rotated 0 degrees, mirrored horizontally/vertically

Running sudo ./example_deckinfo.py with the Stream Deck Classic connected returns the following error every time:

sudo ./example_deckinfo.py
Found 1 Stream Deck(s).

Traceback (most recent call last):
  File "./example_deckinfo.py", line 49, in <module>
    deck.open()
  File "/home/pi/python-elgato-streamdeck/src/StreamDeck/Devices/StreamDeck.py", line 116, in open
    self._reset_key_stream()
  File "/home/pi/python-elgato-streamdeck/src/StreamDeck/Devices/StreamDeckOriginal.py", line 79, in _reset_key_stream
    self.device.write(payload)
  File "/home/pi/python-elgato-streamdeck/src/StreamDeck/Transport/HID.py", line 134, in write
    return self.hid.write(payload)
  File "/usr/local/lib/python3.7/dist-packages/hid/__init__.py", line 149, in write
    return self.__hidcall(hidapi.hid_write, self.__dev, data, len(data))
  File "/usr/local/lib/python3.7/dist-packages/hid/__init__.py", line 140, in __hidcall
    raise HIDException(err)
hid.HIDException: None

Running sudo ./example_deckinfo.py with both the XL and the Stream Deck Classic connected returns the following error every time:

sudo ./example_deckinfo.py
Found 2 Stream Deck(s).

Traceback (most recent call last):
  File "./example_deckinfo.py", line 49, in <module>
    deck.open()
  File "/home/pi/python-elgato-streamdeck/src/StreamDeck/Devices/StreamDeck.py", line 116, in open
    self._reset_key_stream()
  File "/home/pi/python-elgato-streamdeck/src/StreamDeck/Devices/StreamDeckOriginal.py", line 79, in _reset_key_stream
    self.device.write(payload)
  File "/home/pi/python-elgato-streamdeck/src/StreamDeck/Transport/HID.py", line 134, in write
    return self.hid.write(payload)
  File "/usr/local/lib/python3.7/dist-packages/hid/__init__.py", line 149, in write
    return self.__hidcall(hidapi.hid_write, self.__dev, data, len(data))
  File "/usr/local/lib/python3.7/dist-packages/hid/__init__.py", line 140, in __hidcall
    raise HIDException(err)
hid.HIDException: None

from python-elgato-streamdeck.

abcminiuser avatar abcminiuser commented on May 18, 2024

Ok, I've done a bit more digging tonight. Unfortunately all I have set up currently is an Ubuntu Bionic VM, which isn't a perfect way to test, but I'm time constrained today. I've recently decommissioned some RPi2 units and I have an old laptop I'll set up soon to do native testing again.

I found and fixed a few bugs in the HID backend in 0a24f77 which was causing it to fail inside the VM -- the HID transport was double-opening device handles, which was upsetting the HID library backend. @BS-Tek / @xorbital could you please re-test this latest revision?

If I knew Python HID was such a tire fire I wouldn't have been so eager to build this. Looking through the library code of both HIDAPI and HID makes me quite a bit concerned around proper cleanup of native resources, not to mention the possibility of various memory corruptions and leaks.

from python-elgato-streamdeck.

xorbital avatar xorbital commented on May 18, 2024

Thanks for your work :)
I've pulled the latest changes, still throws errors for me:
python3 example_basic.py:

Found 1 Stream Deck(s).

Traceback (most recent call last):
  File "example_basic.py", line 113, in <module>
    deck.open()
  File "/home/xorbital/python-elgato-streamdeck/src/StreamDeck/Devices/StreamDeck.py", line 114, in open
    self.device.open()
  File "/home/xorbital/python-elgato-streamdeck/src/StreamDeck/Transport/HID.py", line 48, in open
    self.hid = hid.Device(path=self.hid_info['path'])
  File "/usr/lib/python3.7/site-packages/hid/__init__.py", line 130, in __init__
    raise HIDException('unable to open device')
hid.HIDException: unable to open device

sudo python3 example_basic.py:

Found 1 Stream Deck(s).
Opened 'Stream Deck XL' device (serial number: '(displays the correct serial number)')

The Stream Deck turns black (keys are illuminated) for approx. 5 seconds, then:

Traceback (most recent call last):
  File "/home/xorbital/python-elgato-streamdeck/src/StreamDeck/Transport/HID.py", line 157, in write
    return self.hid.write(payload)
  File "/usr/lib/python3.7/site-packages/hid/__init__.py", line 149, in write
    return self.__hidcall(hidapi.hid_write, self.__dev, data, len(data))
  File "/usr/lib/python3.7/site-packages/hid/__init__.py", line 140, in __hidcall
    raise HIDException(err)
hid.HIDException: None

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "example_basic.py", line 123, in <module>
    update_key_image(deck, key, False)
  File "example_basic.py", line 82, in update_key_image
    deck.set_key_image(key, image)
  File "/home/xorbital/python-elgato-streamdeck/src/StreamDeck/Devices/StreamDeckXL.py", line 185, in set_key_image
    self.device.write(payload)
  File "/home/xorbital/python-elgato-streamdeck/src/StreamDeck/Transport/HID.py", line 159, in write
    raise IOError(e)
OSError: None

from python-elgato-streamdeck.

abcminiuser avatar abcminiuser commented on May 18, 2024

Dangit. Does dmesg show anything related to HID when run from a terminal? When I double-opened the handle inside my VM, it printed a stacktrace from the HID library after it segfaulted internally.

from python-elgato-streamdeck.

xorbital avatar xorbital commented on May 18, 2024

Sadly nothing, only that I plugged in and removed the device. :<

from python-elgato-streamdeck.

BS-Tek avatar BS-Tek commented on May 18, 2024

I pulled the last changes and when running sudo ./example_deckinfo.py with the XL connected it returns the information as expected every time it is run.

Opened 'Stream Deck XL' device (serial number: 'CL30I1A03593')
sudo ./example_deckinfo.py
Found 1 Stream Deck(s).

Deck 0 - Stream Deck XL.
         - ID: b'/dev/hidraw0'
         - Serial: 'CL30I1A03593'
         - Firmware Version: '1.00.006'
         - Key Count: 32 (4x8 grid)
         - Key Images: 96x96 pixels, JPEG format, rotated 0 degrees, mirrored horizontally/vertically

When I run sudo ./example_basic.py the following error is returned:

sudo ./example_basic.py
Found 1 Stream Deck(s).

Opened 'Stream Deck XL' device (serial number: 'CL30I1A03593')
Traceback (most recent call last):
  File "/home/pi/python-elgato-streamdeck/src/StreamDeck/Transport/HID.py", line 157, in write
    return self.hid.write(payload)
  File "/usr/local/lib/python3.7/dist-packages/hid/__init__.py", line 149, in write
    return self.__hidcall(hidapi.hid_write, self.__dev, data, len(data))
  File "/usr/local/lib/python3.7/dist-packages/hid/__init__.py", line 140, in __hidcall
    raise HIDException(err)
hid.HIDException: None

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./example_basic.py", line 123, in <module>
    update_key_image(deck, key, False)
  File "./example_basic.py", line 82, in update_key_image
    deck.set_key_image(key, image)
  File "/home/pi/python-elgato-streamdeck/src/StreamDeck/Devices/StreamDeckXL.py", line 185, in set_key_image
    self.device.write(payload)
  File "/home/pi/python-elgato-streamdeck/src/StreamDeck/Transport/HID.py", line 159, in write
    raise IOError(e)
OSError: None

When I connect the Stream deck XL dmesg returns this:

[ 2059.481436] usb 1-1.2: new high-speed USB device number 8 using xhci_hcd
[ 2059.612023] usb 1-1.2: New USB device found, idVendor=0fd9, idProduct=006c, bcdDevice= 2.00
[ 2059.612040] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 2059.612053] usb 1-1.2: Product: Stream Deck XL
[ 2059.612065] usb 1-1.2: Manufacturer: Elgato
[ 2059.612077] usb 1-1.2: SerialNumber: CL30I1A03593
[ 2059.616527] input: Elgato Stream Deck XL as /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.2/1-1.2:1.0/0003:0FD9:006C.0006/input/input5
[ 2059.681841] hid-generic 0003:0FD9:006C.0006: input,hidraw0: USB HID v1.10 Device [Elgato Stream Deck XL] on usb-0000:01:00.0-1.2/input0

On disconnect dmesg shows nothing unusual:
[ 2301.852095] usb 1-1.2: USB disconnect, device number 8

If I connect the Stream Deck Original dmesg returns this:

[ 2336.028847] usb 1-1.2: new high-speed USB device number 9 using xhci_hcd
[ 2336.159595] usb 1-1.2: New USB device found, idVendor=0fd9, idProduct=0060, bcdDevice= 1.00
[ 2336.159611] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 2336.159623] usb 1-1.2: Product: Stream Deck
[ 2336.159635] usb 1-1.2: Manufacturer: Elgato Systems
[ 2336.159646] usb 1-1.2: SerialNumber: AL25I1C06829
[ 2336.166909] input: Elgato Systems Stream Deck as /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.2/1-1.2:1.0/0003:0FD9:0060.0007/input/input6
[ 2336.167280] hid-generic 0003:0FD9:0060.0007: input,hidraw0: USB HID v1.11 Device [Elgato Systems Stream Deck] on usb-0000:01:00.0-1.2/input0

When I run sudo ./example_deckinfo.py the following error is shown:

sudo ./example_deckinfo.py
Found 1 Stream Deck(s).

Traceback (most recent call last):
  File "/home/pi/python-elgato-streamdeck/src/StreamDeck/Transport/HID.py", line 157, in write
    return self.hid.write(payload)
  File "/usr/local/lib/python3.7/dist-packages/hid/__init__.py", line 149, in write
    return self.__hidcall(hidapi.hid_write, self.__dev, data, len(data))
  File "/usr/local/lib/python3.7/dist-packages/hid/__init__.py", line 140, in __hidcall
    raise HIDException(err)
hid.HIDException: None

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./example_deckinfo.py", line 49, in <module>
    deck.open()
  File "/home/pi/python-elgato-streamdeck/src/StreamDeck/Devices/StreamDeck.py", line 116, in open
    self._reset_key_stream()
  File "/home/pi/python-elgato-streamdeck/src/StreamDeck/Devices/StreamDeckOriginal.py", line 79, in _reset_key_stream
    self.device.write(payload)
  File "/home/pi/python-elgato-streamdeck/src/StreamDeck/Transport/HID.py", line 159, in write
    raise IOError(e)
OSError: None

dmesg returns this:
[ 2498.622716] hid-generic 0003:0FD9:0060.0007: pid 1126 passed too large report

When I disconnect the Stream Deck Original dmesg shows nothing unusual:
[ 2816.005381] usb 1-1.2: USB disconnect, device number 9

I am a little curious about the last line returned by dmesg when the devices are connected, the XL says USB HID v.1.10 and the Original says USB HID v.1.11

from python-elgato-streamdeck.

xorbital avatar xorbital commented on May 18, 2024

The weird thing is that the udev rules are set and the node.js library works without root permissions...

from python-elgato-streamdeck.

abcminiuser avatar abcminiuser commented on May 18, 2024

Try #27 (comment) - testing on my local machine, I get an identical error when trying to use the StreamDecks with the HID backend, but only when the libhidapi-hidraw0 package is installed. With libhidapi-libusb0 installed, it works.

from python-elgato-streamdeck.

BS-Tek avatar BS-Tek commented on May 18, 2024

Sorry I was unable to respond yesterday.

I have tested again on a clean and fully updated image of 2019-09-26-raspbian-buster on a RPI4.

I ran the following commands:

sudo apt update && sudo apt dist-upgrade -y
sudo apt install -y python3-pip
sudo apt remove --auto-remove libhidapi-hidraw0
sudo apt install -y libudev-dev libusb-1.0-0-dev
pip3 install hidapi
pip3 install pillow
git clone https://github.com/abcminiuser/python-elgato-streamdeck.git

My /etc/udev/rules.d/10-streamdeck.rules look like this:

SUBSYSTEM=="input", GROUP="input", MODE="0666"
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"

The Classic is now working again but the XL is back to black keys and the 5 second timeout after the key image should have been updated. The key presses from the XL are reported correctly after the initial startup where all 32 buttons with delay has be updated. No errors is shown anymore and dmesg shows nothing unusual.

I have also tried this on my Ubuntu 18.04.1 LTS in VMWare Fusion 10 virtual machine with the same results.

from python-elgato-streamdeck.

dubstech avatar dubstech commented on May 18, 2024

Was there a determination on what the root issue was for the XL?

Is there anything else needed to help troubleshoot?

Thanks.

from python-elgato-streamdeck.

abcminiuser avatar abcminiuser commented on May 18, 2024

Sorry, I got side-tracked by the HID backend issue which I wasn't able to resolve fully, and forgot about this.

So, the current library revision blacklists the hidapi low level linux HID backend, as it can't work with the original StreamDeck without being recompiled for each distro. Unfortunately the hid Python library currently preferences this over the libusb backend and the maintainer isn't interested in patching it himself, so I'll have to do it at some point.

For now, the blacklist at least ensures that on Linux everyone is using libusb as a backend, which theoretically should work well for all the variants. I'm late to the party discovering this, as it looks like all the Node guys figured that out ages ago. Doh.

So, with that patched we should have the Original and Mini variants working, leaving the XL. I have two theories on what's happening:

  • The reset() command for the XL has an incorrect length. The HIDAPI backend might have been able to deal with this better than the libusb one, but I've patched it in f11fdff. Can you please try this as-is first?

  • The firmware might be getting into a bad state due to the _reset_key_stream() internal function that I added mostly to fix tearing issues on initial connection on the Original and Mini devices. If the above doesn't work, can you try commenting out the write in https://github.com/abcminiuser/python-elgato-streamdeck/blob/master/src/StreamDeck/Devices/StreamDeckXL.py#L99 and see if that works?

One of those two has to work, as I've just disassembled the real software's write function and confirmed my algorithm is functionally identical. We've sorted out the backend issues enough that I know what's being used for sure, and that works for other projects.

from python-elgato-streamdeck.

dubstech avatar dubstech commented on May 18, 2024

I tried both individually and then together and doesn't seem to have any effect on the original error message. It opens the XL and I can set the brightness, but it errors out as soon the update_key_image command is run. I am getting the same errors as reported in #27

from python-elgato-streamdeck.

abcminiuser avatar abcminiuser commented on May 18, 2024

Well, I'm baffled - if the other functions work then basic comms are working, and the write code is functionally identical both to the real app and the other third party libraries I compared against. If you really have:

  1. Removed hidapi and installed just the hid Python library, and
  2. removed the hidapi-hidraw0 and installed the hidapi-libusb0 distro apt packages

then I must be missing something that's no doubt obvious in hindsight.

I did notice that Debian is shipping an ancient version of hidapi-libusb0 but I grepped through the changes over the last few years and I don't see anything relevant in the libUSB backend. The NodeJS guys are building and shipping a newer version of the library with their node-hid package, but given the above I'm not sure it's all that relevant.

In lieu of spending $350 to buy one of these just for testing, I'm still going to have to rely on some more tests - sorry! Would you mind trying trying a couple of quick tests:

  1. Run the test.py script and put the resulting output on Pastebin or some other text sharing site (it'll be long). I'm interested in seeing what packets your machine tries to send to the (dummy) device after it's created a JPG for the XL of the required type.

  2. Run the example_script.py with the deck.set_key_image(key, image) call changed to deck.set_key_image(key, None). This will use a fixed (pre-generated) black JPG for the keys. If that doesn't have the same multi-second delays, then that coupled with the test above might indicate Pillow JPG encoding issues.

  3. The harder but most useful one by FAR: install Wireguard and take a USB packet log when running the example script, then send me the trace. That will give me a rough idea what packets are actually hitting the bus.

The funny part about all this is that I actually know quite a lot about USB and HID - I'm just hamstrung by the absolute cluster-*&^% that is the abstraction libraries over the actual packets on the bus. I'm really surprised this is the current state of the art, given how simple the protocol is.

from python-elgato-streamdeck.

abcminiuser avatar abcminiuser commented on May 18, 2024

I forgot the damned report padding on the XL (e487aff).

from python-elgato-streamdeck.

dubstech avatar dubstech commented on May 18, 2024

This fixed the problem! I did discover another issue now, which is the close command does not seem to work correctly. On the original and mini when I call the deck.reset() and deck.close() when my program exits it goes back to the stream deck logo. The XL doesn't seem to do anything. I don't see any error messages thrown, but it also doesn't seem to be releasing cleanly.

Thanks again for all your work on this.

from python-elgato-streamdeck.

abcminiuser avatar abcminiuser commented on May 18, 2024

Awesome! Can't believe I missed the padding for so long - I already had it for the other models and somehow complete skipped over it for the XL.

I've fixed the reset command in 906ee5d - I typo'd one of the command bytes.

from python-elgato-streamdeck.

abcminiuser avatar abcminiuser commented on May 18, 2024

Thanks for the debugging help @BS-Tek and @dubstech! I've shipped the XL fixes in 0.6.2.

@dubstech if the XL still has closing issues with the latest version (which has the fix above applied) please open a new issue for it.

from python-elgato-streamdeck.

Gonzo2O28 avatar Gonzo2O28 commented on May 18, 2024

I am having the same issue here.
The padding fix mentioned in this thread seems to be already inside my files.
I can assign functions to the key, that works fine, but as soon as i add an image the bottom of each button shows some weird pixels, about 4-7 pixels and the image does not display.

Plus i cannot end the application. When run from the terminal and quit it stays there, even ctrl+x does not work, i have to use killall streamdeck in another terminal.

Ideas?
Arch Linux here

20200302_134622

Edit: after reading the installation guide again i uninstalled hidapi and installed hid, now my streamdeck does not start anymore, i am getting: StreamDeck.DeviceManager.ProbeError: ('Probe failed to find any functional HID backend.', {'hid': OSError('The libhidapi-hidraw0 backend is currently blacklisted for StreamDeck devices.'), 'hidapi': TypeError("enumerate() got an unexpected keyword argument 'vendor_id'")})

where can i unblacklist this?
I have installed this:
https://www.archlinux.org/packages/community/x86_64/hidapi/files/
and this
pip3 install hid

Fixed!
I was using mozjpeg, which replaces libjpeg and is a better version of libjpeg, after uninstalling this and installing normal libjpeg, those images work now.

from python-elgato-streamdeck.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.