-
Notifications
You must be signed in to change notification settings - Fork 671
Detaching kernel in Windows 10 (using libusb0) #388
Description
Hello,
Will it ever be possible to disconnect my USB device using detach_kernel_driver()?
pyusb is installed on a Windows 10 platform using libusb0 (installed with Zadig)
I can send and receive commands to the device. However, I cannot disconnect the device in a graceful way. Only by physically disconnecting the USB cable.
Finally, I used to code for this particular device using MATLAB and the USB driver that was supplied with their installation (hidapi-1.1.jar) and I know it is possible to disconnect from the device via software.
Thanks,
Eduardo
Below is an example of the code that connects to the device:
import usb.core
ID_VENDOR_LEGO = 0x0694
ID_PRODUCT_EV3 = 0x0005
device = usb.core.find(idVendor=ID_VENDOR_LEGO, idProduct=ID_PRODUCT_EV3)
print(device)
The output is:
DEVICE ID 0694:0005 on Bus 000 Address 006 =================
bLength : 0x12 (18 bytes)
bDescriptorType : 0x1 Device
bcdUSB : 0x200 USB 2.0
bDeviceClass : 0x0 Specified at interface
bDeviceSubClass : 0x0
bDeviceProtocol : 0x0
bMaxPacketSize0 : 0x40 (64 bytes)
idVendor : 0x0694
idProduct : 0x0005
bcdDevice : 0x216 Device 2.16
iManufacturer : 0x1 LEGO Group
iProduct : 0x2 EV3
iSerialNumber : 0x3 001653470e58
bNumConfigurations : 0x1
CONFIGURATION 1: 2 mA ====================================
bLength : 0x9 (9 bytes)
bDescriptorType : 0x2 Configuration
wTotalLength : 0x29 (41 bytes)
bNumInterfaces : 0x1
bConfigurationValue : 0x1
iConfiguration : 0x1 LEGO Group
bmAttributes : 0xc0 Self Powered
bMaxPower : 0x1 (2 mA)
INTERFACE 0: Human Interface Device ====================
bLength : 0x9 (9 bytes)
bDescriptorType : 0x4 Interface
bInterfaceNumber : 0x0
bAlternateSetting : 0x0
bNumEndpoints : 0x2
bInterfaceClass : 0x3 Human Interface Device
bInterfaceSubClass : 0x0
bInterfaceProtocol : 0x0
iInterface : 0x4 Xfer data to and from EV3 brick
ENDPOINT 0x81: Interrupt IN ==========================
bLength : 0x7 (7 bytes)
bDescriptorType : 0x5 Endpoint
bEndpointAddress : 0x81 IN
bmAttributes : 0x3 Interrupt
wMaxPacketSize : 0x400 (1024 bytes)
bInterval : 0x4
ENDPOINT 0x1: Interrupt OUT ==========================
bLength : 0x7 (7 bytes)
bDescriptorType : 0x5 Endpoint
bEndpointAddress : 0x1 OUT
bmAttributes : 0x3 Interrupt
wMaxPacketSize : 0x400 (1024 bytes)
bInterval : 0x4