I am reading data for a USB device using the following principle
algorithms:
algorithm (1)
for (;;)
{
...
(*dev)->ReadPipeTO(...,&size,10,10000);
...
if (size == 0) break;
}
or
algorithm(2)
for (;;)
{
...
milliSleep(10); // sleeps for 10 milliseconds
(*dev)->ReadPipeTO(...,&size,0,0);
...
if (size == 0) break;
}
While I can read all the data from my device using algorithm 2 I cannot
do with algorithm 1. In the middle of the transfer there is no data
anymore available and algorithm 1 quits the for-loop too early. This
does not occur with algorithm 2.
From my point of view the two methods reading the USB device should be
identical (ignoring the 10000 completion timeout in the ReadPipeTO). But
they are not. Actually the second example works while the first one
fails. Can anybody tell me where the difference is? Using Mac OSX 10.5.2
and IOUSBInterfaceInterface220.
Hartwig
PS: What is the recommended parameter setting for ReadPipeTO to ignore
the completion timeout (I assume 0)?