Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
ReadPipeAsync drops first message?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ReadPipeAsync drops first message?



That got your attention, didn't it? Well, it might not be just a ploy.

My code calls ReadPipeAsync repeatedly expecting to receive a stream of
multi-byte messages. For purposes of this description, you may assume each
message is a byte count and a payload, so it's more than one byte.

Most of the time, ReadPipeAsync works as I expect. About 20% of the time,
however, it fails to read the the first message I expect it to read. I have
not been able to define "sometimes" any more precisely than this.

In the failure case, I seem to receive the second message just fine, so it
seems to be a message-level problem (which is odd since nobody but the
device and the driver know about the message format). The second message
happens to contain the second expected payload byte, so the practical effect
is that I lose the first payload byte. In other words, in the failure case,
I "should" have received a first message containing one byte. In the success
case, the first message contains the first and second bytes I expected.

I've tried ClearPipeStallBothEnds just after opening the interface and just
before issuing reads on its pipes. I admit this was superstition. I saw
something in the documentation about making sure both ends were in sync. I
was guessing maybe an improperly shut down interface (due to debugging)
might have caused some confusion. In any case this didn't help.

No such problem has appeared on Mac OS 9 or the various flavors of Windows
we support. I know a device working on some other OS isn't proof of
anything, but it's interesting. As well, this code supports multiple
devices, and we have reports of a similar failure on more than one of them,
though again that doesn't prove anything.

Anybody got any ideas how to proceed with debugging this?

  --

    Pete Gontier
    http://www.m-audio.com/
_______________________________________________
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.




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

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.