PyUSB 1.0:NotImplementedError:此平台不支持或未实现操作 [英] PyUSB 1.0: NotImplementedError: Operation not supported or unimplemented on this platform

查看:1437
本文介绍了PyUSB 1.0:NotImplementedError:此平台不支持或未实现操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

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

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

我所有的代码是:

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设备,但是只有当我尝试set_configuration为我的USB闪存驱动器时才看到此问题...

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

这是因为我无法使用pyusb访问闪存驱动器吗?还是有什么我想念的...

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

推荐答案

此问题与在W7/64位上使用正确的驱动程序有关. 我试图连接并使用Microchip自编程卡.不幸的是,Microchip提供的驱动程序与libusb库不兼容,我也犯了同样的错误.

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.

阅读:如何在Windows上使用libusb

然后: -在连接了Microchip卡的情况下执行ZADIG安装 -然后从ZADIG弹出窗口列出所有设备"使我能够检测并选择设备"CDC RS-232仿真演示",ID = 04d8:000a -然后可以使用多个驱动程序:我安装了WINUSB(microsoft)

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.

这篇关于PyUSB 1.0:NotImplementedError:此平台不支持或未实现操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆