On 2012.09.19 09:44, Bob Lapique wrote:
> Hello,
>
> I am using the asynchronous mode.
>
> On Linux, it is pretty straightforward to detect device connection /
> disconnection with libusb_set_pollfd_notifiers().
>
> I can do it in Windows too, by checking libusb_submit_transfer() return
> code and libusb_transfer::status in callback functions installed with
> libusb_fill_*_transfer().
>
> But is there a cleaner way ?

 From within libusbx, not at the moment. And there is of course no 
guarantee that you can always detect whether a device is really plugged 
or unplugged in this fashion. At least on Windows, libusbx makes no 
promise that device presence can be inferred from the error codes 
returned by libusbx calls.

Hotplug notifications, which is really what you are after here, is 
something that will be added in a future version of libusbx. Because 
there is a lot of demand for it, it is pretty high on our list (and we 
have a proposal that we may be able to reuse), but we still have some 
backlog to deal with before we can kickstart that effort.

I'm hoping that in 6 months time, we will at least have some form of 
experimental implementation that you can use, and that can provide 
hotplug support on Linux + Windows + OS-X. I'll also see what I can do 
to revive the old libusb hotplug branch that I have [1], that should be 
at least partially usable for hotplug once brought up to speed to the 
latest libusbx (though this will not be in any official manner, and the 
final libusbx implementation of hotplug may be completely different), 
however this could also take a little while.

Regards,

/Pete

[1] 
http://git.libusb.org/?p=libusb-pbatard.git;a=shortlog;h=refs/heads/hp;js=1

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