Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

usb: gadget: f_hid: Fix zero length packet transfer

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 <william.wu@rock-chips.com>
Link: https://lore.kernel.org/r/1756204087-26111-1-git-send-email-william.wu@rock-chips.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

William Wu and committed by
Greg Kroah-Hartman
ed6f727c e271cc0d

+2 -2
+2 -2
drivers/usb/gadget/function/f_hid.c
··· 511 511 } 512 512 513 513 req->status = 0; 514 - req->zero = 0; 514 + req->zero = 1; 515 515 req->length = count; 516 516 req->complete = f_hidg_req_complete; 517 517 req->context = hidg; ··· 967 967 return -EOPNOTSUPP; 968 968 969 969 respond: 970 - req->zero = 0; 970 + req->zero = 1; 971 971 req->length = length; 972 972 status = usb_ep_queue(cdev->gadget->ep0, req, GFP_ATOMIC); 973 973 if (status < 0)