Skip to content

Commit

Permalink
USB: musb: respect usb_request->zero in control requests
Browse files Browse the repository at this point in the history
In gadget mode the answer to a control request should be followed by
a zero-length packet if the amount transferred is an exact multiple of
the endpoint's packet size and the requests has its "zero" flag set.

This patch prevents the request from being immediately removed from the
queue when a control IN transfer ends on a full packet and "zero" is set.
The next time ep0_txstate is entered, a zero-length packet is queued and
the request is removed as fifo_count is 0.

Signed-off-by: Daniel Glöckner <dg@emlix.com>
Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Daniel Glöckner authored and Greg Kroah-Hartman committed Dec 1, 2009
1 parent dfeffa5 commit 5542bc2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/usb/musb/musb_gadget_ep0.c
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,8 @@ static void ep0_txstate(struct musb *musb)

/* update the flags */
if (fifo_count < MUSB_MAX_END0_PACKET
|| request->actual == request->length) {
|| (request->actual == request->length
&& !request->zero)) {
musb->ep0_state = MUSB_EP0_STAGE_STATUSOUT;
csr |= MUSB_CSR0_P_DATAEND;
} else
Expand Down

0 comments on commit 5542bc2

Please sign in to comment.