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

标签 python python-2.7 libusb pyusb libusb-1.0

我刚刚开始使用pyusb,基本上我正在玩示例代码here .

我使用的是Windows7 64位,并从https://walac.github.io/pyusb/下载了zip版本。后端是 libusb-1.0.19,从 http://libusb.info/ 下载 Windows 二进制文件.

我的所有代码是:

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()

在最后一行,我得到了

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

我安装了多个 USB 设备,但只有当我尝试为我的 USB 闪存驱动器set_configuration 时才会看到此问题...

这是因为我无法使用 pyusb 访问闪存驱动器吗?或者我错过了什么......

最佳答案

这也发生在我身上,问题是该设备被其他软件或驱动程序使用。

关于python - PyUSB 1.0 : NotImplementedError: Operation not supported or unimplemented on this platform,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31960314/

相关文章:

python - 根据空间接近度对几何点进行分组

python - 有没有办法从 C DLL 调用 Python 函数?

python - 如何高效的传递函数?

python 对 Flask-SQLAlchemy 中 AppenderBaseQuery 属性的赋值无效

像excel一样的Python字符串序列

python - 当存在 2 个版本的 python 时安装 COCOAPI

python - .itemgetter 的奇怪输出,用于按值 python 进行列表排序

java - java.library.path 中没有 usbJava

python - 我无法使用 cython-hidapi 库看到蓝牙设备 (Joy-Con)

c - Raspberry pi 上的 Libusb 问题