-
-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
usb.core.USBTimeoutError on Linux (Fedora 38) #41
Comments
I faced the same problem on Ubuntu 23.04 with a current hardware revision of the display (purchased August 2023). I was not able to make it operational using the usb.core code path. I managed, however, to send data reliably to the display through the pyhidapi code path in the script - after fixing it, see my forked branch in https://github.com/dirkhillbrecht/led-name-badge-ls32/tree/fixhidapi . I already issued a pull request here. Note that unfortunately making the pyhidapi access operational on modern Linux seems to be a bit complicated as libraries are not always found. Hope this helps! |
Sounds like a Maker Faire guest too. :) I will test your fix tomorrow. |
I found a solution for me! I got the same error under Fedora 38 but also https://github.com/dirkhillbrecht/led-name-badge-ls32/tree/fixhidapi did not solve my problem. I realized that the script was not using pyhidapi at all.
I fixed the problem by creating a symlink to my shared object file:
After that I could use the script without any problems. Note that it now displays the message "via pyHIDAPI" when running. |
I have managed to make it work diff --git a/led-nameplate-11x44-hrkz.py b/led-nameplate-11x44-hrkz.py
index a7ae7f3..4b9d1f2 100644
--- a/led-nameplate-11x44-hrkz.py
+++ b/led-nameplate-11x44-hrkz.py
@@ -17,6 +17,7 @@ except:
have_pyhidapi = False
try:
import usb.core
+ import usb.util
except:
print("ERROR: Need the pyhidapi or usb.core module.")
if sys.platform == "darwin":
@@ -385,6 +386,7 @@ else:
print("No led tag with vendorID 0x0416 and productID 0x5020 found.")
print("Connect the led tag and run this tool as root.")
sys.exit(1)
+ dev.reset()
try:
# win32: NotImplementedError: is_kernel_driver_active
if dev.is_kernel_driver_active(0):
@@ -432,12 +434,33 @@ if len(buf) > 8192:
print ("Writing more than 8192 bytes damages the display!")
sys.exit(1)
+cfg = dev.get_active_configuration()
+intf = cfg[(0,0)]
+
+ep_out = usb.util.find_descriptor(
+ intf,
+ # match the first OUT endpoint
+ custom_match = \
+ lambda e:
+ usb.util.endpoint_direction(e.bEndpointAddress) == \
+ usb.util.ENDPOINT_OUT)
+
+ep_in = usb.util.find_descriptor(
+ intf,
+ # match the first IN endpoint
+ custom_match = \
+ lambda e:
+ usb.util.endpoint_direction(e.bEndpointAddress) == \
+ usb.util.ENDPOINT_IN)
+
if have_pyhidapi:
pyhidapi.hid_write(dev, buf)
else:
for i in range(int(len(buf)/64)):
- time.sleep(0.1)
- dev.write(1, buf[i*64:i*64+64])
+ ep_out.write(buf[i*64:i*64+64])
+ ep_in.read(64)
if have_pyhidapi:
pyhidapi.hid_close(dev)
+else:
+ usb.util.dispose_resources(dev) |
I got the same error (after fixing different endpoint address on this device "1 -> 2"), but only on "using wch.cn CH546] bus=1 dev=54" devices. Current version of drizzt/led-name-badge-ls32 works for me without any changes to solve my problem. Why this fixes are not included to this origin repository? |
I get the following Error Message for every String that is longer than 6 Characters. The workaround from #40 doesn't work.
Note: Had to implement the Workaround from #36 to be able to write to the badge anyway.
The text was updated successfully, but these errors were encountered: