On Wed, 3 Jan 2007, David Brownell wrote:

> On Tuesday 02 January 2007 4:35 am, Phil Endecott wrote:
> > Dear All,
> > 
> > How should a gadgetfs application cause an ACK to be sent to the host 
> > in response to a sucessfully received and processed control out transaction?
> 
> I'm presuming you mean "start the STATUS stage" ... which is not the same
> thing as sending an ACK.

He meant "complete the STATUS stage".  The host is responsible for 
starting it, and the device responds with a 0-length DATA1 packet (not 
an ACK).

>  The controller acks automatically, and then after
> the last DATA stage packet is sent, the STATUS stage is a packet going the
> other direction.  Until the STATUS stage is acked, the control transfer has
> not completed.
> 
> Modulo hardware interface botches which will in at least one case (AT91)
> preclude this for gadgetfs, the status stage should start automatically
> when all the data has been read.  So:  issue a read (this is OUT) for
> N (>0) bytes, and the underlying controller driver should automatically
> start the STATUS stage of the control transfer.

This is slightly unfortunate.  Section 8.5.3.1 of the USB spec states that 
the DATA1 packet of a control-OUT STATUS stage shouldn't be sent until the 
device has completed carrying out the request.  But gadgetfs (and probably 
the controller drivers too) won't wait; it will send the 0-length data 
packet as soon as the OUT data has been received.

> Something to be aware of:  not all gadget controller drivers seem to
> handle control-OUT transfers correctly ... especially in the "deferred
> response" mode needed by gadgetfs.  You can test control-OUT transfers
> using "usbtest" test case #14; and g_file_storage uses deferred response
> mode, but ISTR not for control-OUT transfers.  You might be hitting a
> controller driver (or controller!) bug specific to that combination...

g_file_storage does use control-OUT transfers with non-empty DATA stages
when you run it using the CB or CBI transport (that's how each SCSI
command gets sent), but then it doesn't use a deferred response.  And
g_file_storage does use a deferred response for the Bulk-Only Reset and
Set Configuration requests, but although they are control-OUT transfers
they don't have any DATA stages.

So g_file_storage might not be the best test case for these questions.

Alan Stern


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to