Skip to content

Commit 3de6e63

Browse files
bhupesh-sharmaFelipe Balbi
authored andcommitted
usb: gadget: uvc: Fix string descriptor STALL issue when multiple uvc functions are added to a configuration
This patch solved the string descriptor STALL issue when we add multiple UVC functions in a single configuration using a 'webcam.c' like composite driver. Signed-off-by: Bhupesh Sharma <bhupesh.sharma@st.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
1 parent 0a00790 commit 3de6e63

File tree

1 file changed

+22
-16
lines changed

1 file changed

+22
-16
lines changed

drivers/usb/gadget/f_uvc.c

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -619,22 +619,28 @@ uvc_bind_config(struct usb_configuration *c,
619619
uvc->desc.fs_streaming = fs_streaming;
620620
uvc->desc.hs_streaming = hs_streaming;
621621

622-
/* Allocate string descriptor numbers. */
623-
if ((ret = usb_string_id(c->cdev)) < 0)
624-
goto error;
625-
uvc_en_us_strings[UVC_STRING_ASSOCIATION_IDX].id = ret;
626-
uvc_iad.iFunction = ret;
627-
628-
if ((ret = usb_string_id(c->cdev)) < 0)
629-
goto error;
630-
uvc_en_us_strings[UVC_STRING_CONTROL_IDX].id = ret;
631-
uvc_control_intf.iInterface = ret;
632-
633-
if ((ret = usb_string_id(c->cdev)) < 0)
634-
goto error;
635-
uvc_en_us_strings[UVC_STRING_STREAMING_IDX].id = ret;
636-
uvc_streaming_intf_alt0.iInterface = ret;
637-
uvc_streaming_intf_alt1.iInterface = ret;
622+
/* maybe allocate device-global string IDs, and patch descriptors */
623+
if (uvc_en_us_strings[UVC_STRING_ASSOCIATION_IDX].id == 0) {
624+
/* Allocate string descriptor numbers. */
625+
ret = usb_string_id(c->cdev);
626+
if (ret < 0)
627+
goto error;
628+
uvc_en_us_strings[UVC_STRING_ASSOCIATION_IDX].id = ret;
629+
uvc_iad.iFunction = ret;
630+
631+
ret = usb_string_id(c->cdev);
632+
if (ret < 0)
633+
goto error;
634+
uvc_en_us_strings[UVC_STRING_CONTROL_IDX].id = ret;
635+
uvc_control_intf.iInterface = ret;
636+
637+
ret = usb_string_id(c->cdev);
638+
if (ret < 0)
639+
goto error;
640+
uvc_en_us_strings[UVC_STRING_STREAMING_IDX].id = ret;
641+
uvc_streaming_intf_alt0.iInterface = ret;
642+
uvc_streaming_intf_alt1.iInterface = ret;
643+
}
638644

639645
/* Register the function. */
640646
uvc->func.name = "uvc";

0 commit comments

Comments
 (0)