[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240723082955.2911825-1-ccc194101@163.com>
Date: Tue, 23 Jul 2024 16:29:55 +0800
From: chenchangcheng <ccc194101@....com>
To: laurent.pinchart@...asonboard.com
Cc: wangyongjun@...inos.cn,
zhoulei@...inos.cn,
liuyihu@...inos.cn,
lizhenneng@...inos.cn,
lihongtao@...inos.cn,
mchehab@...nel.org,
linux-media@...r.kernel.org,
linux-kernel@...r.kernel.org,
chenchangcheng <chenchangcheng@...inos.cn>
Subject: [PATCH] media: uvcvideo: Block AlcorMicroCorp camera from reporting key events.
From: chenchangcheng <chenchangcheng@...inos.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@...inos.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
Powered by blists - more mailing lists