diff mbox series

[v3,2/2] usb: webcam: Invalid size of Processing Unit Descriptor

Message ID 20210315065926.30152-2-pawell@gli-login.cadence.com (mailing list archive)
State New, archived
Headers show
Series [v2,1/2] usb: gadget: uvc: Updating bcdUVC field to 0x0110 | expand

Commit Message

Pawel Laszczak March 15, 2021, 6:59 a.m. UTC
From: Pawel Laszczak <pawell@cadence.com>

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>

---
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(-)

Comments

Pawel Laszczak March 15, 2021, 7:10 a.m. UTC | #1
Please ignore this one patch. I need to resend it. It causes compilation error.
Sorry for that.  

>
>From: Pawel Laszczak <pawell@cadence.com>
>
>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>
>
>---
>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
kernel test robot March 15, 2021, 8:07 a.m. UTC | #2
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 <lkp@intel.com>

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/kbuild-all@lists.01.org
diff mbox series

Patch

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 {