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: length parameter of IOUSBPipe->write()



Sorry for the late reply, I'm a bit behind on reading mailing lists...

On Mon, 10 Jan 2005, Barry Twycross wrote:
>
> At 4:51 PM -0500 1/9/05, Daniel Sumorok wrote:
>
> >	As far as I could tell, the number of bytes being transfered on
> >the bus was not correct.
>
> I think you may be right. The important parameter is the buffer end
> field of the OHCI transfer descriptor
> (pOHCIGeneralTransferDescriptor->pShared->bufferEnd), on the last
> transfer descriptor if should be the address of the last byte of the
> buffer, but it seems to be the last byte of the page on which the end
> of the buffer resides, or possibly the last byte of the next page.
<snip>
> This code is basically unchanged since the dawn of time and this is
> the first time anyone's pointed this out,

Actually, it isn't. I spent many weeks scratching my head trying to figure
out what was wrong with my code, until I found this bug and its source.
This was in May last year. I even posted a patch to this mailing list to
fix it but it was ignored:

<http://lists.apple.com/archives/usb/2004/May/msg00088.html>

> and it should be glaringly
> obvious to anyone who has this problem,

It wasn't at all obvious to me, until I thought it might not be my bug and
looked into the Darwin source...

> so I can only presume that
> most developers do not uses buffers which are a subset of their
> memory descriptor. I'd be hesitant about "fixing" this bug, there may
> be code out there which does not pass the buffer size parameter
> correctly and will break if we fix it. Documenting the behaviour is
> probably the safest option.

That at least would be nice to see. (And was what I asked for as the
second-best action in May too).

> This behaviour may also be in the EHCI controller, I based that
> memory allocation code on the OHCI code. It might be more critical in
> the EHCI as it could possibly run on 4 pages before getting to the
> end of a transfer descriptor. (EHCI transfer descriptors can describe
> 5 pages, whereas OHCI can only describe 2.)
> --
> Barry Twycross
> email@hidden
>                       ---
>           USB, it's not a Dyslexic BUS.        (Thanks to TC.)

{P^/
 _______________________________________________
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

References: 
 >USB (From: "nishino tetsuya" <email@hidden>)
 >length parameter of IOUSBPipe->write() (From: Daniel Sumorok <email@hidden>)
 >Re: length parameter of IOUSBPipe->write() (From: David Ferguson <email@hidden>)
 >Re: length parameter of IOUSBPipe->write() (From: Daniel Sumorok <email@hidden>)
 >Re: length parameter of IOUSBPipe->write() (From: Barry Twycross <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.