bitcraze / crazyflie-clients-python

Host applications and library for Crazyflie written in Python.
Other
309 stars 471 forks source link

Error if USB controller is disconnected while cfclient is open #541

Open knmcguire opened 2 years ago

knmcguire commented 2 years ago

Ubuntu 20.04, latest version of CFclient, with an xbox controller.

If I disconnect the controller while the cfclient is open, it gives the following error window and disconnects to the crazyflie:

Error reading from input device

Traceback (most recent call last):
  File "/home/kimberly/Development/Bitcraze/Python/crazyflie-clients-python/src/cfclient/utils/input/inputreaders/linuxjsdev.py", line 166, in _read_all_events
    data = self._f.read(struct.calcsize(JS_EVENT_FMT))
OSError: [Errno 19] No such device

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/kimberly/Development/Bitcraze/Python/crazyflie-clients-python/src/cfclient/utils/input/__init__.py", line 366, in read_input
    data = self._selected_mux.read()
  File "/home/kimberly/Development/Bitcraze/Python/crazyflie-clients-python/src/cfclient/utils/input/mux/nomux.py", line 49, in read
    data = self._devs["Device"].read()
  File "/home/kimberly/Development/Bitcraze/Python/crazyflie-clients-python/src/cfclient/utils/input/inputreaders/__init__.py", line 108, in read
    [axis, buttons] = self._reader.read(self.id)
  File "/home/kimberly/Development/Bitcraze/Python/crazyflie-clients-python/src/cfclient/utils/input/inputreaders/linuxjsdev.py", line 236, in read
    return self._js[device_id].read()
  File "/home/kimberly/Development/Bitcraze/Python/crazyflie-clients-python/src/cfclient/utils/input/inputreaders/linuxjsdev.py", line 190, in read
    self._read_all_events()
  File "/home/kimberly/Development/Bitcraze/Python/crazyflie-clients-python/src/cfclient/utils/input/inputreaders/linuxjsdev.py", line 174, in _read_all_events
    raise IOError("Device has been disconnected")
OSError: Device has been disconnected

Weird thing is, is that after that I still see on the bottom:

Using Normal mux with Microsoft X-box 360 pad (xbox360 model) and also usually it's no problem to connect an USB device while the cfclient is running. So the following seems like a bug.

knmcguire commented 2 years ago

fixed with #542

knmcguire commented 2 years ago

Woops sorry, this one is not fixed yet!