PyUSB 1.0: NotImplementedError: Operation not supported or unimplemented on this platform

匿名 (未验证) 提交于 2019-12-03 00:59:01

问题:

I just began to use pyusb, and basically I'm playing with the sample code here.

I'm using Windows7 64 bit, and downloaded the zip version from https://walac.github.io/pyusb/. Backend is libusb-1.0.19 that is downloaded the windows binary from http://libusb.info/.

All of my code is:

dev = usb.core.find(idVendor=3544, idProduct=9736) if dev is None:     sys.stdout.write("No device found")     return; print "deviceClass = " + str(dev.bDeviceClass); for cfg in dev:     sys.stdout.write("configuration: " + str(cfg.bConfigurationValue) + '\n')     for intf in cfg:         sys.stdout.write('\tInterface: ' + \                              str(intf.bInterfaceNumber) + \                              ',' + \                              str(intf.bAlternateSetting) + \                              '\n')         for ep in intf:             sys.stdout.write('\t\tEndpoint: ' + \                                   str(ep.bEndpointAddress) + \                                   ',' + \                                   str(ep.bmAttributes) + \                                   '\n')  dev.set_configuration()

At the ending line, I got

File "test.py", line 44, in find_mine     dev.set_configuration() File "c:\Python27\lib\site-packages\usb\core.py", line 842, in set_configuration     self._ctx.managed_set_configuration(self, configuration) File "c:\Python27\lib\site-packages\usb\core.py", line 128, in managed_set_configuration     self.managed_open() File "c:\Python27\lib\site-packages\usb\core.py", line 106, in managed_open     self.handle = self.backend.open_device(self.dev) File "c:\Python27\lib\site-packages\usb\backend\libusb1.py", line 778, in open_device     return _DeviceHandle(dev) File "c:\Python27\lib\site-packages\usb\backend\libusb1.py", line 640, in __init__     _check(_lib.libusb_open(self.devid, byref(self.handle))) File "c:\Python27\lib\site-packages\usb\backend\libusb1.py", line 590, in _check     raise NotImplementedError(_strerror(ret)) NotImplementedError: Operation not supported or unimplemented on this platform

I have several USB devices installed, but only see this issue when I try to set_configuration for my USB flash drive...

Is this because I can't use pyusb to access the flash drive? Or there's anything I missed...

回答1:

This issue is about having the right driver on W7/64-bits. I tried to connect and use a Microchip self-programmed card. Unfortunately, the driver provided by Microchip is not compliant with the libusb library and I've go the same error.

Read: How to use libusb on Windows

Then: - the ZADIG install is executed with the Microchip card connected - then from the ZADIG popup "List all devices" allows me to detect and choose my device "CDC RS-232 Emulation Demo" ID = 04d8:000a - then multiple drivers are possible: I installed WINUSB (microsoft)

Now the first stage of device enumeration is working fine.



回答2:

This also happened me and the problem was that the device was used by other software or driver.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!