Skip to content
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.USBError: timeout error #40

Open
aaltulea opened this issue Jul 8, 2023 · 2 comments
Open

usb.core.USBError: timeout error #40

aaltulea opened this issue Jul 8, 2023 · 2 comments

Comments

@aaltulea
Copy link

aaltulea commented Jul 8, 2023

Hi there

Thanks for making this script. It works well. I wanted to provide some clarification for those who encounter the following error when trying to write to the led matrix S1144 on Windows 11 (using libusb, not pyhidapi):

usb.core.USBError: [Errno None] b'libusb0-dll:err [_usb_reap_async] timeout error\n'

I managed to get around this by adding else branch at the end of the script, as follows:

if have_pyhidapi:
  pyhidapi.hid_close(dev)
else:
  dev.reset()  

It seems that calling dev.reset() is necessary to avoid device hang-ups, and is essential for the "no charging screen" hack that you mentioned before.

This is what I ran:
python.exe "C:\Users\X\Downloads\led_py\led-badge-11x44.py" -s8 -m4 ++++++

python.exe "C:\Users\X\Downloads\led_py\led-badge-11x44.py" -m9 hello

For clock (run in cmd):

for /L %i in (1,0,1) do @start /B C:\Users\X\Python\Python311\python.exe "C:\Users\X\Downloads\led_py\led-badge-11x44.py" -m9 %TIME:~0,5% & timeout /t 60 /nobreak >nul

Thanks

@njanirudh
Copy link

@aaltulea
I have added the dev.reset() but still there is a timeout error

(ledtag) anirudh@nj-Predator:~/Software/led-name-badge-ls32$ sudo python3 ./led-badge-11x44-nj.py -s1 -m5 "nj"
using [wch.cn CH546] bus=1 dev=18
Type: 11x44
Traceback (most recent call last):
  File "/home/anirudh/Software/led-name-badge-ls32/./led-badge-11x44-nj.py", line 523, in <module>
    dev.write(2, buf[i*64:i*64+64])
  File "/usr/lib/python3/dist-packages/usb/core.py", line 989, in write
    return fn(
  File "/usr/lib/python3/dist-packages/usb/backend/libusb1.py", line 855, in intr_write
    return self.__write(self.lib.libusb_interrupt_transfer,
  File "/usr/lib/python3/dist-packages/usb/backend/libusb1.py", line 938, in __write
    _check(retval)
  File "/usr/lib/python3/dist-packages/usb/backend/libusb1.py", line 602, in _check
    raise USBTimeoutError(_strerror(ret), ret, _libusb_errno[ret])
usb.core.USBTimeoutError: [Errno 110] Operation timed ou

@jwich71
Copy link

jwich71 commented Oct 22, 2023

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 then started the script in debug mode and in the line "pyhidapi.hid_init()" I got the following error:

OSError: /usr/local/lib/libhidapi-libusb.so.0: cannot open shared object file: No such file or directory

I fixed the problem by creating a symlink to my shared object file:

sudo ln -s /usr/lib64/libhidapi-libusb.so.0 /usr/local/lib/libhidapi-libusb.so.0

After that I could use the script without any problems. Note that it now displays the message "via pyHIDAPI" when running.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants