Hi Bob,

Bob Lapique wrote:
> On Linux, it is pretty straightforward to detect device connection / 
> disconnection with libusb_set_pollfd_notifiers().

This is unfortunately not very portable use of the libusb-1.0 API,
in particular it's not portable to Windows, because Windows doesn't
use file descriptors like the other systems supported by libusbx
and libusb.


> 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().

Yes, this is the better way to use the API, but note what Pete wrote
about the Windows backend - he knows that code very well.

As I understand him, libusbx and libusb do not neccessarily report
errors on Windows like they do on other systems when a device is
disconnected, meaning that even the more portable use of the API
may not work well enough for your needs.

I suggest to simply try it out, and I'd ask you to file a bug at
least for libusb if there's a difference in behavior between some
of the supported systems. I don't know how a github issue would be
received here in libusbx, Pete has mentioned that he prefers to get
the hotplug support done.

The internal state that is created by support for hotplug
notification should indeed make it very easy to return errors
consistently across all platforms, but for libusb I consider
it a bug worth tracking if that doesn't happen also without
hotplug.


//Peter

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