Mailing Lists: Apple Mailing Lists

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

Fwd: ReadPipeTO timeouts not working?



Sorry, missed sending to the list. It seems the list emailer is not correct, and that the replies come directly from the sender (not the list)? Is this the case? (This was my first post using the usb list...).

Begin forwarded message:

From: robert engels <email@hidden>
Date: October 24, 2006 1:25:04 PM CDT
To: Barry Twycross <email@hidden>
Subject: Re: ReadPipeTO timeouts not working?

Well, I sort of hacked around it. if I get one of these 0 length replies, I just sleep the thread for 1 sec, then try again, and do my own timeout calculations, before returning a success or error from the libusb bulk transfer.

Seems to work ok, and solves the CPU utilization problem. Probably not the best solution for high speed devices, but I am not sure libusb uses the correct impl there anyway.

On a side note to that, are the kernel drivers doing any buffering on the pipes. What I mean is that if I do not have an outstanding ReadPipe or ReadPipeAsync on the pipe, and the devices sends data, is it lost? Or is there some lower level buffer or protocol that would not allow this to happen (i.e. the device is prohibited from sending if there are no outstanding reads).

On Oct 24, 2006, at 1:15 PM, Barry Twycross wrote:

At 11:54 AM -0500 10/24/06, robert engels wrote:

What I have found is that during certain exchange sequences, ReadPipeTO with a timeout specified (45000ms) returns immediately with kIOReturnSuccess but a read size of 0.

How can this be? Could the printer be signaling a NAK, or some such thing, and ReadPipeTO is interpreting this as a valid read.

It could be returning a zero length packet, only a bus trace would tell you for sure. You might get some hints from the logging family at a high logging level.

A NAK should never cause a completion.

I've seen printers which do return zero length packets when they have nothing to say. Its a reasonable way of saving bus bandwidth.
-- 
Barry Twycross
                     ---
         USB, it's not a Dyslexic BUS.        (Thanks to TC.)
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Usb mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Usb mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/usb/email@hidden

This email sent to 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.