[PATCH] USB: Gadget: UVC: Fix unreachable control queue completion function in f_uvc.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Some UVC commands require additional data. Add usb_ep_queue(), so
uvc_function_ep0_complete() can be called and send received data
to the userspace.

Fixing maxpacket variable inicialization value to be inside USB
full speed range.

Signed-off-by: Petr Cvek <petr.cvek@xxxxxx>
---
 drivers/usb/gadget/function/f_uvc.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/function/f_uvc.c b/drivers/usb/gadget/function/f_uvc.c
index cf0df8f..9200d59 100644
--- a/drivers/usb/gadget/function/f_uvc.c
+++ b/drivers/usb/gadget/function/f_uvc.c
@@ -258,6 +258,11 @@ uvc_function_setup(struct usb_function *f, const struct usb_ctrlrequest *ctrl)
 	memcpy(&uvc_event->req, ctrl, sizeof(uvc_event->req));
 	v4l2_event_queue(&uvc->vdev, &v4l2_event);
 
+	/* Pass additional setup data to userspace */
+	if (uvc->event_setup_out && uvc->event_length) {
+		req->length = uvc->event_length;
+		return usb_ep_queue(cdev->gadget->ep0, req, GFP_ATOMIC);
+	}
 	return 0;
 }
 
@@ -868,7 +873,7 @@ static struct usb_function_instance *uvc_alloc_inst(void)
 		(const struct uvc_descriptor_header * const *)ctl_cls;
 
 	opts->streaming_interval = 1;
-	opts->streaming_maxpacket = 1024;
+	opts->streaming_maxpacket = 1023;
 
 	uvcg_attach_configfs(opts);
 	return &opts->func_inst;
-- 
1.7.12.1


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux