Skip to content

Commit c70793f

Browse files
shuzhenwanggregkh
authored andcommitted
usb: gadget: uvc: Add missing initialization of ssp config descriptor
In case the uvc gadget is super speed plus, the corresponding config descriptor wasn't initialized. As a result, the host will not recognize the devices when using super speed plus connection. This patch initializes them to super speed descriptors. Reviewed-by: Laurent Pinchart <[email protected]> Signed-off-by: Shuzhen Wang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 0e3139e commit c70793f

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

drivers/usb/gadget/function/f_uvc.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,7 @@ uvc_copy_descriptors(struct uvc_device *uvc, enum usb_device_speed speed)
516516
void *mem;
517517

518518
switch (speed) {
519+
case USB_SPEED_SUPER_PLUS:
519520
case USB_SPEED_SUPER:
520521
uvc_control_desc = uvc->desc.ss_control;
521522
uvc_streaming_cls = uvc->desc.ss_streaming;
@@ -564,7 +565,8 @@ uvc_copy_descriptors(struct uvc_device *uvc, enum usb_device_speed speed)
564565
bytes += uvc_interrupt_ep.bLength + uvc_interrupt_cs_ep.bLength;
565566
n_desc += 2;
566567

567-
if (speed == USB_SPEED_SUPER) {
568+
if (speed == USB_SPEED_SUPER ||
569+
speed == USB_SPEED_SUPER_PLUS) {
568570
bytes += uvc_ss_interrupt_comp.bLength;
569571
n_desc += 1;
570572
}
@@ -619,7 +621,8 @@ uvc_copy_descriptors(struct uvc_device *uvc, enum usb_device_speed speed)
619621

620622
if (uvc->enable_interrupt_ep) {
621623
UVC_COPY_DESCRIPTOR(mem, dst, &uvc_interrupt_ep);
622-
if (speed == USB_SPEED_SUPER)
624+
if (speed == USB_SPEED_SUPER ||
625+
speed == USB_SPEED_SUPER_PLUS)
623626
UVC_COPY_DESCRIPTOR(mem, dst, &uvc_ss_interrupt_comp);
624627

625628
UVC_COPY_DESCRIPTOR(mem, dst, &uvc_interrupt_cs_ep);
@@ -795,6 +798,13 @@ uvc_function_bind(struct usb_configuration *c, struct usb_function *f)
795798
goto error;
796799
}
797800

801+
f->ssp_descriptors = uvc_copy_descriptors(uvc, USB_SPEED_SUPER_PLUS);
802+
if (IS_ERR(f->ssp_descriptors)) {
803+
ret = PTR_ERR(f->ssp_descriptors);
804+
f->ssp_descriptors = NULL;
805+
goto error;
806+
}
807+
798808
/* Preallocate control endpoint request. */
799809
uvc->control_req = usb_ep_alloc_request(cdev->gadget->ep0, GFP_KERNEL);
800810
uvc->control_buf = kmalloc(UVC_MAX_REQUEST_SIZE, GFP_KERNEL);

0 commit comments

Comments
 (0)