Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Mac > Mac Programmer Help > Unable to read ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 2 Topic 3728 of 3882
Post > Topic >>

Unable to read data correctly via USB and ReadPipeTO

by H <H@[EMAIL PROTECTED] > Apr 29, 2008 at 03:53 PM

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)?
 




 2 Posts in Topic:
Unable to read data correctly via USB and ReadPipeTO
H <H@[EMAIL PROTECTED]  2008-04-29 15:53:06 
Re: Unable to read data correctly via USB and ReadPipeTO
Jonathan Hoyle <jonhoy  2008-05-19 11:34:51 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Dec 5 11:23:16 CST 2008.