2021-03-08 10:30:16

by Pawel Laszczak

[permalink] [raw]
Subject: [PATCH 2/2] usb: webcam: Invalid size of Processing Unit Descriptor

From: Pawel Laszczak <[email protected]>

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.

Signed-off-by: Pawel Laszczak <[email protected]>
---
include/uapi/linux/usb/video.h | 1 +
1 file changed, 1 insertion(+)

diff --git a/include/uapi/linux/usb/video.h b/include/uapi/linux/usb/video.h
index d854cb19c42c..2a54e8fdd341 100644
--- a/include/uapi/linux/usb/video.h
+++ b/include/uapi/linux/usb/video.h
@@ -302,6 +302,7 @@ 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))
--
2.25.1


2021-03-14 01:59:59

by Peter Chen

[permalink] [raw]
Subject: Re: [PATCH 2/2] usb: webcam: Invalid size of Processing Unit Descriptor

On 21-03-08 11:27:35, Pawel Laszczak wrote:
> From: Pawel Laszczak <[email protected]>
>
> According with USB Device Class Definition for Video Device the
> Processing Unit Descriptor bLength should be 12 (10 + bmControlSize),
> but it has 11.

Does the reason forget filling bmVideoStandards entry?

Peter
>
> 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.
>
> Signed-off-by: Pawel Laszczak <[email protected]>
> ---
> include/uapi/linux/usb/video.h | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/include/uapi/linux/usb/video.h b/include/uapi/linux/usb/video.h
> index d854cb19c42c..2a54e8fdd341 100644
> --- a/include/uapi/linux/usb/video.h
> +++ b/include/uapi/linux/usb/video.h
> @@ -302,6 +302,7 @@ 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))
> --
> 2.25.1
>

--

Thanks,
Peter Chen

2021-03-14 02:42:10

by Laurent Pinchart

[permalink] [raw]
Subject: Re: [PATCH 2/2] usb: webcam: Invalid size of Processing Unit Descriptor

Hi Pawel,

Thank you for the patch.

On Mon, Mar 08, 2021 at 11:27:35AM +0100, Pawel Laszczak wrote:
> From: Pawel Laszczak <[email protected]>
>
> 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, it wasn't part of UVC
1.0a. The commit message should explain this.

This change looks good to me, but could you also update
drivers/usb/gadget/legacy/webcam.c and
drivers/usb/gadget/function/f_uvc.c to explicitly set this field to 0 ?

With that,

Reviewed-by: Laurent Pinchart <[email protected]>

> Signed-off-by: Pawel Laszczak <[email protected]>
> ---
> include/uapi/linux/usb/video.h | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/include/uapi/linux/usb/video.h b/include/uapi/linux/usb/video.h
> index d854cb19c42c..2a54e8fdd341 100644
> --- a/include/uapi/linux/usb/video.h
> +++ b/include/uapi/linux/usb/video.h
> @@ -302,6 +302,7 @@ 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))

--
Regards,

Laurent Pinchart