iron-ox / fadecandy_ros

ROS Driver for the fandecandy LED driver board
6 stars 6 forks source link

Bad callback USBError: [Errno 19] No such device (it may have been disconnected) #16

Closed reinzor closed 3 years ago

reinzor commented 3 years ago

Found the following error in our logs:

[ERROR][1611637215.353462]: bad callback: <bound method FadecandyNode._set_leds of <fadecandy_driver.fadecandy_node.FadecandyNode instance at 0x7fb126186410>>

Not sure how to reproduce this yet.

reinzor commented 3 years ago
Traceback (most recent call last):
  File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/topics.py", line 750, in _invoke_callback
    cb(msg)
  File "/opt/ros/melodic/lib/python2.7/dist-packages/fadecandy_driver/fadecandy_node.py", line 41, in _set_leds
    self._driver.set_colors(led_array_colors)
  File "/opt/ros/melodic/lib/python2.7/dist-packages/fadecandy_driver/fadecandy_driver.py", line 144, in set_colors
    self._device.write(1, packet)
  File "/usr/lib/python2.7/dist-packages/usb/core.py", line 948, in write
    self.__get_timeout(timeout)
  File "/usr/lib/python2.7/dist-packages/usb/backend/libusb1.py", line 824, in bulk_write
    timeout)
  File "/usr/lib/python2.7/dist-packages/usb/backend/libusb1.py", line 920, in __write
    _check(retval)
  File "/usr/lib/python2.7/dist-packages/usb/backend/libusb1.py", line 595, in _check
    raise USBError(_strerror(ret), ret, _libusb_errno[ret])
USBError: [Errno 19] No such device (it may have been disconnected)
reinzor commented 3 years ago

Not sure why this is happening but I think we should at least be robust against something like this. For example trying to reconnect if this occurs. @jonbinney what do you think?

reinzor commented 3 years ago

Tested unplugging and re-plugging the USB device. This was not handled properly and the driver would not recover. With #17 , the driver recovers from a reconnection.

jonbinney commented 3 years ago

@reinzor I'm not working on this anymore - @wongkaiweng what do you think?

wongkaiweng commented 3 years ago

Thanks @jonbinney. @reinzor We have seen this problem recently as well. Let's move our conversation to the PR.