mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: chenchangcheng <ccc194101@163.com>
Cc: wangyongjun@kylinos.cn, zhoulei@kylinos.cn, liuyihu@kylinos.cn,
	lizhenneng@kylinos.cn, lihongtao@kylinos.cn, mchehab@kernel.org,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	chenchangcheng <chenchangcheng@kylinos.cn>
Subject: Re: [PATCH] media: uvcvideo: Block AlcorMicroCorp camera from reporting key events.
Date: Fri, 26 Jul 2024 13:20:57 +0300	[thread overview]
Message-ID: <20240726102057.GA28621@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20240723082955.2911825-1-ccc194101@163.com>

Hi Chen Changcheng,

Thank you for the patch.

On Tue, Jul 23, 2024 at 04:29:55PM +0800, chenchangcheng wrote:
> From: chenchangcheng <chenchangcheng@kylinos.cn>
> 
> 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@kylinos.cn>
> 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

  reply	other threads:[~2024-07-26 10:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-23  8:29 chenchangcheng
2024-07-26 10:20 ` Laurent Pinchart [this message]
     [not found]   ` <422515098.1778903.1722214797868.JavaMail.root@mail-tracker-183-3ep34-kunp1-54f898d94d-qbtjz>
2024-07-29  8:35     ` Laurent Pinchart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240726102057.GA28621@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=ccc194101@163.com \
    --cc=chenchangcheng@kylinos.cn \
    --cc=lihongtao@kylinos.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=liuyihu@kylinos.cn \
    --cc=lizhenneng@kylinos.cn \
    --cc=mchehab@kernel.org \
    --cc=wangyongjun@kylinos.cn \
    --cc=zhoulei@kylinos.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®