2021-03-15 07:02:05

by Pawel Laszczak

[permalink] [raw]
Subject: [PATCH v2 1/2] usb: gadget: uvc: Updating bcdUVC field to 0x0110

From: Pawel Laszczak <[email protected]>

Command Verifier during UVC Descriptor Tests (Class Video Control
Interface Descriptor Test Video) complains about:

Video Control Interface Header bcdUVC is 0x0100. USB Video Class
specification 1.0 has been replaced by 1.1 specification
(UVC: 6.2.26) Class Video Control Interface Descriptor bcdUVC is not 1.1

Reviewed-by: Laurent Pinchart <[email protected]>
Signed-off-by: Pawel Laszczak <[email protected]>

---
Changlog:
v2:
- fixed typo in commit message

drivers/usb/gadget/function/uvc_configfs.c | 2 +-
drivers/usb/gadget/legacy/webcam.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/function/uvc_configfs.c b/drivers/usb/gadget/function/uvc_configfs.c
index 00fb58e50a15..cd28dec837dd 100644
--- a/drivers/usb/gadget/function/uvc_configfs.c
+++ b/drivers/usb/gadget/function/uvc_configfs.c
@@ -231,7 +231,7 @@ static struct config_item *uvcg_control_header_make(struct config_group *group,
h->desc.bLength = UVC_DT_HEADER_SIZE(1);
h->desc.bDescriptorType = USB_DT_CS_INTERFACE;
h->desc.bDescriptorSubType = UVC_VC_HEADER;
- h->desc.bcdUVC = cpu_to_le16(0x0100);
+ h->desc.bcdUVC = cpu_to_le16(0x0110);
h->desc.dwClockFrequency = cpu_to_le32(48000000);

config_item_init_type_name(&h->item, name, &uvcg_control_header_type);
diff --git a/drivers/usb/gadget/legacy/webcam.c b/drivers/usb/gadget/legacy/webcam.c
index a9f8eb8e1c76..3a61de4bb2b1 100644
--- a/drivers/usb/gadget/legacy/webcam.c
+++ b/drivers/usb/gadget/legacy/webcam.c
@@ -90,7 +90,7 @@ static const struct UVC_HEADER_DESCRIPTOR(1) uvc_control_header = {
.bLength = UVC_DT_HEADER_SIZE(1),
.bDescriptorType = USB_DT_CS_INTERFACE,
.bDescriptorSubType = UVC_VC_HEADER,
- .bcdUVC = cpu_to_le16(0x0100),
+ .bcdUVC = cpu_to_le16(0x0110),
.wTotalLength = 0, /* dynamic */
.dwClockFrequency = cpu_to_le32(48000000),
.bInCollection = 0, /* dynamic */
--
2.25.1


2021-03-15 07:04:17

by Pawel Laszczak

[permalink] [raw]
Subject: [PATCH v3 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.

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

Reviewed-by: Laurent Pinchart <[email protected]>
Signed-off-by: Pawel Laszczak <[email protected]>

---
Changelog:
v3:
- updated the commit message
- added bmVideoStandard field to UVC gadget driver
v2:
- updated UVC_DT_PROCESSING_UNIT_SIZE macro

drivers/usb/gadget/function/f_uvc.c | 1 +
drivers/usb/gadget/legacy/webcam.c | 1 +
include/uapi/linux/usb/video.h | 3 ++-
3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/function/f_uvc.c b/drivers/usb/gadget/function/f_uvc.c
index 5d62720bb9e1..e3b0a79c8f01 100644
--- a/drivers/usb/gadget/function/f_uvc.c
+++ b/drivers/usb/gadget/function/f_uvc.c
@@ -823,6 +823,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;
diff --git a/drivers/usb/gadget/legacy/webcam.c b/drivers/usb/gadget/legacy/webcam.c
index 3a61de4bb2b1..accb4dacf715 100644
--- a/drivers/usb/gadget/legacy/webcam.c
+++ b/drivers/usb/gadget/legacy/webcam.c
@@ -125,6 +125,7 @@ static const struct uvc_processing_unit_descriptor uvc_processing = {
.bmControls[0] = 1,
.bmControls[1] = 0,
.iProcessing = 0,
+ .bmVideoStandrads = 0,
};

static const struct uvc_output_terminal_descriptor uvc_output_terminal = {
diff --git a/include/uapi/linux/usb/video.h b/include/uapi/linux/usb/video.h
index d854cb19c42c..bfdae12cdacf 100644
--- a/include/uapi/linux/usb/video.h
+++ b/include/uapi/linux/usb/video.h
@@ -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 {
--
2.25.1

2021-03-15 07:12:09

by Pawel Laszczak

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


Please ignore this one patch. I need to resend it. It causes compilation error.
Sorry for that.

>
>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 and it wasn't part of
>UVC 1.0a.
>
>Reviewed-by: Laurent Pinchart <[email protected]>
>Signed-off-by: Pawel Laszczak <[email protected]>
>
>---
>Changelog:
>v3:
>- updated the commit message
>- added bmVideoStandard field to UVC gadget driver
>v2:
>- updated UVC_DT_PROCESSING_UNIT_SIZE macro
>
> drivers/usb/gadget/function/f_uvc.c | 1 +
> drivers/usb/gadget/legacy/webcam.c | 1 +
> include/uapi/linux/usb/video.h | 3 ++-
> 3 files changed, 4 insertions(+), 1 deletion(-)
>
>diff --git a/drivers/usb/gadget/function/f_uvc.c b/drivers/usb/gadget/function/f_uvc.c
>index 5d62720bb9e1..e3b0a79c8f01 100644
>--- a/drivers/usb/gadget/function/f_uvc.c
>+++ b/drivers/usb/gadget/function/f_uvc.c
>@@ -823,6 +823,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;
>diff --git a/drivers/usb/gadget/legacy/webcam.c b/drivers/usb/gadget/legacy/webcam.c
>index 3a61de4bb2b1..accb4dacf715 100644
>--- a/drivers/usb/gadget/legacy/webcam.c
>+++ b/drivers/usb/gadget/legacy/webcam.c
>@@ -125,6 +125,7 @@ static const struct uvc_processing_unit_descriptor uvc_processing = {
> .bmControls[0] = 1,
> .bmControls[1] = 0,
> .iProcessing = 0,
>+ .bmVideoStandrads = 0,
> };
>
> static const struct uvc_output_terminal_descriptor uvc_output_terminal = {
>diff --git a/include/uapi/linux/usb/video.h b/include/uapi/linux/usb/video.h
>index d854cb19c42c..bfdae12cdacf 100644
>--- a/include/uapi/linux/usb/video.h
>+++ b/include/uapi/linux/usb/video.h
>@@ -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 {
>--
>2.25.1

Regards,
Pawel Laszczak

2021-03-15 08:09:43

by kernel test robot

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

Hi Pawel,

I love your patch! Yet something to improve:

[auto build test ERROR on usb/usb-testing]
[also build test ERROR on peter.chen-usb/for-usb-next linus/master balbi-usb/testing/next v5.12-rc3 next-20210315]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Pawel-Laszczak/usb-gadget-uvc-Updating-bcdUVC-field-to-0x0110/20210315-150207
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
config: xtensa-randconfig-r004-20210315 (attached as .config)
compiler: xtensa-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/02bcbb1b029ca0cc6dd33c70363125bc2f3ce0d2
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Pawel-Laszczak/usb-gadget-uvc-Updating-bcdUVC-field-to-0x0110/20210315-150207
git checkout 02bcbb1b029ca0cc6dd33c70363125bc2f3ce0d2
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=xtensa

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

All errors (new ones prefixed by >>):

>> drivers/usb/gadget/legacy/webcam.c:128:3: error: 'const struct uvc_processing_unit_descriptor' has no member named 'bmVideoStandrads'; did you mean 'bmVideoStandards'?
128 | .bmVideoStandrads = 0,
| ^~~~~~~~~~~~~~~~
| bmVideoStandards


vim +128 drivers/usb/gadget/legacy/webcam.c

116
117 static const struct uvc_processing_unit_descriptor uvc_processing = {
118 .bLength = UVC_DT_PROCESSING_UNIT_SIZE(2),
119 .bDescriptorType = USB_DT_CS_INTERFACE,
120 .bDescriptorSubType = UVC_VC_PROCESSING_UNIT,
121 .bUnitID = 2,
122 .bSourceID = 1,
123 .wMaxMultiplier = cpu_to_le16(16*1024),
124 .bControlSize = 2,
125 .bmControls[0] = 1,
126 .bmControls[1] = 0,
127 .iProcessing = 0,
> 128 .bmVideoStandrads = 0,
129 };
130

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]


Attachments:
(No filename) (2.44 kB)
.config.gz (40.75 kB)
Download all attachments

2021-03-16 06:58:33

by Peter Chen

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] usb: gadget: uvc: Updating bcdUVC field to 0x0110

On 21-03-15 07:59:25, Pawel Laszczak wrote:
> From: Pawel Laszczak <[email protected]>
>
> Command Verifier during UVC Descriptor Tests (Class Video Control
> Interface Descriptor Test Video) complains about:
>
> Video Control Interface Header bcdUVC is 0x0100. USB Video Class
> specification 1.0 has been replaced by 1.1 specification
> (UVC: 6.2.26) Class Video Control Interface Descriptor bcdUVC is not 1.1
>
> Reviewed-by: Laurent Pinchart <[email protected]>
> Signed-off-by: Pawel Laszczak <[email protected]>

Reviewed-by: Peter Chen <[email protected]>

>
> ---
> Changlog:
> v2:
> - fixed typo in commit message
>
> drivers/usb/gadget/function/uvc_configfs.c | 2 +-
> drivers/usb/gadget/legacy/webcam.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/gadget/function/uvc_configfs.c b/drivers/usb/gadget/function/uvc_configfs.c
> index 00fb58e50a15..cd28dec837dd 100644
> --- a/drivers/usb/gadget/function/uvc_configfs.c
> +++ b/drivers/usb/gadget/function/uvc_configfs.c
> @@ -231,7 +231,7 @@ static struct config_item *uvcg_control_header_make(struct config_group *group,
> h->desc.bLength = UVC_DT_HEADER_SIZE(1);
> h->desc.bDescriptorType = USB_DT_CS_INTERFACE;
> h->desc.bDescriptorSubType = UVC_VC_HEADER;
> - h->desc.bcdUVC = cpu_to_le16(0x0100);
> + h->desc.bcdUVC = cpu_to_le16(0x0110);
> h->desc.dwClockFrequency = cpu_to_le32(48000000);
>
> config_item_init_type_name(&h->item, name, &uvcg_control_header_type);
> diff --git a/drivers/usb/gadget/legacy/webcam.c b/drivers/usb/gadget/legacy/webcam.c
> index a9f8eb8e1c76..3a61de4bb2b1 100644
> --- a/drivers/usb/gadget/legacy/webcam.c
> +++ b/drivers/usb/gadget/legacy/webcam.c
> @@ -90,7 +90,7 @@ static const struct UVC_HEADER_DESCRIPTOR(1) uvc_control_header = {
> .bLength = UVC_DT_HEADER_SIZE(1),
> .bDescriptorType = USB_DT_CS_INTERFACE,
> .bDescriptorSubType = UVC_VC_HEADER,
> - .bcdUVC = cpu_to_le16(0x0100),
> + .bcdUVC = cpu_to_le16(0x0110),
> .wTotalLength = 0, /* dynamic */
> .dwClockFrequency = cpu_to_le32(48000000),
> .bInCollection = 0, /* dynamic */
> --
> 2.25.1
>

--

Thanks,
Peter Chen