On Wed, Jul 01, 2015 at 10:16:12AM -0400, Alan Stern wrote: > 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). > If "one" is "multiple"? The wLength at setup packet is 64 bytes, Maximum Packet Length at dQH is 64 bytes, and the Total Bytes at dTD is 64 bytes too, does device must prepare a zero-length packet? I would like to double confirm it since the iPhone (As host after HNP) can't work well with it if I have a zero-length packet after 64 bytes packet which I describe above, if without zero-length packet, the iPhone works well. > 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. > I see it in the code, but it is a null pointer (EHCI_LIST_END), does it mean one qTD (with valid Next qTD Pointer) can handle one 64 byte packet with or without zero-length packet well both? Any reasons why iPhone can't handle zero-length packet well? > 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 > -- Best Regards, Peter Chen -- 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