Closed wjasper closed 2 years ago
Hello,
openByVendorIDAndProductID
is intended to map libusb_open_device_with_vid_pid
from the C library. Quoting the documentation:
This function is intended for those scenarios where you are using libusb to knock up a quick test application - it allows you to avoid calling libusb_get_device_list() and worrying about traversing/freeing the list.
IOW, it's a simple helper for simple needs, more complex needs should call the elementary underlying methods (get list of devices, get descriptors, decide what/how to match, maybe also involve hotplug support where supported, ...).
I close this, as I do not think python-libusb1 can cover all enumeration cases, so this is probably best left for the application to implement.
It would be great if openByVendorIDAndProductID() took an optional argument serialNumber. That way, if there were two or more USB devices with the same vendorID and productID, there would be an easy way to get a usb handle on the correct one. The default could be serialNumber =None to just return the first device that was not already open.