On Wed, 1 Jul 2015, Peter Chen wrote: > On Tue, Jun 30, 2015 at 12:03:34PM -0400, Alan Stern wrote: > > On Tue, 30 Jun 2015, Peter Chen wrote: > > > > > Hi Alan, > > > > > > When reading the code (at qh_urb_transaction) about zero-length packet > > > for EHCI, would you please help me on below questions: > > > > > > - I have not found the zero-length qtd prepared for control read (eg, > > > the transfer size is multiple of wMaxPacketSize), Am I missing > > > something? > > > > The status stage transaction for a control-IN transfer has length 0, > > but I guess that's not what you mean. > > > > Control-IN transfers don't have a zero-length QTD in the data stage > > because IN transfers _never_ have a zero-length QTD. > > Then, how to cover the ch 8.5.3.2 Variable-length Data Stage: > > If the data structure is an exact multiple of wMaxPacketSize for the > pipe, the function will return a zero-length packet to indicate the > end of the Data stage. > > By reading your answers below, does it mean neither host nor device > need to prepare qtd and dtd for reading zero-length packet, the hardware > can handle it, and knows the data stage is over? If a control-IN transfer has a data stage that is shorter than wLength and is a multiple of the ep0 maxpacket value, then the peripheral must send a zero-length packet to indicate the end of the data stage. Thus, the UDC driver must prepare a zero-length transaction (DTD). The host hardware will recognize when this happens, because the HCD will set the appropriate bits in the data-stage qTD. For example, with EHCI the HCD will set the Alternate Next qTD Pointer. Or with UHCI, the HCD will set the SPD (Short Packet Detect) bit. But the HCD should never prepare a zero-length qTD for an IN transfer. Zero-length packets are the responsibility of the _sender_, and for IN transfers the sender is the peripheral, not the host. Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html