jnweiger / led-name-badge-ls32

Upload tool for an led name tag with USB-HID interface
GNU General Public License v2.0
223 stars 81 forks source link

operation time out on send multiple packets #38

Closed mljack closed 1 year ago

mljack commented 1 year ago

The badge hangs if I send more than one packet. Got following errors:

[root@alarmpi led-name-badge-ls32]# python2 ./led-badge-11x44.py "Hello world!" using [LSicroelectronics LS32 Custm HID] bus=1 dev=98 Type: 11x44 packet 0 packet 1 packet 2 Traceback (most recent call last): File "./led-badge-11x44.py", line 524, in dev.write(1, buf[i64:i64+64]) File "/usr/lib/python2.7/site-packages/usb/core.py", line 948, in write self.get_timeout(timeout) File "/usr/lib/python2.7/site-packages/usb/backend/libusb1.py", line 842, in intr_write timeout) File "/usr/lib/python2.7/site-packages/usb/backend/libusb1.py", line 920, in write _check(retval) File "/usr/lib/python2.7/site-packages/usb/backend/libusb1.py", line 595, in _check raise USBError(_strerror(ret), ret, _libusb_errno[ret]) usb.core.USBError: [Errno 110] Operation timed out

I have to unplug and re-plug it to get it reset to normal.

I found the bmpbadge application also read some bytes from endpoint 81. Would that be the missing pieces?

mljack commented 1 year ago

It seems helpful to read 64 bytes from 81 after each write. I could upload more rounds with these extra reads, but it's still not reliable. Still not get the correct patterns of reading calls.

mljack commented 1 year ago

I resolve the hang.

  1. Add an extra 64 bytes read from 0x81 after each write.
  2. Read another 64 bytes in the end
  3. Finally DO NOT forget release the device with dev.reset(). Somehow, it still hang in next string upload if only call usb.util.dispose_resources(dev)