Mailing Lists: Apple Mailing Lists

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

length parameter of IOUSBPipe->write()



Hello,

	I am developing an in-kernel usb device driver.  When I call the
following method, defined in IOUSBPipe.h, the "reqCount" parameter is
ignored.  Instead, it uses buffer->GetLength().

virtual IOReturn Write(
    IOMemoryDescriptor * buffer,
    UInt32 noDataTimeout,
    UInt32 completionTimeout,
    IOByteCount reqCount,
    IOUSBCompletion * completion = 0);

I think I traced the problem down to the
AppleUSBOHCI::CreateGeneralTransfer() method in AppleUSBOHCI_UIM.cpp
(from the Darwin source).  In this method, the "reqCount" parameter is
passed in as "bufferSize".  The following is an abridged excerpt from the
CreateGeneralTransfer() function:

        transferOffset = 0;
        while (transferOffset < bufferSize)
        {
	  // Figure out what pages compromise the memory descriptor,
	  // and get the phsical address of those pates
          if (pageCount == 2)
	  {
	    // ...
            transferOffset += physicalAddresses[1].length;
          }
          transferOffset += physicalAddresses[0].length;
	  // ...
        }

  It appears (to me) that the length of the transfer is set by the
  memory descriptor length, not the "reqCount" (or "bufferSize")
  parameters.  Even though the while() condition depends on the
  "bufferSize" variable, the body of the while loop uses on the size
  of the memory descriptor.  Is this the intended behavior?

	-Dan
 _______________________________________________
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>)



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.