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

Add support for WinUSB crazyradio driver #321

Open
ataffanel opened this issue Feb 28, 2022 · 0 comments
Open

Add support for WinUSB crazyradio driver #321

ataffanel opened this issue Feb 28, 2022 · 0 comments

Comments

@ataffanel
Copy link
Member

Now that libusb 1.0.25 has been release, we have an opportunity to add support for WinUSB driver for the Crazyradio. WinUSB has the advantage to be included with Windows and could be installed automatically with a firmware update.

The issue so far is that we are using the libusb0 pyusb backend that does not support WinUSB and the libusb 1.0.24 backend did crash the python process when the current linusb0 USB driver is in use.

Libusb 1.0.25 does not crash anymore but it cannot cummunicate with the current driver either, we are getting an I/O error (see bellow). However this is a detectable error so it should be possible to make an implementation that can open both drivers using different back-end.

The only requirement will be to change our dependencies to be dependent on libusb-package~=1.0.25 which will pull the right version for libusb1.

Traceback (most recent call last):
  File "\crazyflie-lib-python\cflib\crtp\radiodriver.py", line 456, in scan_interface
    self._radio = RadioManager.open(0)
  File "\crazyflie-lib-python\cflib\crtp\radiodriver.py", line 226, in open
    shared_radio = _SharedRadio(devid)
  File "\crazyflie-lib-python\cflib\crtp\radiodriver.py", line 149, in __init__
    self._radio = Crazyradio(devid=devid)
  File "\crazyflie-lib-python\cflib\drivers\crazyradio.py", line 129, in __init__
    self.dev.set_configuration(1)
  File "\AppData\Local\Programs\Python\Python310\lib\site-packages\usb\core.py", line 915, in set_configuration
    self._ctx.managed_set_configuration(self, configuration)
  File "\AppData\Local\Programs\Python\Python310\lib\site-packages\usb\core.py", line 113, in wrapper
    return f(self, *args, **kwargs)
  File "\Local\Programs\Python\Python310\lib\site-packages\usb\core.py", line 159, in managed_set_configuration
    self.backend.set_configuration(self.handle, cfg.bConfigurationValue)
  File "\AppData\Local\Programs\Python\Python310\lib\site-packages\usb\backend\libusb1.py", line 812, in set_configuration
    _check(self.lib.libusb_set_configuration(dev_handle.handle, config_value))
  File "\Local\Programs\Python\Python310\lib\site-packages\usb\backend\libusb1.py", line 604, in _check
    raise USBError(_strerror(ret), ret, _libusb_errno[ret])
usb.core.USBError: [Errno 5] Input/Output Error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants