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

Bomin picture Bomin · Aug 12, 2015 · Viewed 7.5k times · Source

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...

Answer

frva picture frva · Jul 23, 2016

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.