Skip to content

Commit 6a154ec

Browse files
pawellcdnsgregkh
authored andcommitted
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>
1 parent 98f1197 commit 6a154ec

3 files changed

Lines changed: 4 additions & 1 deletion

File tree

drivers/usb/gadget/function/f_uvc.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -822,6 +822,7 @@ static struct usb_function_instance *uvc_alloc_inst(void)
822822
pd->bmControls[0] = 1;
823823
pd->bmControls[1] = 0;
824824
pd->iProcessing = 0;
825+
pd->bmVideoStandards = 0;
825826

826827
od = &opts->uvc_output_terminal;
827828
od->bLength = UVC_DT_OUTPUT_TERMINAL_SIZE;

drivers/usb/gadget/legacy/webcam.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ static const struct uvc_processing_unit_descriptor uvc_processing = {
125125
.bmControls[0] = 1,
126126
.bmControls[1] = 0,
127127
.iProcessing = 0,
128+
.bmVideoStandards = 0,
128129
};
129130

130131
static const struct uvc_output_terminal_descriptor uvc_output_terminal = {

include/uapi/linux/usb/video.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,9 +302,10 @@ struct uvc_processing_unit_descriptor {
302302
__u8 bControlSize;
303303
__u8 bmControls[2];
304304
__u8 iProcessing;
305+
__u8 bmVideoStandards;
305306
} __attribute__((__packed__));
306307

307-
#define UVC_DT_PROCESSING_UNIT_SIZE(n) (9+(n))
308+
#define UVC_DT_PROCESSING_UNIT_SIZE(n) (10+(n))
308309

309310
/* 3.7.2.6. Extension Unit Descriptor */
310311
struct uvc_extension_unit_descriptor {

0 commit comments

Comments
 (0)