I bought a Maozua 5mp USB microscope off Amazon (after checking in the reviews that it worked on Linux). Sadly when I connected it on Lubuntu 16.04 it does not work in guvcview or cheese.
I did some investigation. I show the relevant parts below:
ls /dev | grep video
video0
video1
The microscope is on video1 and a logitech webcam on video0. The webcam works when the microscope is not connected, but guvcview and cheese cannot retrieve video from it when the microscope is connected:
lsusb
Bus 003 Device 009: ID 0c45:6366 Microdia
more detailed info:
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
I looked at the output of dmesg and found the following ominous lines:
[ 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
I disconnected the Logitech webcam, to avoid interactions, and ran cheese from the console (using sudo to avoid permission problems). I saw the following output:
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)
I googled 'microdia' and '0c45:6366' and found a lot of people have struggled with this microscope. Some believe they got it working, but the solutions are spread across long threads stream-of-consciouness-wise and I have not pieced together anything that works. I noted that most of the threads are dated 2008-2009. It makes me wonder whether a working driver became available after that period – but I can't find it !
Any help will be much appreciated.
Best Answer
I finally solved it. After a lot of time testing and theorising I came to the conclusion that the problem was nothing to do with drivers or OS versions. It seemed to be only one specific machine that had problems. This pointed to a hardware problem. By accident I chanced on an article about all the problems ASMedia USB3 devices have with Kinect2. The specs for my motherboard(Asus X99 Deluxe II) show it uses ASMedia for USB3, but not apparently for USB2. I switched my webcam and Microscope to the USB2 ports and have not had a problem since.
Many thanks to Kristopher Ives who put a lot of effort into helping me with this.
Conclusion if you are having trouble with UVC devices and have ASMedia USB3, try USB2 ports. Also ASMedia USB sucks !