我从亚马逊购买了一台 Maozua 5mp USB 显微镜(查看评论后发现它可以在 Linux 上使用)。遗憾的是,当我将它连接到 Lubuntu 16.04 时,它无法在 guvcview 或 cheese 上使用。
我做了一些调查。相关部分如下所示:
ls /dev | grep video
video0
video1
显微镜在 video1 上,罗技网络摄像头在 video0 上。当显微镜未连接时,网络摄像头可以工作,但当显微镜连接时,guvcview 和 cheese 无法从中检索视频:
lsusb
Bus 003 Device 009: ID 0c45:6366 Microdia
更详细的信息:
lsusb -v
Bus 003 Device 008: ID 0c45:6366 Microdia
Couldn't open device, some information will be missing
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 239 Miscellaneous Device
bDeviceSubClass 2 ?
bDeviceProtocol 1 Interface Association
bMaxPacketSize0 64
idVendor 0x0c45 Microdia
idProduct 0x6366
bcdDevice 1.00
iManufacturer 2
iProduct 1
iSerial 3
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 662
bNumInterfaces 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 5
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 14 Video
bInterfaceSubClass 1 Video Control
bInterfaceProtocol 0
iInterface 5
VideoControl Interface Descriptor:
bLength 13
bDescriptorType 36
bDescriptorSubtype 1 (HEADER)
bcdUVC 1.00
wTotalLength 108
dwClockFrequency 15.000000MHz
bInCollection 1
baInterfaceNr( 0) 1
VideoControl Interface Descriptor:
bLength 9
bDescriptorType 36
bDescriptorSubtype 3 (OUTPUT_TERMINAL)
bTerminalID 5
wTerminalType 0x0101 USB Streaming
bAssocTerminal 0
bSourceID 4
iTerminal 0
VideoControl Interface Descriptor:
bLength 28
bDescriptorType 36
bDescriptorSubtype 6 (EXTENSION_UNIT)
bUnitID 3
guidExtensionCode {7033f028-1163-2e4a-ba2c-6890eb334016}
bNumControl 24
bNrPins 1
baSourceID( 0) 2
bControlSize 3
bmControls( 0) 0xff
bmControls( 1) 0xff
bmControls( 2) 0xff
iExtension 0
VideoControl Interface Descriptor:
bLength 29
bDescriptorType 36
bDescriptorSubtype 6 (EXTENSION_UNIT)
bUnitID 4
guidExtensionCode {b42153bd-35d6-45ca-b203-4e0149b301bc}
bNumControl 32
bNrPins 1
baSourceID( 0) 3
bControlSize 4
bmControls( 0) 0x03
bmControls( 1) 0x80
bmControls( 2) 0x3f
bmControls( 3) 0x9f
iExtension 0
VideoControl Interface Descriptor:
bLength 18
bDescriptorType 36
bDescriptorSubtype 2 (INPUT_TERMINAL)
bTerminalID 1
wTerminalType 0x0201 Camera Sensor
bAssocTerminal 0
iTerminal 0
wObjectiveFocalLengthMin 0
wObjectiveFocalLengthMax 0
wOcularFocalLength 0
bControlSize 3
bmControls 0x0000000e
Auto-Exposure Mode
Auto-Exposure Priority
Exposure Time (Absolute)
VideoControl Interface Descriptor:
bLength 11
bDescriptorType 36
bDescriptorSubtype 5 (PROCESSING_UNIT)
Warning: Descriptor too short
bUnitID 2
bSourceID 1
wMaxMultiplier 0
bControlSize 2
bmControls 0x0000177f
Brightness
Contrast
Hue
Saturation
Sharpness
Gamma
White Balance Temperature
Backlight Compensation
Gain
Power Line Frequency
White Balance Temperature, Auto
iProcessing 0
bmVideoStandards 0x 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x83 EP 3 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0010 1x 16 bytes
bInterval 6
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 0
bInterfaceClass 14 Video
bInterfaceSubClass 2 Video Streaming
bInterfaceProtocol 0
iInterface 0
VideoStreaming Interface Descriptor:
bLength 15
bDescriptorType 36
bDescriptorSubtype 1 (INPUT_HEADER)
bNumFormats 2
wTotalLength 411
bEndPointAddress 129
bmInfo 0
bTerminalLink 5
bStillCaptureMethod 2
bTriggerSupport 1
bTriggerUsage 1
bControlSize 1
bmaControls( 0) 11
bmaControls( 1) 11
VideoStreaming Interface Descriptor:
bLength 11
bDescriptorType 36
bDescriptorSubtype 6 (FORMAT_MJPEG)
bFormatIndex 1
bNumFrameDescriptors 5
bFlags 0
Fixed-size samples: No
bDefaultFrameIndex 1
bAspectRatioX 0
bAspectRatioY 0
bmInterlaceFlags 0x00
Interlaced stream or variable: No
Fields per frame: 1 fields
Field 1 first: No
Field pattern: Field 1 only
bCopyProtect 0
VideoStreaming Interface Descriptor:
bLength 30
bDescriptorType 36
bDescriptorSubtype 7 (FRAME_MJPEG)
bFrameIndex 1
bmCapabilities 0x00
Still image unsupported
wWidth 2592
wHeight 1944
dwMinBitRate 1209323520
dwMaxBitRate 1209323520
dwMaxVideoFrameBufferSize 10078285
dwDefaultFrameInterval 666666
bFrameIntervalType 1
dwFrameInterval( 0) 666666
VideoStreaming Interface Descriptor:
bLength 30
bDescriptorType 36
bDescriptorSubtype 7 (FRAME_MJPEG)
bFrameIndex 2
bmCapabilities 0x00
Still image unsupported
wWidth 2320
wHeight 1744
dwMinBitRate 971059200
dwMaxBitRate 971059200
dwMaxVideoFrameBufferSize 8092749
dwDefaultFrameInterval 666666
bFrameIntervalType 1
dwFrameInterval( 0) 666666
VideoStreaming Interface Descriptor:
bLength 30
bDescriptorType 36
bDescriptorSubtype 7 (FRAME_MJPEG)
bFrameIndex 3
bmCapabilities 0x00
Still image unsupported
wWidth 2048
wHeight 1536
dwMinBitRate 754974720
dwMaxBitRate 754974720
dwMaxVideoFrameBufferSize 6292045
dwDefaultFrameInterval 666666
bFrameIntervalType 1
dwFrameInterval( 0) 666666
VideoStreaming Interface Descriptor:
bLength 30
bDescriptorType 36
bDescriptorSubtype 7 (FRAME_MJPEG)
bFrameIndex 4
bmCapabilities 0x00
Still image unsupported
wWidth 1920
wHeight 1080
dwMinBitRate 497664000
dwMaxBitRate 497664000
dwMaxVideoFrameBufferSize 4147789
dwDefaultFrameInterval 666666
bFrameIntervalType 1
dwFrameInterval( 0) 666666
VideoStreaming Interface Descriptor:
bLength 30
bDescriptorType 36
bDescriptorSubtype 7 (FRAME_MJPEG)
bFrameIndex 5
bmCapabilities 0x00
Still image unsupported
wWidth 1280
wHeight 1024
dwMinBitRate 314572800
dwMaxBitRate 314572800
dwMaxVideoFrameBufferSize 2622029
dwDefaultFrameInterval 666666
bFrameIntervalType 1
dwFrameInterval( 0) 666666
VideoStreaming Interface Descriptor:
bLength 26
bDescriptorType 36
bDescriptorSubtype 3 (STILL_IMAGE_FRAME)
bEndpointAddress 0
bNumImageSizePatterns 5
wWidth( 0) 2592
wHeight( 0) 1944
wWidth( 1) 2320
wHeight( 1) 1744
wWidth( 2) 2048
wHeight( 2) 1536
wWidth( 3) 1920
wHeight( 3) 1080
wWidth( 4) 1280
wHeight( 4) 1024
bNumCompressionPatterns 5
VideoStreaming Interface Descriptor:
bLength 27
bDescriptorType 36
bDescriptorSubtype 4 (FORMAT_UNCOMPRESSED)
bFormatIndex 2
bNumFrameDescriptors 5
guidFormat {59555932-0000-1000-8000-00aa00389b71}
bBitsPerPixel 16
bDefaultFrameIndex 1
bAspectRatioX 0
bAspectRatioY 0
bmInterlaceFlags 0x00
Interlaced 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 0x00
Still image unsupported
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 0x00
Still image unsupported
wWidth 2320
wHeight 1774
dwMinBitRate 131701760
dwMaxBitRate 131701760
dwMaxVideoFrameBufferSize 8231360
dwDefaultFrameInterval 5000000
bFrameIntervalType 1
dwFrameInterval( 0) 5000000
VideoStreaming Interface Descriptor:
bLength 30
bDescriptorType 36
bDescriptorSubtype 5 (FRAME_UNCOMPRESSED)
bFrameIndex 3
bmCapabilities 0x00
Still image unsupported
wWidth 2048
wHeight 1536
dwMinBitRate 150994944
dwMaxBitRate 150994944
dwMaxVideoFrameBufferSize 6291456
dwDefaultFrameInterval 3333333
bFrameIntervalType 1
dwFrameInterval( 0) 3333333
VideoStreaming Interface Descriptor:
bLength 30
bDescriptorType 36
bDescriptorSubtype 5 (FRAME_UNCOMPRESSED)
bFrameIndex 4
bmCapabilities 0x00
Still image unsupported
wWidth 1920
wHeight 1080
dwMinBitRate 99532800
dwMaxBitRate 99532800
dwMaxVideoFrameBufferSize 4147200
dwDefaultFrameInterval 3333333
bFrameIntervalType 1
dwFrameInterval( 0) 3333333
VideoStreaming Interface Descriptor:
bLength 30
bDescriptorType 36
bDescriptorSubtype 5 (FRAME_UNCOMPRESSED)
bFrameIndex 5
bmCapabilities 0x00
Still image unsupported
wWidth 1280
wHeight 1024
dwMinBitRate 104857600
dwMaxBitRate 104857600
dwMaxVideoFrameBufferSize 2621440
dwDefaultFrameInterval 2000000
bFrameIntervalType 1
dwFrameInterval( 0) 2000000
VideoStreaming Interface Descriptor:
bLength 26
bDescriptorType 36
bDescriptorSubtype 3 (STILL_IMAGE_FRAME)
bEndpointAddress 0
bNumImageSizePatterns 5
wWidth( 0) 2592
wHeight( 0) 1944
wWidth( 1) 2320
wHeight( 1) 1744
wWidth( 2) 2048
wHeight( 2) 1536
wWidth( 3) 1920
wHeight( 3) 1080
wWidth( 4) 1280
wHeight( 4) 1024
bNumCompressionPatterns 5
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 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 5
Transfer Type Isochronous
Synch Type Asynchronous
Usage Type Data
wMaxPacketSize 0x0080 1x 128 bytes
bInterval 1
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 2
bNumEndpoints 1
bInterfaceClass 14 Video
bInterfaceSubClass 2 Video Streaming
bInterfaceProtocol 0
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 5
Transfer Type Isochronous
Synch Type Asynchronous
Usage Type Data
wMaxPacketSize 0x0100 1x 256 bytes
bInterval 1
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 3
bNumEndpoints 1
bInterfaceClass 14 Video
bInterfaceSubClass 2 Video Streaming
bInterfaceProtocol 0
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 5
Transfer Type Isochronous
Synch Type Asynchronous
Usage Type Data
wMaxPacketSize 0x0320 1x 800 bytes
bInterval 1
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 4
bNumEndpoints 1
bInterfaceClass 14 Video
bInterfaceSubClass 2 Video Streaming
bInterfaceProtocol 0
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 5
Transfer Type Isochronous
Synch Type Asynchronous
Usage Type Data
wMaxPacketSize 0x0b20 2x 800 bytes
bInterval 1
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 5
bNumEndpoints 1
bInterfaceClass 14 Video
bInterfaceSubClass 2 Video Streaming
bInterfaceProtocol 0
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 5
Transfer Type Isochronous
Synch Type Asynchronous
Usage Type Data
wMaxPacketSize 0x1320 3x 800 bytes
bInterval 1
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 6
bNumEndpoints 1
bInterfaceClass 14 Video
bInterfaceSubClass 2 Video Streaming
bInterfaceProtocol 0
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 5
Transfer Type Isochronous
Synch Type Asynchronous
Usage Type Data
wMaxPacketSize 0x1400 3x 1024 bytes
bInterval 1
我查看了 dmesg 的输出并发现了以下不祥的迹象:
[ 2364.670728] usb 3-2: new high-speed USB device number 8 using xhci_hcd
[ 2364.829594] usb 3-2: New USB device found, idVendor=0c45, idProduct=6366
[ 2364.829598] usb 3-2: New USB device strings: Mfr=2, Product=1, SerialNumber=3
[ 2364.829601] usb 3-2: Product: Digital microscope
[ 2364.829604] usb 3-2: Manufacturer: Sonix Technology Co., Ltd.
[ 2364.829606] usb 3-2: SerialNumber: SN0001
[ 2364.831835] uvcvideo: Found UVC 1.00 device Digital microscope (0c45:6366)
[ 2364.839225] uvcvideo 3-2:1.0: Entity type for entity Extension 4 was not initialized!
[ 2364.839229] uvcvideo 3-2:1.0: Entity type for entity Extension 3 was not initialized!
[ 2364.839232] uvcvideo 3-2:1.0: Entity type for entity Processing 2 was not initialized!
[ 2364.839235] uvcvideo 3-2:1.0: Entity type for entity Camera 1 was not initialized!
[ 2364.839369] input: Digital microscope: Digital mic as /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/input/input20
[ 2637.035796] usb 3-2: USB disconnect, device number 8
[ 2646.208190] usb 3-2: new high-speed USB device number 9 using xhci_hcd
[ 2646.367005] usb 3-2: New USB device found, idVendor=0c45, idProduct=6366
[ 2646.367009] usb 3-2: New USB device strings: Mfr=2, Product=1, SerialNumber=3
[ 2646.367012] usb 3-2: Product: Digital microscope
[ 2646.367015] usb 3-2: Manufacturer: Sonix Technology Co., Ltd.
[ 2646.367017] usb 3-2: SerialNumber: SN0001
[ 2646.369205] uvcvideo: Found UVC 1.00 device Digital microscope (0c45:6366)
[ 2646.376527] uvcvideo 3-2:1.0: Entity type for entity Extension 4 was not initialized!
[ 2646.376531] uvcvideo 3-2:1.0: Entity type for entity Extension 3 was not initialized!
[ 2646.376534] uvcvideo 3-2:1.0: Entity type for entity Processing 2 was not initialized!
[ 2646.376536] uvcvideo 3-2:1.0: Entity type for entity Camera 1 was not initialized!
[ 2646.376672] input: Digital microscope: Digital mic as /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/input/input21
我断开了 Logitech 网络摄像头的连接,以避免交互,并从控制台运行 cheese(使用 sudo 以避免权限问题)。我看到以下输出:
paul@clio:~$ sudo cheese
[sudo] password for paul:
(cheese:3520): IBUS-WARNING **: The owner of /home/paul/.config/ibus/bus is not root!
libv4l2: error turning on stream: Protocol error
(cheese:3520): cheese-WARNING **: Could not read from resource.: gstv4l2bufferpool.c(1054): gst_v4l2_buffer_pool_poll (): /GstCameraBin:camerabin/GstWrapperCameraBinSrc:camera_source/GstBin:bin18/GstV4l2Src:v4l2src1:
poll error 1: Protocol error (71)
我谷歌搜索了“microdia”和“0c45:6366”,发现很多人都在使用这款显微镜。有些人认为他们已经让它工作了,但解决方案分散在意识流的长线程中,我还没有拼凑出任何有用的方法。我注意到大多数线程的日期是 2008-2009 年。这让我想知道在那段时间之后是否有可用的驱动程序 - 但我找不到它!
任何帮助都感激不尽。
答案1
我终于解决了。经过大量的测试和推理,我得出结论,问题与驱动程序或操作系统版本无关。似乎只有一台特定的机器有问题。这表明是硬件问题。我偶然发现了一篇关于 ASMedia USB3 设备与 Kinect2 的所有问题的文章。我的主板(华硕 X99 Deluxe II)的规格显示它使用 ASMedia 进行 USB3,但显然不是用于 USB2。我将网络摄像头和显微镜切换到 USB2 端口,从那以后就没再出现过问题。
非常感谢 Kristopher Ives,他为此付出了很多努力来帮助我。
结论如果您在使用 UVC 设备时遇到问题并且拥有 ASMedia USB3,请尝试 USB2 端口。此外 ASMedia USB 很差劲!
答案2
尝试将网络摄像头直接连接到 PC 主板上的 USB - 而不是通过 USB 延长线或集线器。
尝试了不同的查看器,甚至升级了 Ubuntu 后,我还是没有成功。我终于看到了上面的答案,并尝试了 USB2 而不是 USB3,结果成功了。然而对我来说这只是巧合——当我移除一直在使用的延长线时,USB3 也能正常工作。
听起来很愚蠢,因为网络摄像头枚举并似乎几乎可以工作,但我猜测网络摄像头内部的电缆或电路质量较差(或者耗电量太大),并且 USB 在尝试传输大量数据时就会开始出现问题。