On 05/14/2012 06:22 PM, Pete Batard wrote: > On 2012.05.14 16:48, Uri Lublin wrote: >> The scenario I was looking at is: >> libusb_get_device_list >> device = go over the list of devices and find the one with >> appropriate vid,pid >> libusb_open(device) >> if failed: >> install libusb device driver >> rescan devices (call libusb_get_device_list and >> libusb_free_device_list) >> libusb_open(device) > This shouldn't be too different from what I tested, so I'd expect it to > work. open_with_vid_pid(), which is what I used in my test, is mostly a > wrapper for get_device_list() + open() + free_device_list(). > >> Maybe the problem can be solved in the application. >> Likely I can unref it before driver installation, and find it again >> after the installation. >> That would be similar of using libusb_open_with_vid_pid. > Yeah. What I'm not clear about is that if libusb_open failed, your > refcount for the device should be zero when you destroy the device list, > so the next time you call get_device_list, you should be able to find > the device with the WinUSB driver instead. > > A device that cannot be opened should not be kept instantiated by > libusbx outside of get_device_list-free_device_list, so maybe the only > thing you miss is ensuring the device list is destroyed before you call > on get_device_list again.
We keep a list of all the devices that are plugged into the system (including cold-plug devices), not only opened devices. That way users can pick a device they want to share with guests. My plan is to check how hard it would be to unreference the libusb_device before installing the driver, and reference back after the installation. Thanks, Uri. ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ libusbx-devel mailing list libusbx-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libusbx-devel