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.

> I'll look into it.

OK. Let us know how it goes.

Regards,

/Pete

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

Reply via email to