Device.is_kernel_driver_active () не работает в libusb-1.0.22.7z? - PullRequest
0 голосов
/ 18 июня 2019

Почему я получаю сообщение «Операция не поддерживается или не реализована на этой платформе»?

Я использую 64-битную версию Windows 10 и установил 64-битную версию Python 3.7, 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 \ Python37 \.

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