abcminiuser / python-elgato-streamdeck

Python library to control the Elgato Stream Deck.
Other
913 stars 135 forks source link

get_firmware_version() call leads to streamdeck XL ignoring top 3 row presses #38

Open humbled opened 4 years ago

humbled commented 4 years ago

Strange behaviour encountered today where the top 3 rows of an XL get ignored until reset() or similar

Here's a tiny working illustration. Pressing key(0) makes the call and the top 3 rows stop working then. Pressing key(31) runs reset() then all kets work again.

import threading
from StreamDeck.DeviceManager import DeviceManager

def _cbKeyPressed(deck, key, state):
    print("Got a press on {}".format(key))
    if state:
        return
    if key == 0:
        print("Running get_firmware_version()!")
        deck.get_firmware_version()
    elif key == 31:
        print("restoring")
        deck.reset()

def setup(deck):
    deck.open()
    deck.reset()
    deck.set_key_callback(_cbKeyPressed)

deck = DeviceManager().enumerate()[0]
setup(deck)

for t in threading.enumerate():
    if t is threading.currentThread():
        continue

    if t.is_alive():
            t.join()

streamdeck 0.6.3 hidapi 0.9.0.post2 Mac OS 10.15.2 (Catalina)

Seen same on Linux with hid (referenced in #29)

abcminiuser commented 4 years ago

Could you please try the latest 0.7.3 release? It has a new HID backend I wrote that directly binds to the system installed hidapi, which might resolve the issue.

If you don't want to upgrade for some reason, there's also a newer release of the HIDAPI python library that your 0.6.3 version uses, which could also help.

abcminiuser commented 4 years ago

Give the latest 0.8.1 a go please and report back - the back end is substantially different to the version mentioned in this report, and the underlying issue might now be solved.

abcminiuser commented 4 years ago

Closing due to an extended period of inactivity - please re-open if you can reproduce this on the latest version of the library.

twidi commented 3 years ago

@abcminiuser just got the same problem with a XL and version 0.8.4 of your (awesome, thanks for it, btw) lib: only the last row is working. Adding a deck.reset() after reading the firmware version solved it (I was going crazy until I found this issue)

abcminiuser commented 3 years ago

Well, that's frustrating. I don't have an XL model around to test with, but I've checked over the original application multiple times, and it definitely reads out a 32-byte feature report (report ID 5) from the XL device. If that's causing issues it'll either be device firmware related, or something not quite right in the libhidapi-libusb backend.

If anyone else has a StreamDeck XL, can you please try this on Mac or Windows and report if the same issue is observed there?

impala454 commented 2 years ago

Old thread I know, but I can confirm this on Ubuntu 20.04 and Stream Deck XL. If I do any of the deck.get_* function calls, the top three rows quit working. If I remove any and all of those calls from my code and just do deck.open(), deck.reset(), and deck.set_key_callback() and never make any of the get_* calls, it works fine. With the calls in there, it works fine on a Stream Deck Mini.

edit: Also my libhidapi-libusb0 version is 0.9.0+dfsg-1 if that helps. I also am actively working on this so can easily test fixes.

aaronr8684 commented 2 years ago

@abcminiuser I'm available to test/troubleshoot on Windows or Rasberry Pi OS (and Ubuntu VM if that works to test). I have a XL and know python