Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reading less than the available bytes



At 12:45 PM -0700 3/22/02, Fernando Urbina wrote:
email@hidden said:

 The problem is that, at least with synchronous calls, IOKit does not seem
 to like the fact that I ask for only 1 byte from the read pipe when there
 may be more available (even if I'm in a loop and will immediately be
 asking for another byte).  I get an IOReturnOverrun error.

This seems to indicate that even though we gave it a 1 byte buffer, the device returned more than that (hence the overrun). The error does not come from "IOKit" per se -- we are reporting what the OHCI controller told us. I'm afraid that all the bytes that were transferred are gone, so you can't get at them?

This seems to be normal for a bulk device. In bulk transfers any transfer less than a maximum size packet terminates a transfer.


If you're reading from a bulk pipe in general, you should round all of your requests up to the next multiple of the maximum packet size (almost always 64) and buffer any extra bytes yourself -- if the device returns less than 64 bytes the read will return with actCount < reqCount which you can just handle.

Otherwise, IIRC, the host just requests a packet from the device and if there's more data ready, you'll get an overrun, lose data, and have to clear a stall.

Hope this helps,

-Steve
_______________________________________________
usb mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/usb
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Reading less than the available bytes (From: Fernando Urbina <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.