Hi,
On Fri, Jul 23, 2010 at 7:21 PM, Hans Petter Selasky <[email protected]> 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".
Added some debug printing to make watching these easier:
active config: num_interfaces: 1
interface 0: num_altsetting: 1
if_desc 0: n_ep=4 if_nr=0
max packet on 3.2.6 = 512
setup_usb_fds: read 3
setup_usb_fds: read 6
setup_usb_fds: write 6
setup_usb_fds: nfds 6
calling select ...
returned 1 -> so select returns once (always as it looks)
check_usb_fds: found desc 3 in readfds
calling libusb_handle_events_timeout
transfer_completed: actual_len: 52 -> and also gets a transfer from
the usb (this resubmits the IN transfer)
setup_usb_fds: read 3
setup_usb_fds: read 6
setup_usb_fds: write 6
setup_usb_fds: nfds 6
calling select ... -> but here it hangs until a signal
The code that did output this still using libusb_handle_events_timeout()
rv = libusb_submit_transfer(tr);
assert(rv == 0);
sp.pollfds = libusb_get_pollfds(ctx);
while (1)
{
timeout_pending = libusb_get_next_timeout(ctx, &timeout);
setup_usb_fds (&sp);
printf("calling select ...\n");
rv = select(sp.nfds, &sp.readfds, &sp.writefds, &sp.exceptfds,
(timeout_pending) ? &timeout : NULL);
printf("returned %d\n", rv);
assert (rv >= 0 || errno == EINTR);
if (rv == 0 || (rv > 0 && check_usb_fds (&sp)))
{
printf ("calling libusb_handle_events_timeout\n");
libusb_handle_events_timeout(ctx, NULL);
}
}
-- Peer
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "[email protected]"