media: uvcvideo: Block AlcorMicroCorp camera from reporting key events.
Subsystems (2)
PATCH 1/1 media: uvcvideo: Block AlcorMicroCorp camera from reporting key events.
From: chenchangcheng <[email protected]>
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.
--- 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(-)
drivers/media/usb/uvc/uvc_driver.c +9 -0
@@ -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) },
drivers/media/usb/uvc/uvc_status.c +5 -1
@@ -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);
drivers/media/usb/uvc/uvcvideo.h +1 -0
@@ -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
Signature · 1 line
2.7.4
Laurent Pinchart
maintainerHi Chen Changcheng,
Thank you for the patch.
Quoted 6 lines · chenchangcheng
From: chenchangcheng <[email protected]>
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) ?
Quoted 2 lines
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 ?
Quoted 58 lines
Signed-off-by chenchangcheng <[email protected]>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(-)drivers/media/usb/uvc/uvc_driver.c +9
-0@@ -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) },drivers/media/usb/uvc/uvc_status.c +5
-1@@ -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);drivers/media/usb/uvc/uvcvideo.h +1
-0@@ -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
Signature · 3 lines
Regards, Laurent Pinchart
A message that is not in the archive (sent off-list or not yet received): 422515098.1778903.1722214797868.JavaMail.root@mail-tracker-183-3ep34-kunp1-54f898d94d-qbtjz
Laurent Pinchart
maintainerHello,
HTML e-mails are rejected by mailing lists. Please resend in plain text.
Quoted 999 lines · 自己
Hi Laurent Pinchart,
Quoted 1 line
That sounds like a weird behaviour. What upper layers are doing this ?
When the upper layer receives the
KEY_CMERAkey, it will turn off the camera through the videoX nodeQuoted 2 lines
Could you please send the output of
lsusb -v -d 1dfc:8513(running as root if possible) ?Bus 001 Device 016: ID 1dfc:8513 AlcorMicroCorp USB HD Camera audio
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 239 Miscellaneous Device
bDeviceSubClass 2
bDeviceProtocol 1 Interface Association
bMaxPacketSize0 64
idVendor
0x1dfcidProduct
0x8513bcdDevice 0.24
iManufacturer 1 AlcorMicroCorp
iProduct 2 USB HD Camera audio
iSerial 0
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength
0x0255bNumInterfaces 2
bConfigurationValue 1
iConfiguration 0
bmAttributes
0x80(Bus Powered)
MaxPower 500mA
Interface Association:
bLength 8
bDescriptorType 11
bFirstInterface 0
bInterfaceCount 2
bFunctionClass 14 Video
bFunctionSubClass 3 Video Interface Collection
bFunctionProtocol 0
iFunction 4 Nantian Camera 8513
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 14 Video
bInterfaceSubClass 1 Video Control
bInterfaceProtocol 0
iInterface 4 Nantian Camera 8513
VideoControl Interface Descriptor:
bLength 13
bDescriptorType 36
bDescriptorSubtype 1 (HEADER)
bcdUVC 1.00
wTotalLength
0x004fdwClockFrequency 30.000000MHz
bInCollection 1
baInterfaceNr( 0) 1
VideoControl Interface Descriptor:
bLength 28
bDescriptorType 36
bDescriptorSubtype 6 (
EXTENSION_UNIT)bUnitID 6
guidExtensionCode {68bbd0b0-61a4-4b83-90b7-a6215f3c4f70}
bNumControl 24
bNrPins 1
baSourceID( 0) 2
bControlSize 3
bmControls( 0)
0xffbmControls( 1)
0xffbmControls( 2)
0xffiExtension 0
VideoControl Interface Descriptor:
bLength 18
bDescriptorType 36
bDescriptorSubtype 2 (
INPUT_TERMINAL)bTerminalID 1
wTerminalType
0x0201Camera SensorbAssocTerminal 0
iTerminal 0
wObjectiveFocalLengthMin 0
wObjectiveFocalLengthMax 0
wOcularFocalLength 0
bControlSize 3
bmControls
0x000208aaAuto-Exposure Mode
Exposure Time (Absolute)
Focus (Absolute)
Iris (Absolute)
PanTilt (Absolute)
Focus, Auto
VideoControl Interface Descriptor:
bLength 11
bDescriptorType 36
bDescriptorSubtype 5 (
PROCESSING_UNIT)Warning: Descriptor too short
bUnitID 2
bSourceID 1
wMaxMultiplier 0
bControlSize 2
bmControls
0x0000177fBrightness
Contrast
Hue
Saturation
Sharpness
Gamma
White Balance Temperature
Backlight Compensation
Gain
Power Line Frequency
White Balance Temperature, Auto
iProcessing 0
bmVideoStandards
0x09None
SECAM - 625/50
VideoControl Interface Descriptor:
bLength 9
bDescriptorType 36
bDescriptorSubtype 3 (
OUTPUT_TERMINAL)bTerminalID 3
wTerminalType
0x0101USB StreamingbAssocTerminal 0
bSourceID 2
iTerminal 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress
0x81EP 1 INbmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize
0x00101x 16 bytesbInterval 7
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 0
bInterfaceClass 14 Video
bInterfaceSubClass 2 Video Streaming
bInterfaceProtocol 0
iInterface 4 Nantian Camera 8513
VideoStreaming Interface Descriptor:
bLength 14
bDescriptorType 36
bDescriptorSubtype 1 (
INPUT_HEADER)bNumFormats 1
wTotalLength
0x0197bEndPointAddress 130
bmInfo 0
bTerminalLink 3
bStillCaptureMethod 1
bTriggerSupport 1
bTriggerUsage 0
bControlSize 1
bmaControls( 0) 0
VideoStreaming Interface Descriptor:
bLength 27
bDescriptorType 36
bDescriptorSubtype 4 (
FORMAT_UNCOMPRESSED)bFormatIndex 1
bNumFrameDescriptors 12
guidFormat
{32595559-0000-0010-8000-00aa00389b71}bBitsPerPixel 16
bDefaultFrameIndex 1
bAspectRatioX 0
bAspectRatioY 0
bmInterlaceFlags
0x00Interlaced stream or variable: No
Fields per frame: 2 fields
Field 1 first: No
Field pattern: Field 1 only
bCopyProtect 0
VideoStreaming Interface Descriptor:
bLength 30
bDescriptorType 36
bDescriptorSubtype 5 (
FRAME_UNCOMPRESSED)bFrameIndex 1
bmCapabilities
0x01Still image supported
wWidth 2592
wHeight 1944
dwMinBitRate 161243136
dwMaxBitRate 161243136
dwMaxVideoFrameBufferSize 10077696
dwDefaultFrameInterval 5000000
bFrameIntervalType 1
dwFrameInterval( 0) 5000000
VideoStreaming Interface Descriptor:
bLength 30
bDescriptorType 36
bDescriptorSubtype 5 (
FRAME_UNCOMPRESSED)bFrameIndex 2
bmCapabilities
0x01Still image supported
wWidth 2048
wHeight 1536
dwMinBitRate 100663296
dwMaxBitRate 100663296
dwMaxVideoFrameBufferSize 6291456
dwDefaultFrameInterval 5000000
bFrameIntervalType 1
dwFrameInterval( 0) 5000000
VideoStreaming Interface Descriptor:
bLength 30
bDescriptorType 36
bDescriptorSubtype 5 (
FRAME_UNCOMPRESSED)bFrameIndex 3
bmCapabilities
0x01Still image supported
wWidth 1600
wHeight 1200
dwMinBitRate 184320000
dwMaxBitRate 184320000
dwMaxVideoFrameBufferSize 3840000
dwDefaultFrameInterval 1666666
bFrameIntervalType 1
dwFrameInterval( 0) 1666666
VideoStreaming Interface Descriptor:
bLength 30
bDescriptorType 36
bDescriptorSubtype 5 (
FRAME_UNCOMPRESSED)bFrameIndex 4
bmCapabilities
0x01Still image supported
wWidth 1280
wHeight 1024
dwMinBitRate 167772160
dwMaxBitRate 167772160
dwMaxVideoFrameBufferSize 2621440
dwDefaultFrameInterval 1250000
bFrameIntervalType 1
dwFrameInterval( 0) 1250000
VideoStreaming Interface Descriptor:
bLength 30
bDescriptorType 36
bDescriptorSubtype 5 (
FRAME_UNCOMPRESSED)bFrameIndex 5
bmCapabilities
0x01Still image supported
wWidth 1280
wHeight 960
dwMinBitRate 157286400
dwMaxBitRate 157286400
dwMaxVideoFrameBufferSize 2457600
dwDefaultFrameInterval 1250000
bFrameIntervalType 1
dwFrameInterval( 0) 1250000
VideoStreaming Interface Descriptor:
bLength 30
bDescriptorType 36
bDescriptorSubtype 5 (
FRAME_UNCOMPRESSED)bFrameIndex 6
bmCapabilities
0x01Still image supported
wWidth 800
wHeight 600
dwMinBitRate 115200000
dwMaxBitRate 115200000
dwMaxVideoFrameBufferSize 960000
dwDefaultFrameInterval 666666
bFrameIntervalType 1
dwFrameInterval( 0) 666666
VideoStreaming Interface Descriptor:
bLength 30
bDescriptorType 36
bDescriptorSubtype 5 (
FRAME_UNCOMPRESSED)bFrameIndex 7
bmCapabilities
0x01Still image supported
wWidth 640
wHeight 480
dwMinBitRate 147456000
dwMaxBitRate 147456000
dwMaxVideoFrameBufferSize 614400
dwDefaultFrameInterval 333333
bFrameIntervalType 1
dwFrameInterval( 0) 333333
VideoStreaming Interface Descriptor:
bLength 30
bDescriptorType 36
bDescriptorSubtype 5 (
FRAME_UNCOMPRESSED)bFrameIndex 8
bmCapabilities
0x01Still image supported
wWidth 352
wHeight 288
dwMinBitRate 48660480
dwMaxBitRate 48660480
dwMaxVideoFrameBufferSize 202752
dwDefaultFrameInterval 333333
bFrameIntervalType 1
dwFrameInterval( 0) 333333
VideoStreaming Interface Descriptor:
bLength 30
bDescriptorType 36
bDescriptorSubtype 5 (
FRAME_UNCOMPRESSED)bFrameIndex 9
bmCapabilities
0x01Still image supported
wWidth 320
wHeight 240
dwMinBitRate 36864000
dwMaxBitRate 36864000
dwMaxVideoFrameBufferSize 153600
dwDefaultFrameInterval 333333
bFrameIntervalType 1
dwFrameInterval( 0) 333333
VideoStreaming Interface Descriptor:
bLength 30
bDescriptorType 36
bDescriptorSubtype 5 (
FRAME_UNCOMPRESSED)bFrameIndex 10
bmCapabilities
0x01Still image supported
wWidth 176
wHeight 144
dwMinBitRate 12165120
dwMaxBitRate 12165120
dwMaxVideoFrameBufferSize 50688
dwDefaultFrameInterval 333333
bFrameIntervalType 1
dwFrameInterval( 0) 333333
VideoStreaming Interface Descriptor:
bLength 30
bDescriptorType 36
bDescriptorSubtype 5 (
FRAME_UNCOMPRESSED)bFrameIndex 11
bmCapabilities
0x01Still image supported
wWidth 160
wHeight 120
dwMinBitRate 9216000
dwMaxBitRate 9216000
dwMaxVideoFrameBufferSize 38400
dwDefaultFrameInterval 333333
bFrameIntervalType 1
dwFrameInterval( 0) 333333
VideoStreaming Interface Descriptor:
bLength 30
bDescriptorType 36
bDescriptorSubtype 5 (
FRAME_UNCOMPRESSED)bFrameIndex 12
bmCapabilities
0x01Still image supported
wWidth 1024
wHeight 768
dwMinBitRate 125829120
dwMaxBitRate 125829120
dwMaxVideoFrameBufferSize 1572864
dwDefaultFrameInterval 1000000
bFrameIntervalType 1
dwFrameInterval( 0) 1000000
VideoStreaming Interface Descriptor:
bLength 6
bDescriptorType 36
bDescriptorSubtype 13 (COLORFORMAT)
bColorPrimaries 1 (BT.709,sRGB)
bTransferCharacteristics 1 (BT.709)
bMatrixCoefficients 4 (SMPTE 170M (BT.601))
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 1
bNumEndpoints 1
bInterfaceClass 14 Video
bInterfaceSubClass 2 Video Streaming
bInterfaceProtocol 0
iInterface 4 Nantian Camera 8513
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress
0x82EP 2 INbmAttributes 5
Transfer Type Isochronous
Synch Type Asynchronous
Usage Type Data
wMaxPacketSize
0x13503x 848 bytesbInterval 1
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 2
bNumEndpoints 1
bInterfaceClass 14 Video
bInterfaceSubClass 2 Video Streaming
bInterfaceProtocol 0
iInterface 4 Nantian Camera 8513
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress
0x82EP 2 INbmAttributes 5
Transfer Type Isochronous
Synch Type Asynchronous
Usage Type Data
wMaxPacketSize
0x0c002x 1024 bytesbInterval 1
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 3
bNumEndpoints 1
bInterfaceClass 14 Video
bInterfaceSubClass 2 Video Streaming
bInterfaceProtocol 0
iInterface 4 Nantian Camera 8513
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress
0x82EP 2 INbmAttributes 5
Transfer Type Isochronous
Synch Type Asynchronous
Usage Type Data
wMaxPacketSize
0x04001x 1024 bytesbInterval 1
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 4
bNumEndpoints 1
bInterfaceClass 14 Video
bInterfaceSubClass 2 Video Streaming
bInterfaceProtocol 0
iInterface 4 Nantian Camera 8513
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress
0x82EP 2 INbmAttributes 5
Transfer Type Isochronous
Synch Type Asynchronous
Usage Type Data
wMaxPacketSize
0x02001x 512 bytesbInterval 1
Device Qualifier (for other device speed):
bLength 10
bDescriptorType 6
bcdUSB 2.00
bDeviceClass 239 Miscellaneous Device
bDeviceSubClass 2
bDeviceProtocol 1 Interface Association
bMaxPacketSize0 64
bNumConfigurations 1
Quoted 76 lines · Laurent Pinchart
Hi Chen Changcheng,
Thank you for the patch.
Quoted 6 lines · chenchangcheng
From: chenchangcheng <[email protected]>
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) ?Quoted 2 lines
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 ?
Quoted 56 lines
Signed-off-by chenchangcheng <[email protected]>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(-)drivers/media/usb/uvc/uvc_driver.c +9
-0@@ -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) },drivers/media/usb/uvc/uvc_status.c +5
-1@@ -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);drivers/media/usb/uvc/uvcvideo.h +1
-0@@ -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 0x00001000Quoted 7 lines
drivers/media/usb/uvc/uvcvideo.h line 204
Quoted 2 lines
drivers/media/usb/uvc/uvcvideo.h +0
-0/* Format flags */ #define UVC_FMT_FLAG_COMPRESSED 0x00000001--
Regards,Laurent Pinchart
[webmail]
Signature · 3 lines
Regards, Laurent Pinchart