Skip to content

Commit

Permalink
USB: gadget: g_serial: append zlp when tx buffer becomes empty
Browse files Browse the repository at this point in the history
Some usb serial host drivers expect a short packet before they forward
the data to the application. This is caused by them trying to read more
than one packet at a time. So when the gadget sends an exact multiple
of the maximum packet size, it should append a zero-length packet.

Signed-off-by: Daniel Glöckner <dg@emlix.com>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Daniel Glöckner authored and Greg Kroah-Hartman committed Jun 16, 2009
1 parent 9b8e7ba commit 2e25134
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/usb/gadget/u_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ __acquires(&port->port_lock)

req->length = len;
list_del(&req->list);
req->zero = (gs_buf_data_avail(&port->port_write_buf) == 0);

pr_vdebug(PREFIX "%d: tx len=%d, 0x%02x 0x%02x 0x%02x ...\n",
port->port_num, len, *((u8 *)req->buf),
Expand Down

0 comments on commit 2e25134

Please sign in to comment.