]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
usb: webcam: Invalid size of Processing Unit Descriptor
authorPawel Laszczak <pawell@cadence.com>
Mon, 15 Mar 2021 07:17:48 +0000 (08:17 +0100)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 19 May 2021 08:31:58 +0000 (10:31 +0200)
BugLink: https://bugs.launchpad.net/bugs/1928857
[ Upstream commit 6a154ec9ef6762c774cd2b50215c7a8f0f08a862 ]

According with USB Device Class Definition for Video Device the
Processing Unit Descriptor bLength should be 12 (10 + bmControlSize),
but it has 11.

Invalid length caused that Processing Unit Descriptor Test Video form
CV tool failed. To fix this issue patch adds bmVideoStandards into
uvc_processing_unit_descriptor structure.

The bmVideoStandards field was added in UVC 1.1 and it wasn't part of
UVC 1.0a.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Pawel Laszczak <pawell@cadence.com>
Reviewed-by: Peter Chen <peter.chen@kernel.org>
Link: https://lore.kernel.org/r/20210315071748.29706-1-pawell@gli-login.cadence.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/usb/gadget/function/f_uvc.c
drivers/usb/gadget/legacy/webcam.c
include/uapi/linux/usb/video.h

index ed77a126a74f4992a463e5ae8b34c58647285608..f48a00e4979455a7fc1bba0f1e8a091deeaf56c4 100644 (file)
@@ -822,6 +822,7 @@ static struct usb_function_instance *uvc_alloc_inst(void)
        pd->bmControls[0]               = 1;
        pd->bmControls[1]               = 0;
        pd->iProcessing                 = 0;
+       pd->bmVideoStandards            = 0;
 
        od = &opts->uvc_output_terminal;
        od->bLength                     = UVC_DT_OUTPUT_TERMINAL_SIZE;
index a9f8eb8e1c767ce961762e8fcf22112bcf41d221..2c9eab2b863d2ed0dac7f577b05e4065bf13621b 100644 (file)
@@ -125,6 +125,7 @@ static const struct uvc_processing_unit_descriptor uvc_processing = {
        .bmControls[0]          = 1,
        .bmControls[1]          = 0,
        .iProcessing            = 0,
+       .bmVideoStandards       = 0,
 };
 
 static const struct uvc_output_terminal_descriptor uvc_output_terminal = {
index d854cb19c42c38f536627aaefa08ddb0b61d5ada..bfdae12cdacf89d3bccb0f7381630b8fe516104d 100644 (file)
@@ -302,9 +302,10 @@ struct uvc_processing_unit_descriptor {
        __u8   bControlSize;
        __u8   bmControls[2];
        __u8   iProcessing;
+       __u8   bmVideoStandards;
 } __attribute__((__packed__));
 
-#define UVC_DT_PROCESSING_UNIT_SIZE(n)                 (9+(n))
+#define UVC_DT_PROCESSING_UNIT_SIZE(n)                 (10+(n))
 
 /* 3.7.2.6. Extension Unit Descriptor */
 struct uvc_extension_unit_descriptor {