From 2e25134122c25ebb0679b4bbd536fb46c669f9d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Gl=C3=B6ckner?= Date: Thu, 28 May 2009 12:53:24 +0200 Subject: USB: gadget: g_serial: append zlp when tx buffer becomes empty MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Cc: David Brownell Signed-off-by: Greg Kroah-Hartman --- drivers/usb/gadget/u_serial.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/usb/gadget') diff --git a/drivers/usb/gadget/u_serial.c b/drivers/usb/gadget/u_serial.c index 0a4d99ab40d..fc6e709f45b 100644 --- a/drivers/usb/gadget/u_serial.c +++ b/drivers/usb/gadget/u_serial.c @@ -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), -- cgit v1.2.3