Skip to content

Commit f15d443

Browse files
wuliangfengopsiff
authored andcommitted
usb: gadget: f_hid: Fix zero length packet transfer
[ Upstream commit ed6f727 ] Set the hid req->zero flag of ep0/in_ep to true by default, then the UDC drivers can transfer a zero length packet at the end if the hid transfer with size divisible to EPs max packet size according to the USB 2.0 spec. Signed-off-by: William Wu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Sasha Levin <[email protected]> (cherry picked from commit 38c179c52d22272bd5df9d0b14caa6a2e2e3d3e3) Signed-off-by: Wentao Guan <[email protected]>
1 parent bb75105 commit f15d443

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/usb/gadget/function/f_hid.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ static ssize_t f_hidg_write(struct file *file, const char __user *buffer,
494494
}
495495

496496
req->status = 0;
497-
req->zero = 0;
497+
req->zero = 1;
498498
req->length = count;
499499
req->complete = f_hidg_req_complete;
500500
req->context = hidg;
@@ -765,7 +765,7 @@ static int hidg_setup(struct usb_function *f,
765765
return -EOPNOTSUPP;
766766

767767
respond:
768-
req->zero = 0;
768+
req->zero = 1;
769769
req->length = length;
770770
status = usb_ep_queue(cdev->gadget->ep0, req, GFP_ATOMIC);
771771
if (status < 0)

0 commit comments

Comments
 (0)