FreeBSD 8: libusb async mode + select(2) = nogo?

Peer Stritzinger peerst at
Fri Jul 23 18:59:42 UTC 2010

On Fri, Jul 23, 2010 at 7:21 PM, Hans Petter Selasky <hselasky at> wrote:

> Should work, but it might be that the second poll, when you try to process the
> events, don't work like expected. After any event on the two fd's you should
> call "libusb_handle_events_locked()" using a "tv = NULL".

With libusb_handle_events_locked() instead of
libusb_handle_events_timeout() there is no improvement ...

It looks like if there is a IN alread pending on the bus when program
runs the first select call returns the filedesc correctly but after
this nothing triggers the second select.  At least most of the time it
looks like IN transfers that are received during the second select are
somehow swallowed unhandled.

If there is no IN pending on the bus the first select also returns but
libusb_handle_events_locked() doesn't call a callback, then the second
select also fails.

-- Peer
Could it be that after the poll() in lib_usb_handle_events_*() libusb
or the usb stack is somewhat in a corrupt state?

More information about the freebsd-usb mailing list