Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: webcam: Invalid size of Processing Unit Descriptor

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>

authored by

Pawel Laszczak and committed by
Greg Kroah-Hartman
6a154ec9 98f11978

+4 -1
+1
drivers/usb/gadget/function/f_uvc.c
··· 822 822 pd->bmControls[0] = 1; 823 823 pd->bmControls[1] = 0; 824 824 pd->iProcessing = 0; 825 + pd->bmVideoStandards = 0; 825 826 826 827 od = &opts->uvc_output_terminal; 827 828 od->bLength = UVC_DT_OUTPUT_TERMINAL_SIZE;
+1
drivers/usb/gadget/legacy/webcam.c
··· 125 125 .bmControls[0] = 1, 126 126 .bmControls[1] = 0, 127 127 .iProcessing = 0, 128 + .bmVideoStandards = 0, 128 129 }; 129 130 130 131 static const struct uvc_output_terminal_descriptor uvc_output_terminal = {
+2 -1
include/uapi/linux/usb/video.h
··· 302 302 __u8 bControlSize; 303 303 __u8 bmControls[2]; 304 304 __u8 iProcessing; 305 + __u8 bmVideoStandards; 305 306 } __attribute__((__packed__)); 306 307 307 - #define UVC_DT_PROCESSING_UNIT_SIZE(n) (9+(n)) 308 + #define UVC_DT_PROCESSING_UNIT_SIZE(n) (10+(n)) 308 309 309 310 /* 3.7.2.6. Extension Unit Descriptor */ 310 311 struct uvc_extension_unit_descriptor {