Install Libusb Windows 10
The problem is that i didn't include libusb0.dll and libusb-1.0.dll files in PATH environment variable location (.) PyUSB module will check for libusb0.dll and libusb-1.0.dll files (which act as backends) in the PATH environment variable and in C: windows System32 locations and then establishes communication with USB devices. Since i'm using libusb-win32-wizard for creating device drivers it uses libusb0.dll. The process of execution can be found using following DEBUG program: import os os.environ['PYUSB_DEBUG'] = 'debug' import usb.core print list(usb.core.find(find_all=True)) The favourite file manager (not 'Explorer'!) found dozens of those DLLs splattered all over the place - 'Windows DLL Hell' at it's finest!
I have a custom composite USB device with usbser, winusb, usbstor interfaces. We have a few hundred devices running for three ish years now, with billions of libusb operations. (Thanks folks!) on win7,8,10. The unit has a feature in which I send a command to the winusb interface to reconfigure it's usb serial#. The device soft disconnects from the USB bus, changes part of it's descriptor (the serial number), waits 500ms (or 2seconds, doesn't help the issue) and then reconnects. Under windows 7, and the virus known as windows 8, this works fine. Under windows 10, I get a duplicate entry of the old device in my libusb_get_device_list structure.
Below is a data dump. Free pdf download. I have libusb debugging turned on (hence the first 3 lines) The first line (VID 046D) is a USB flash drive that was unplugged during a PRIOR power cycle of the box. Lara wendel spielen wir liebe. Where or why libusb is complaining about this device is a mystery to me. At the same time it may likely be a clue to the what is going on.
Using usbdview, all 3 errant devices are not present. The second 2 lines (VID 2B2A) refer to the winusb and msc interfaces on my composite device, and the parent id of 17AD5DBB is the old parent from the previous enumeration of my device. (with the old serial number). 2B2A is a private USB VID.
Finally, the 0), 1), 2), is a simple crawl of the libusb_get_device_list with libusb_get_devicedescriptor There should be only one VID 2B2A in this list (as there is on win7/8); there is only 1 device attached to the PC. If I reboot, there is in fact only 1 device present, and things work. However, rebooting isn't really an option for the actual use case of the product. (but I still get the gripe about the USB flash drive) libusb: error [init_device] device '. USB#VID_046D&PID_C080&MI_01#6&33F61665&0&0001' is no longer connected! Libusb: error [init_device] device '. USB#VID_2B2A&PID_0156&MI_02#6&17AD5DBB&1&0002' is no longer connected!
Libusb: error [init_device] device '. USB#VID_2B2A&PID_0156&MI_03#6&17AD5DBB&1&0003' is no longer connected! • VID 1B21 PID 1242 CLS 0000 PROT 00 • VID 1B1C PID 1B15 CLS 0000 PROT 00 • VID 1B1C PID 1B15 CLS 0000 PROT 00 • VID 046D PID C080 CLS 0000 PROT 00 • VID 2B2A PID 0156 CLS 00EF PROT 01 • VID 2B2A PID 0156 CLS 00EF PROT 01 • VID 8086 PID A12F CLS 0000 PROT 00 Any suggestions are welcome. I unload libusb as soon as possible after firing off the call that causes the disconnect/modification of the serial number/reconnect. I am confident that I have unloaded the libusb default context, closed libusb, and exited my program before the USB endpoint device performs the soft-disconnect. The errant behavior happens on 3 different windows 10 Pro boxes. In all cases, the device is connected to the root hub embedded in the Intel chipset.