David:
It's not clear how the gadget API handles the data and status stages of a control transfer. The impression I have is that the queued requests are bi-directional; the gadget controller reads the request buffer if it gets an IN packet and writes the request buffer if it gets an OUT packet.
Erm, other way around: IN to the host means the gadget writes (but the host reads); and OUT to the device means the gadget reads (host writes).
But what happens for the status stage?
It proceeds automatically, unless the gadget driver tells the controller to stall. We can't get too fancy here because not all hardware gives as much packet-level control for ep0 as the net2280 does ... we need more of a "least common denominator" control model here in the API.
The simplest way a gadget driver tells the controller driver to stall ep0 is to return an error from the setup() callback ... that's easy when the request is bogus or unrecognized. That will likely stall the data stage.
But once the gadget driver writes a buffer IN to the host, the status stage is committed to succeed. (If it weren't going to succeed, then there would be no point in providing the IN buffer...)
In zero.c, status requests are queued for control transfers involving no
data. For IN control transfers (like GET INTERFACE or GET CONFIGURATION) the data request is queued but no status. What does the controller do in
response to the status packet? There aren't any examples of OUT control
transfers, but my guess is that the gadget driver must queue both a data
request and a status request. Is that right?
No, see above. Not all hardware lets drivers have that level of control, so the API doesn't expect it. Gadget drivers either stall, or transfer a buffer.
SET_INTERFACE and SET_CONFIGURATION are both control OUT, but they're a bit special: the data stage must be zero length, so it doesn't go over the wire. But the same rule applies: either stall (setup returning an error; or halting ep0), or transfer a buffer (zero length).
What we don't have examples of yet are control-OUT with actual data. I'm told that it works now with net2280 (someone prototyped a wireless router, 802.11g plus high speed USB, using RNDIS); but it's not yet coded for the pxa2xx. The test suite needs some additions there (and for ISO, high bandwidth, etc).
- Dave
Alan Stern
------------------------------------------------------- This SF.net email is sponsored by: VM Ware With VMware you can run multiple operating systems on a single machine. WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the same time. Free trial click here:http://www.vmware.com/wl/offer/358/0 _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel