Re: [PATCH] media: uvcvideo: Block AlcorMicroCorp camera from reporting key events.

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

 



Hi Chen Changcheng,

Thank you for the patch.

On Tue, Jul 23, 2024 at 04:29:55PM +0800, chenchangcheng wrote:
> From: chenchangcheng <chenchangcheng@xxxxxxxxxx>
> 
> When opening the camera, it will send an interrupt transmission
> to the host, which is a request initiated by VS to press a button.
> But the camera does't have a physical button to send interrupt
> transmission.

Could you please send the output of `lsusb -v -d 1dfc:8513` (running as
root if possible) ?

> This button will cause the upper layer to actively turn off the camera.
> Ultimately, it resulted in the failure to open the camera.

That sounds like a weird behaviour. What upper layers are doing this ?

> Signed-off-by: chenchangcheng <chenchangcheng@xxxxxxxxxx>
> Change-Id: Ie86c311569e8bdc891dc8af12febf6e8643e082f
> ---
>  drivers/media/usb/uvc/uvc_driver.c | 9 +++++++++
>  drivers/media/usb/uvc/uvc_status.c | 6 +++++-
>  drivers/media/usb/uvc/uvcvideo.h   | 1 +
>  3 files changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
> index 07128e0..0bdd23b 100644
> --- a/drivers/media/usb/uvc/uvc_driver.c
> +++ b/drivers/media/usb/uvc/uvc_driver.c
> @@ -2891,6 +2891,15 @@ static const struct usb_device_id uvc_ids[] = {
>            .bInterfaceClass      = USB_CLASS_VENDOR_SPEC,
>            .bInterfaceSubClass   = 1,
>            .bInterfaceProtocol   = 0 },
> +	/*  AlcorMicroCorp Nantian Camera 8513 */
> +	{ .match_flags		= USB_DEVICE_ID_MATCH_DEVICE
> +				| USB_DEVICE_ID_MATCH_INT_INFO,
> +	  .idVendor		= 0x1dfc,
> +	  .idProduct		= 0x8513,
> +	  .bInterfaceClass	= USB_CLASS_VIDEO,
> +	  .bInterfaceSubClass	= 1,
> +	  .bInterfaceProtocol	= 0,
> +	  .driver_info		= UVC_INFO_QUIRK(UVC_QUIRK_IGNORE_STATUS_EVENT) },
>  	/* Generic USB Video Class */
>  	{ USB_INTERFACE_INFO(USB_CLASS_VIDEO, 1, UVC_PC_PROTOCOL_UNDEFINED) },
>  	{ USB_INTERFACE_INFO(USB_CLASS_VIDEO, 1, UVC_PC_PROTOCOL_15) },
> diff --git a/drivers/media/usb/uvc/uvc_status.c b/drivers/media/usb/uvc/uvc_status.c
> index 2bdb0ff..17d68e8 100644
> --- a/drivers/media/usb/uvc/uvc_status.c
> +++ b/drivers/media/usb/uvc/uvc_status.c
> @@ -99,8 +99,12 @@ static void uvc_event_streaming(struct uvc_device *dev,
>  	}
>  
>  	if (status->bEvent == 0) {
> -		if (len < 4)
> +		if (len < 4 || (dev->quirks & UVC_QUIRK_IGNORE_STATUS_EVENT)) {
> +			uvc_trace(UVC_TRACE_STATUS, "Ignore button (intf %u) %s\n",
> +			  status->bOriginator,
> +			  status->bValue[0] ? "pressed" : "released");
>  			return;
> +		}
>  		uvc_trace(UVC_TRACE_STATUS, "Button (intf %u) %s len %d\n",
>  			  status->bOriginator,
>  			  status->bValue[0] ? "pressed" : "released", len);
> diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h
> index c7c1baa..8ac3c28 100644
> --- a/drivers/media/usb/uvc/uvcvideo.h
> +++ b/drivers/media/usb/uvc/uvcvideo.h
> @@ -198,6 +198,7 @@
>  #define UVC_QUIRK_RESTRICT_FRAME_RATE	0x00000200
>  #define UVC_QUIRK_RESTORE_CTRLS_ON_INIT	0x00000400
>  #define UVC_QUIRK_FORCE_Y8		0x00000800
> +#define UVC_QUIRK_IGNORE_STATUS_EVENT	0x00001000
>  
>  /* Format flags */
>  #define UVC_FMT_FLAG_COMPRESSED		0x00000001

-- 
Regards,

Laurent Pinchart




[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