mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] media: uvcvideo: Block AlcorMicroCorp camera from reporting key events.
@ 2024-07-23  8:29 chenchangcheng
  2024-07-26 10:20 ` Laurent Pinchart
  0 siblings, 1 reply; 3+ messages in thread
From: chenchangcheng @ 2024-07-23  8:29 UTC (permalink / raw)
  To: laurent.pinchart
  Cc: wangyongjun, zhoulei, liuyihu, lizhenneng, lihongtao, mchehab,
	linux-media, linux-kernel, chenchangcheng

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.

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

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
-- 
2.7.4


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-07-29  8:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-23  8:29 [PATCH] media: uvcvideo: Block AlcorMicroCorp camera from reporting key events chenchangcheng
2024-07-26 10:20 ` Laurent Pinchart
     [not found]   ` <422515098.1778903.1722214797868.JavaMail.root@mail-tracker-183-3ep34-kunp1-54f898d94d-qbtjz>
2024-07-29  8:35     ` Laurent Pinchart

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®