[PATCH V3 1/5] usb: gadget/uvc: Fix VS_INPUT_HEADER.bEndpointAddress and Video Streaming.bEndpointAddress values

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

 



This patch corrects the VS_INPUT_HEADER.bEndpointAddress and Video
Streaming.bEndpointAddress values which were incorrectly set to 0 in UVC
function driver.

As 'usb_ep_autoconfig' function returns an un-claimed usb_ep, and modifies the
endpoint descriptor's bEndpointAddress, so there is no need to again set
the bEndpointAddress for Video Streaming and VS_INPUT_HEADER decriptors
(for all speeds: SS/HS/FS) to the bEndpointAddress obtained for Full
Speed case from 'usb_ep_autoconfig' function call.

Signed-off-by: Bhupesh Sharma <bhupesh.sharma@xxxxxx>
---
 drivers/usb/gadget/f_uvc.c |   30 ++++++++++++++++++++----------
 1 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/gadget/f_uvc.c b/drivers/usb/gadget/f_uvc.c
index b34349f..1769f3e 100644
--- a/drivers/usb/gadget/f_uvc.c
+++ b/drivers/usb/gadget/f_uvc.c
@@ -550,8 +550,24 @@ uvc_copy_descriptors(struct uvc_device *uvc, enum usb_device_speed speed)
 	UVC_COPY_DESCRIPTORS(mem, dst,
 		(const struct usb_descriptor_header**)uvc_streaming_cls);
 	uvc_streaming_header->wTotalLength = cpu_to_le16(streaming_size);
-	uvc_streaming_header->bEndpointAddress =
-		uvc_fs_streaming_ep.bEndpointAddress;
+
+	switch (speed) {
+	case USB_SPEED_SUPER:
+		uvc_streaming_header->bEndpointAddress =
+			uvc_ss_streaming_ep.bEndpointAddress;
+		break;
+
+	case USB_SPEED_HIGH:
+		uvc_streaming_header->bEndpointAddress =
+			uvc_hs_streaming_ep.bEndpointAddress;
+		break;
+
+	case USB_SPEED_FULL:
+	default:
+		uvc_streaming_header->bEndpointAddress =
+			uvc_fs_streaming_ep.bEndpointAddress;
+		break;
+	}
 
 	UVC_COPY_DESCRIPTORS(mem, dst, uvc_streaming_std);
 
@@ -681,17 +697,11 @@ uvc_function_bind(struct usb_configuration *c, struct usb_function *f)
 	/* Copy descriptors for FS. */
 	f->descriptors = uvc_copy_descriptors(uvc, USB_SPEED_FULL);
 
-	if (gadget_is_dualspeed(cdev->gadget)) {
-		uvc_hs_streaming_ep.bEndpointAddress =
-				uvc_fs_streaming_ep.bEndpointAddress;
+	if (gadget_is_dualspeed(cdev->gadget))
 		f->hs_descriptors = uvc_copy_descriptors(uvc, USB_SPEED_HIGH);
-	}
 
-	if (gadget_is_superspeed(c->cdev->gadget)) {
-		uvc_ss_streaming_ep.bEndpointAddress =
-				uvc_fs_streaming_ep.bEndpointAddress;
+	if (gadget_is_superspeed(c->cdev->gadget))
 		f->ss_descriptors = uvc_copy_descriptors(uvc, USB_SPEED_SUPER);
-	}
 
 	/* Preallocate control endpoint request. */
 	uvc->control_req = usb_ep_alloc_request(cdev->gadget->ep0, GFP_KERNEL);
-- 
1.7.2.2

--
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