Python 3.x device.内核驱动程序是否处于活动状态()在libusb-1.0.22.7z中不工作?
为什么我会收到“此平台不支持或未执行操作”的消息 我运行的是64位windows 10,并安装了Python3.7 64位、pyusb 1.0.2和libusb-1.0.22.7z。对于libusb-1.0.22.7z,我将其解压缩并将MS64\dll\libusb-1.0.dll复制到C:\Users..\AppData\Local\Programs\Python\37\文件夹Python 3.x device.内核驱动程序是否处于活动状态()在libusb-1.0.22.7z中不工作?,python-3.x,windows-10,pyusb,libusb-1.0,Python 3.x,Windows 10,Pyusb,Libusb 1.0,为什么我会收到“此平台不支持或未执行操作”的消息 我运行的是64位windows 10,并安装了Python3.7 64位、pyusb 1.0.2和libusb-1.0.22.7z。对于libusb-1.0.22.7z,我将其解压缩并将MS64\dll\libusb-1.0.dll复制到C:\Users..\AppData\Local\Programs\Python\37\文件夹 import usb device = usb.core.find(idVendor = 0x0461, idPr
import usb
device = usb.core.find(idVendor = 0x0461, idProduct = 0x4d65) #mouse
if device is None:
raise ValueError('No device')
print(device)
interface = 0
if device.is_kernel_driver_active(interface):
print("kernel driver active")
The output is:
DEVICE ID 0461:4d65 on Bus 008 Address 002 =================
bLength : 0x12 (18 bytes)
bDescriptorType : 0x1 Device
bcdUSB : 0x200 USB 2.0
bDeviceClass : 0x0 Specified at interface
bDeviceSubClass : 0x0
bDeviceProtocol : 0x0
bMaxPacketSize0 : 0x8 (8 bytes)
idVendor : 0x0461
idProduct : 0x4d65
bcdDevice : 0x200 Device 2.0
iManufacturer : 0x0
iProduct : 0x2 USB Optical Mouse
iSerialNumber : 0x0
bNumConfigurations : 0x1
CONFIGURATION 1: 98 mA ===================================
bLength : 0x9 (9 bytes)
bDescriptorType : 0x2 Configuration
wTotalLength : 0x22 (34 bytes)
bNumInterfaces : 0x1
bConfigurationValue : 0x1
iConfiguration : 0x0
bmAttributes : 0xa0 Bus Powered, Remote Wakeup
bMaxPower : 0x31 (98 mA)
INTERFACE 0: Human Interface Device ====================
bLength : 0x9 (9 bytes)
bDescriptorType : 0x4 Interface
bInterfaceNumber : 0x0
bAlternateSetting : 0x0
bNumEndpoints : 0x1
bInterfaceClass : 0x3 Human Interface Device
bInterfaceSubClass : 0x1
bInterfaceProtocol : 0x2
iInterface : 0x0
ENDPOINT 0x81: Interrupt IN ==========================
bLength : 0x7 (7 bytes)
bDescriptorType : 0x5 Endpoint
bEndpointAddress : 0x81 IN
bmAttributes : 0x3 Interrupt
wMaxPacketSize : 0x6 (6 bytes)
bInterval : 0xa
Traceback (most recent call last):
File "c:\Users\me\Documents\Python\usb\usb test.py", line 16, in <module>
if device.is_kernel_driver_active(interface):
File "C:\Users\me\AppData\Local\Programs\Python\Python37\lib\site-packages\usb\core.py", line 1064, in is_kernel_driver_active
interface)
File "C:\Users\me\AppData\Local\Programs\Python\Python37\lib\site-packages\usb\backend\libusb1.py", line 898, in is_kernel_driver_active
intf)))
File "C:\Users\me\AppData\Local\Programs\Python\Python37\lib\site-packages\usb\backend\libusb1.py", line 593, in _check
raise NotImplementedError(_strerror(ret))
NotImplementedError: Operation not supported or unimplemented on this platform
导入usb
device=usb.core.find(idVendor=0x0461,idProduct=0x4d65)#鼠标
如果设备为无:
提升值错误(“无设备”)
打印(设备)
接口=0
如果device.is\u kernel\u driver\u处于活动状态(接口):
打印(“内核驱动程序激活”)
输出为:
总线008地址002上的设备ID 0461:4d65=================
长度:0x12(18字节)
bDescriptorType:0x1设备
bcdUSB:0x200 USB 2.0
bDeviceClass:在接口处指定了0x0
bDeviceSubClass:0x0
bDeviceProtocol:0x0
bMaxPacketSize0:0x8(8字节)
ID供应商:0x0461
idProduct:0x4d65
BCD设备:0x200设备2.0
i制造商:0x0
IPProduct:0x2 USB光学鼠标
iSeries号码:0x0
bNumConfigurations:0x1
配置1:98毫安===================================
长度:0x9(9字节)
bDescriptorType:0x2配置
总长度:0x22(34字节)
bNumberFaces:0x1
B配置值:0x1
i配置:0x0
BM属性:0xa0总线供电,远程唤醒
bMaxPower:0x31(98 mA)
接口0:人机界面设备====================
长度:0x9(9字节)
bDescriptorType:0x4接口
bInterfaceNumber:0x0
bAlternateSetting:0x0
bNumEndpoints:0x1
bInterfaceClass:0x3人机界面设备
Binterface子类:0x1
bInterfaceProtocol:0x2
界面:0x0
终结点0x81:中断输入==========================
长度:0x7(7字节)
bDescriptorType:0x5终结点
bEndpointAddress:0x81英寸
BMP属性:0x3中断
wMaxPacketSize:0x6(6字节)
bInterval:0xa
回溯(最近一次呼叫最后一次):
文件“c:\Users\me\Documents\Python\usb\usb test.py”,第16行,在
如果device.is\u kernel\u driver\u处于活动状态(接口):
文件“C:\Users\me\AppData\Local\Programs\Python\37\lib\site packages\usb\core.py”,第1064行,在内核驱动程序中处于活动状态
接口)
第898行的文件“C:\Users\me\AppData\Local\Programs\Python\37\lib\site packages\usb\backend\libusb1.py”处于活动状态
intf)))
文件“C:\Users\me\AppData\Local\Programs\Python37\lib\site packages\usb\backend\libusb1.py”,第593行,在检查中
提出未实施的错误(_strerror(ret))
NotImplementedError:此平台不支持或未实现操作
我刚才也碰到了这个肿块。在我使用包装器Libusb1版本1.7.1的情况下,我也遇到了这个问题。在我的例子中,使用包装器Libusb1版本1.7.1。