FreeBSD 8: libusb async mode + select(2) = nogo?
Hans Petter Selasky
hselasky at c2i.net
Fri Jul 23 17:24:48 UTC 2010
On Friday 23 July 2010 19:12:46 Peer Stritzinger wrote:
> Hi,
>
> On Fri, Jul 23, 2010 at 4:57 PM, Hans Petter Selasky <hselasky at c2i.net>
wrote:
> > What are the polling flags you are using?
>
> Do you mean the libusb_pollfd entries?
>
> They are:
>
> {fd = 0x7, events = 0x1}
> {fd = 0xc, events = 0x45}
>
> I translate these into select(2) params like this:
>
> nfds = 0xc, readfds = {__fds_bits = {0x1080, 0x0 <repeats 31 times>}},
> writefds = {__fds_bits = {0x1000, 0x0 <repeats 31 times>}}, exceptfds = {
> __fds_bits = {0x0 <repeats 32 times>}},
>
> And call select with timeout = NULL (since libusb_get_next_timeout returned
> 0)
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".
--HPS
More information about the freebsd-usb
mailing list