led-name-badge-ls32 icon indicating copy to clipboard operation
led-name-badge-ls32 copied to clipboard

CH546 usb.core.USBTimeoutError: [Errno 110] Operation timed out Segmentation fault

Open ruben-herold opened this issue 11 months ago • 4 comments

hi,

try to use it on CH546 devices on Ubuntu 24 ends in Segmentation fault:

Module usb.core detected
Type: 11x44
Libusb device initialized
Write using wch.cn - CH546 (bus=3 dev=61 endpoint=2) via libusb
Traceback (most recent call last):
  File "/home/ruben/daten/led-badge/led-name-badge-ls32/./led-badge-11x44.py", line 3, in <module>
    lednamebadge.main()
  File "/home/ruben/daten/led-badge/led-name-badge-ls32/lednamebadge.py", line 1135, in main
    LedNameBadge.write(buf, method, args.device_id)
  File "/home/ruben/daten/led-badge/led-name-badge-ls32/lednamebadge.py", line 828, in write
    write_method.write(buf)
  File "/home/ruben/daten/led-badge/led-name-badge-ls32/lednamebadge.py", line 539, in write
    self._write(buf)
  File "/home/ruben/daten/led-badge/led-name-badge-ls32/lednamebadge.py", line 664, in _write
    self.endpoint.write(buf[i * 64:i * 64 + 64])
  File "/usr/lib/python3/dist-packages/usb/core.py", line 408, in write
    return self.device.write(self, data, timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  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 out
Segmentation fault

ruben-herold avatar Dec 28 '24 23:12 ruben-herold

I have the same problem. Also the program does not seem to use hidapi although it is installed and the symlink is set as stated in the instructions. Only Messages up to 6 Characters work, but even with 6 it ends with an error message. More Characters give garbage at the end.

der-martin85 avatar Dec 29 '24 21:12 der-martin85

I have the same Issue

ptschack avatar Dec 30 '24 11:12 ptschack

I have the same Issue (using Ubuntu 24.04)

I tried to increase the timeout time (line 664)

self.endpoint.write(buf[i * 64:i * 64 + 64], timeout=5000)

But then I only get a different error:

Module usb.core detected
Type: 11x44
Libusb device initialized
Write using wch.cn - CH546 (bus=1 dev=15 endpoint=2) via libusb
Traceback (most recent call last):
  File "/home/user/Documents/Workspace/led-name-badge-ls32/./led-badge-11x44.py", line 3, in <module>
    lednamebadge.main()
  File "/home/samuel/Documents/Workspace/led-name-badge-ls32/lednamebadge.py", line 1135, in main
    LedNameBadge.write(buf, method, args.device_id)
  File "/home/user/Documents/Workspace/led-name-badge-ls32/lednamebadge.py", line 828, in write
    write_method.write(buf)
  File "/home/user/Documents/Workspace/led-name-badge-ls32/lednamebadge.py", line 539, in write
    self._write(buf)
  File "/home/user/Documents/Workspace/led-name-badge-ls32/lednamebadge.py", line 664, in _write
    self.endpoint.write(buf[i * 64:i * 64 + 64], timeout=5000)
  File "/home/user/Documents/Workspace/led-name-badge-ls32/ledtag/lib/python3.12/site-packages/usb/core.py", line 408, in write
    return self.device.write(self, data, timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/Documents/Workspace/led-name-badge-ls32/ledtag/lib/python3.12/site-packages/usb/core.py", line 989, in write
    return fn(
           ^^^
  File "/home/user/Documents/Workspace/led-name-badge-ls32/ledtag/lib/python3.12/site-packages/usb/backend/libusb1.py", line 855, in intr_write
    return self.__write(self.lib.libusb_interrupt_transfer,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/Documents/Workspace/led-name-badge-ls32/ledtag/lib/python3.12/site-packages/usb/backend/libusb1.py", line 938, in __write
    _check(retval)
  File "/home/user/Documents/Workspace/led-name-badge-ls32/ledtag/lib/python3.12/site-packages/usb/backend/libusb1.py", line 604, in _check
    raise USBError(_strerror(ret), ret, _libusb_errno[ret])
usb.core.USBError: [Errno 19] No such device (it may have been disconnected)
libusb: debug [libusb_open] open 1.15
Speicherzugriffsfehler (Speicherabzug geschrieben)

SamuABC avatar Dec 31 '24 13:12 SamuABC

Same issue here

roberto-thy avatar Jan 10 '25 16:01 roberto-thy

Debian Unstable here, same issue. I ended up removing the try-catch at https://github.com/jnweiger/led-name-badge-ls32/blob/master/lednamebadge.py#L672 to find out what the issue with hidapi was and needed to symlink

sudo ln -s /usr/lib/x86_64-linux-gnu/libhidapi-libusb.so.0 /usr/local/lib/

instead of the suggested libhidapi-hidraw.so.0 after that everything works fine

Missingmew avatar Aug 18 '25 19:08 Missingmew

instead of the suggested libhidapi-hidraw.so.0 after that everything works fine

didn't help me, unfortunately. i noticed however it's working half of the times if the the text i send is less than 3 characters. with longer texts it is getting worse.

legion151 avatar Oct 05 '25 14:10 legion151

also dmesg says:

[Sa Okt  4 18:02:05 2025] python3[1078761]: segfault at 3688b440 ip 000000003688b440 sp 00007ffcb8e7ae98 error 15 likely on CPU 2 (core 1, socket 0)
[Sa Okt  4 18:02:05 2025] Code: 1f 00 20 00 20 00 4e 84 3d 03 1f 00 66 01 21 00 2c 00 28 00 00 00 00 00 00 00 64 01 00 00 66 02 20 00 1f 00 20 00 20 00 67 00 <3d> 03 1f 00 66 01 00 d8 91 01 00 00 00 00 00 00 a0 fc a0 a9 18 7f
[Sa Okt  4 18:02:05 2025] usb 3-2: USB disconnect, device number 45
[Sa Okt  4 18:02:05 2025] usb 3-2: new full-speed USB device number 46 using xhci_hcd
[Sa Okt  4 18:02:06 2025] usb 3-2: New USB device found, idVendor=0416, idProduct=5020, bcdDevice= 1.00
[Sa Okt  4 18:02:06 2025] usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[Sa Okt  4 18:02:06 2025] usb 3-2: Product: CH546
[Sa Okt  4 18:02:06 2025] usb 3-2: Manufacturer: wch.cn
[Sa Okt  4 18:02:06 2025] hid-generic 0003:0416:5020.002D: hiddev1,hidraw1: USB HID v1.00 Device [wch.cn CH546] on usb-0000:00:14.0-2/input0

legion151 avatar Oct 05 '25 14:10 legion151