Re: [PATCH 10/10] media: uvcvideo: Populate only active control classes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/03/2021 13:20, Ricardo Ribalda wrote:
> Do not create Control Classes for empty classes.

Shouldn't this be squashed with patch 06/10?

Regards,

	Hans

> 
> Fixes v4l2-compliance:
> 
> Control ioctls (Input 0):
> 	                fail: v4l2-test-controls.cpp(255): no controls in class 009d0000
> 	test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: FAIL
> 
> Signed-off-by: Ricardo Ribalda <ribalda@xxxxxxxxxxxx>
> ---
>  drivers/media/usb/uvc/uvc_ctrl.c   | 11 +++++++++++
>  drivers/media/usb/uvc/uvc_driver.c |  1 -
>  drivers/media/usb/uvc/uvcvideo.h   |  1 -
>  3 files changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c
> index 433342efc63f..5efbb3b5aa5b 100644
> --- a/drivers/media/usb/uvc/uvc_ctrl.c
> +++ b/drivers/media/usb/uvc/uvc_ctrl.c
> @@ -2128,6 +2128,17 @@ static int __uvc_ctrl_add_mapping(struct uvc_device *dev,
>  	if (map->set == NULL)
>  		map->set = uvc_set_le_value;
>  
> +	switch (V4L2_CTRL_ID2WHICH(map->id)) {
> +	case V4L2_CTRL_ID2WHICH(V4L2_CID_CAMERA_CLASS):
> +		dev->ctrl_class_unit->ctrl_class.bmControls[0] |=
> +						BIT(UVC_CC_CAMERA_CLASS);
> +		break;
> +	case V4L2_CTRL_ID2WHICH(V4L2_CID_USER_CLASS):
> +		dev->ctrl_class_unit->ctrl_class.bmControls[0] |=
> +						BIT(UVC_CC_USER_CLASS);
> +		break;
> +	}
> +
>  	list_add_tail(&map->list, &ctrl->info.mappings);
>  	uvc_dbg(dev, CONTROL, "Adding mapping '%s' to control %pUl/%u\n",
>  		map->name, ctrl->info.entity, ctrl->info.selector);
> diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
> index 996e8bd06ac5..4f368ab3a1f1 100644
> --- a/drivers/media/usb/uvc/uvc_driver.c
> +++ b/drivers/media/usb/uvc/uvc_driver.c
> @@ -1501,7 +1501,6 @@ static int uvc_ctrl_class_parse(struct uvc_device *dev)
>  
>  	unit->ctrl_class.bControlSize = 1;
>  	unit->ctrl_class.bmControls = (u8 *)unit + sizeof(*unit);
> -	unit->ctrl_class.bmControls[0] = (1 << (UVC_CC_LAST_CLASS + 1)) - 1;
>  	unit->get_info = uvc_ctrl_class_get_info;
>  	strncpy(unit->name, "Control Class", sizeof(unit->name) - 1);
>  
> diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h
> index 1d59ac10c2eb..cc573d63e459 100644
> --- a/drivers/media/usb/uvc/uvcvideo.h
> +++ b/drivers/media/usb/uvc/uvcvideo.h
> @@ -186,7 +186,6 @@
>   */
>  #define UVC_CC_CAMERA_CLASS	0
>  #define UVC_CC_USER_CLASS	1
> -#define UVC_CC_LAST_CLASS	UVC_CC_USER_CLASS
>  
>  /* ------------------------------------------------------------------------
>   * Driver specific constants.
> 




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux