[linux-uvc-devel] USB3 UVC Multi-camera device
Linux UVC driver and tools
Brought to you by:
pinchartl
From: Brian K. <sas...@gm...> - 2017-10-11 17:30:03
|
Hi, I'm currently developing a USB3 UVC peripheral which will feature 2 cameras as 2 discrete Video Interface Collections. I haven’t seen any similar products on the market, so in order to de-risk this effort I have started with a Cypress dev kit and I'm modifying their example project which loops a 2 frame video as “single camera” UVC compliant device. The initial demo project works fine, but with my firmware modifications I am encountering a handful of issues with uvcvideo on my Linux test machine (Ubuntu 17.04 / 4.10.0-35-generic). The enumeration process and USB descriptors for my modified project appear to be fine when inspected with both my USB analyzer (Beagle USB 5000) and lsusb. I see both /dev/video0 and /dev/video1 but I run into issues once I try and access the streams (with VLC, gucvview, and the QTV4L2 test utility). All apps report variations of the error “no video device found”. Digging into this a bit more, it appears that the host is not sending a GetDeviceStatus and GetInterfaceStatus when the feeds are accessed by the Host apps like I see with the single camera demo. I have turned on the uvcvideo trace and noticed the following peculiarities with the dmesg log. During enumeration I get a dmesg error regarding the second camera and dbugfs. The exact error is “uvcvideo: Unable to create debugfs busnum-devnum directory.” This error obviously occurs because the busnum and devnum are the same for the 2nd camera, and debugfs was already created for the first camera. The uvcvideo sequence is different between the two different firmware builds at the end of enumeration. With the single camera version of firmware I see the following sequence in dmesg: [14332.280577] uvcvideo: UVC device initialized. [14332.292304] uvcvideo: uvc_v4l2_open [14332.292360] uvcvideo: uvc_v4l2_release [14334.293725] uvcvideo: Suspending interface 1 [14334.293726] uvcvideo: Suspending interface 0 However, with the 2 camera firmware I see: [14580.171459] uvcvideo: UVC device initialized. [14580.183685] uvcvideo: uvc_v4l2_open [14580.184600] uvcvideo: uvc_v4l2_open [14582.186638] uvcvideo: Suspending interface 3 [14582.186639] uvcvideo: Suspending interface 2 [14582.186640] uvcvideo: Suspending interface 1 [14582.186641] uvcvideo: Suspending interface 0 Note that the device is never released. Based on these findings, it looks like I’ll need to dive into the Linux uvcvideo source but I don’t have any experience in this source. Is there anyone on this list that might be able to tell me if I have overlooked some aspect of the UVC spec? Is it possible that I’m encountering issues that were overlooked since no multi-camera multi-feed devices exist? I know stereoscopic cameras do exist, but from what I have seen those devices have 1 VIC and only 1 stereo stream. Thanks in advance, Brian BTW, for reference the lsusb details are shown below: Bus 002 Device 006: ID 04b4:4722 Cypress Semiconductor Corp. Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 3.00 bDeviceClass 239 Miscellaneous Device bDeviceSubClass 2 ? bDeviceProtocol 1 Interface Association bMaxPacketSize0 9 idVendor 0x04b4 Cypress Semiconductor Corp. idProduct 0x4722 bcdDevice 0.00 iManufacturer 1 Cypress iProduct 2 FX3 iSerial 0 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 395 bNumInterfaces 4 bConfigurationValue 1 iConfiguration 0 bmAttributes 0x80 (Bus Powered) MaxPower 100mA Interface Association: bLength 8 bDescriptorType 11 bFirstInterface 0 bInterfaceCount 2 bFunctionClass 14 Video bFunctionSubClass 3 Video Interface Collection bFunctionProtocol 0 iFunction 3 CAM1 Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 0 bNumEndpoints 1 bInterfaceClass 14 Video bInterfaceSubClass 1 Video Control bInterfaceProtocol 1 iInterface 3 CAM1 VideoControl Interface Descriptor: bLength 13 bDescriptorType 36 bDescriptorSubtype 1 (HEADER) bcdUVC 1.00 wTotalLength 81 dwClockFrequency 0.000000MHz bInCollection 1 baInterfaceNr( 0) 1 VideoControl Interface Descriptor: bLength 18 bDescriptorType 36 bDescriptorSubtype 2 (INPUT_TERMINAL) bTerminalID 1 wTerminalType 0x0201 Camera Sensor bAssocTerminal 0 iTerminal 3 CAM1 wObjectiveFocalLengthMin 0 wObjectiveFocalLengthMax 0 wOcularFocalLength 0 bControlSize 3 bmControls 0x00000000 VideoControl Interface Descriptor: bLength 13 bDescriptorType 36 bDescriptorSubtype 5 (PROCESSING_UNIT) bUnitID 2 bSourceID 1 wMaxMultiplier 0 bControlSize 3 bmControls 0x00000000 iProcessing 0 bmVideoStandards 0x 0 VideoControl Interface Descriptor: bLength 28 bDescriptorType 36 bDescriptorSubtype 6 (EXTENSION_UNIT) bUnitID 3 guidExtensionCode {ffffffff-ffff-ffff-ffff-ffffffffffff} bNumControl 0 bNrPins 1 baSourceID( 0) 2 bControlSize 3 bmControls( 0) 0x00 bmControls( 1) 0x00 bmControls( 2) 0x00 iExtension 0 VideoControl Interface Descriptor: bLength 9 bDescriptorType 36 bDescriptorSubtype 3 (OUTPUT_TERMINAL) bTerminalID 4 wTerminalType 0x0101 USB Streaming bAssocTerminal 0 bSourceID 3 iTerminal 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x82 EP 2 IN bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x4000 1x 0 bytes bInterval 1 bMaxBurst 0 Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 1 bAlternateSetting 0 bNumEndpoints 1 bInterfaceClass 14 Video bInterfaceSubClass 2 Video Streaming bInterfaceProtocol 1 iInterface 0 VideoStreaming Interface Descriptor: bLength 14 bDescriptorType 36 bDescriptorSubtype 1 (INPUT_HEADER) bNumFormats 1 wTotalLength 25 bEndPointAddress 129 bmInfo 0 bTerminalLink 4 bStillCaptureMethod 1 bTriggerSupport 1 bTriggerUsage 0 bControlSize 1 bmaControls( 0) 11 VideoStreaming Interface Descriptor: bLength 11 bDescriptorType 36 bDescriptorSubtype 6 (FORMAT_MJPEG) bFormatIndex 1 bNumFrameDescriptors 1 bFlags 1 Fixed-size samples: Yes 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 640 wHeight 480 dwMinBitRate 6144000 dwMaxBitRate 6144000 dwMaxVideoFrameBufferSize 153600 dwDefaultFrameInterval 666666 bFrameIntervalType 1 dwFrameInterval( 0) 666666 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x4000 1x 0 bytes bInterval 0 bMaxBurst 7 Interface Association: bLength 8 bDescriptorType 11 bFirstInterface 2 bInterfaceCount 2 bFunctionClass 14 Video bFunctionSubClass 3 Video Interface Collection bFunctionProtocol 0 iFunction 4 CAM2 Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 2 bAlternateSetting 0 bNumEndpoints 1 bInterfaceClass 14 Video bInterfaceSubClass 1 Video Control bInterfaceProtocol 1 iInterface 4 CAM2 VideoControl Interface Descriptor: bLength 13 bDescriptorType 36 bDescriptorSubtype 1 (HEADER) bcdUVC 1.00 wTotalLength 81 dwClockFrequency 0.000000MHz bInCollection 1 baInterfaceNr( 0) 3 VideoControl Interface Descriptor: bLength 18 bDescriptorType 36 bDescriptorSubtype 2 (INPUT_TERMINAL) bTerminalID 5 wTerminalType 0x0201 Camera Sensor bAssocTerminal 0 iTerminal 4 CAM2 wObjectiveFocalLengthMin 0 wObjectiveFocalLengthMax 0 wOcularFocalLength 0 bControlSize 3 bmControls 0x00000000 VideoControl Interface Descriptor: bLength 13 bDescriptorType 36 bDescriptorSubtype 5 (PROCESSING_UNIT) bUnitID 6 bSourceID 5 wMaxMultiplier 0 bControlSize 3 bmControls 0x00000000 iProcessing 0 bmVideoStandards 0x 0 VideoControl Interface Descriptor: bLength 28 bDescriptorType 36 bDescriptorSubtype 6 (EXTENSION_UNIT) bUnitID 7 guidExtensionCode {ffffffff-ffff-ffff-ffff-ffffffffffff} bNumControl 0 bNrPins 1 baSourceID( 0) 6 bControlSize 3 bmControls( 0) 0x00 bmControls( 1) 0x00 bmControls( 2) 0x00 iExtension 0 VideoControl Interface Descriptor: bLength 9 bDescriptorType 36 bDescriptorSubtype 3 (OUTPUT_TERMINAL) bTerminalID 8 wTerminalType 0x0101 USB Streaming bAssocTerminal 0 bSourceID 7 iTerminal 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x84 EP 4 IN bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x4000 1x 0 bytes bInterval 1 bMaxBurst 0 Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 3 bAlternateSetting 0 bNumEndpoints 1 bInterfaceClass 14 Video bInterfaceSubClass 2 Video Streaming bInterfaceProtocol 1 iInterface 0 VideoStreaming Interface Descriptor: bLength 14 bDescriptorType 36 bDescriptorSubtype 1 (INPUT_HEADER) bNumFormats 1 wTotalLength 25 bEndPointAddress 131 bmInfo 0 bTerminalLink 8 bStillCaptureMethod 1 bTriggerSupport 1 bTriggerUsage 0 bControlSize 1 bmaControls( 0) 11 VideoStreaming Interface Descriptor: bLength 11 bDescriptorType 36 bDescriptorSubtype 6 (FORMAT_MJPEG) bFormatIndex 1 bNumFrameDescriptors 1 bFlags 1 Fixed-size samples: Yes 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 640 wHeight 480 dwMinBitRate 6144000 dwMaxBitRate 6144000 dwMaxVideoFrameBufferSize 153600 dwDefaultFrameInterval 666666 bFrameIntervalType 1 dwFrameInterval( 0) 666666 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x83 EP 3 IN bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x4000 1x 0 bytes bInterval 0 bMaxBurst 7 Binary Object Store Descriptor: bLength 5 bDescriptorType 15 wTotalLength 15 bNumDeviceCaps 1 SuperSpeed USB Device Capability: bLength 10 bDescriptorType 16 bDevCapabilityType 3 bmAttributes 0x00 wSpeedsSupported 0x0008 Device can operate at SuperSpeed (5Gbps) bFunctionalitySupport 3 Lowest fully-functional device speed is SuperSpeed (5Gbps) bU1DevExitLat 0 micro seconds bU2DevExitLat 0 micro seconds Device Status: 0x0000 (Bus Powered) |