Commit ed6f727c authored by William Wu's avatar William Wu Committed by Greg Kroah-Hartman
Browse files

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: default avatarWilliam 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: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e271cc0d
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -511,7 +511,7 @@ static ssize_t f_hidg_write(struct file *file, const char __user *buffer,
	}

	req->status   = 0;
	req->zero     = 0;
	req->zero     = 1;
	req->length   = count;
	req->complete = f_hidg_req_complete;
	req->context  = hidg;
@@ -967,7 +967,7 @@ static int hidg_setup(struct usb_function *f,
	return -EOPNOTSUPP;

respond:
	req->zero = 0;
	req->zero = 1;
	req->length = length;
	status = usb_ep_queue(cdev->gadget->ep0, req, GFP_ATOMIC);
	if (status < 0)