|
From: Dan E. <dan...@ne...> - 2007-06-06 16:34:38
|
Dave Higton wrote:
>
> In the Linux version of libusb, the usb_interrupt_read () function can
> accept a value of 0 for the timeout, which is interpreted as "infinite".
> In the win32 version, this is not accepted. OK, I can put any finite
> timeout that I choose, and loop round infinitely on a separate thread,
> putting any resulting input into a FIFO.
>
> But what happens if a USB message comes in immediately after the
> timeout, but before the new call? Is any such message lost?
>
After the timeout, the host will no longer be sending IN requests, so
the device will not be able to return any data.
There's possibly a tiny hole - after the timeout has elapsed, libusb
then cancels the IO. The IO could have validly completed between these 2
events, but the data would be lost.
if(WaitForSingleObject(c->ol.hEvent, timeout) == WAIT_TIMEOUT)
{
/* request timed out */
if(cancel)
{
_usb_cancel_io(c);
/* wait until the request is cancelled */
WaitForSingleObject(c->ol.hEvent, 0);
}
usb_error("usb_reap: timeout error");
return -ETIMEDOUT;
}
Dan.
|