Toybrick

usb3.0UVC摄像头不能获取视频和图片

zoutianyang

注册会员

积分
107
楼主
发表于 2021-11-26 14:01:16    查看: 4497|回复: 7 | [复制链接]    打印 | 只看该作者
我用板子系统是Linux debian10.toybrick 4.4.194 #16 SMP Thu Apr 8 18:10:29 CST 2021 aarch64 GNU/Linux 摄像头型号:cyusb3065 MIPI图像,用这个USB3.0芯片转接,接到USB3.0接口 内核和文件系统均为最新版
我用/usr/share/rockchip-isp里面的实例代码,不能够获取到usb3.0的视频流,用cheese显示/dev/video0 no device found。用  499  sudo v4l2-ctl -d /dev/video0 --set-fmt-video=width=1920,height=1080,pixelformat=YUV422 --stream-mmap=3 --stream-to=/tmp/1920_480.yuv --stream-count=1 命令会卡住。摄像头的信息v4l2-ctl --all --list-formats-ext
Driver Info:
        Driver name      : uvcvideo
        Card type        : SZBSYGD
        Bus info         : usb-xhci-hcd.8.auto-1.4
        Driver version   : 4.4.194
        Capabilities     : 0x84a00001
                Video Capture
                Metadata Capture
                Streaming
                Extended Pix Format
                Device Capabilities
        Device Caps      : 0x04200001
                Video Capture
                Streaming
                Extended Pix Format
Media Driver Info:
        Driver name      : uvcvideo
        Model            : SZBSYGD
        Serial           :
        Bus info         : 1.4
        Media version    : 0.1.0
        Hardware revision: 0x00000107 (263)
        Driver version   : 4.4.194
Entity Info:
        ID               : 1
        Name             : SZBSYGD
        Type             : V4L2 I/O
        Flags            : default
        Major            : 81
        Minor            : 0
        Pad              : 0: Sink
Priority: 2
Video input : 0 (Camera 1: ok)
Format Video Capture:
        Width/Height      : 1920/1080
        Pixel Format      : 'UYVY' (UYVY 4:2:2)
        Field             : None
        Bytes per Line    : 3840
        Size Image        : 4147200
        Colorspace        : Default
        Transfer Function : Default (maps to Rec. 709)
        YCbCr/HSV Encoding: Default (maps to ITU-R 601)
        Quantization      : Default (maps to Limited Range)
        Flags             :
Crop Capability Video Capture:
        Bounds      : Left 0, Top 0, Width 1920, Height 1080
        Default     : Left 0, Top 0, Width 1920, Height 1080
        Pixel Aspect: 1/1
Selection: crop_default, Left 0, Top 0, Width 1920, Height 1080, Flags:
Selection: crop_bounds, Left 0, Top 0, Width 1920, Height 1080, Flags:
Streaming Parameters Video Capture:
        Capabilities     : timeperframe
        Frames per second: 60.000 (60/1)
        Read buffers     : 0
ioctl: VIDIOC_ENUM_FMT
        Type: Video Capture

        [0]: 'UYVY' (UYVY 4:2:2)
                Size: Discrete 1920x1080
                        Interval: Discrete 0.017s (60.000 fps)
执行查看media-ctl -p /dev/media0
Media controller API version 0.1.0

Media device information
------------------------
driver          uvcvideo
model           SZBSYGD
serial         
bus info        1.4
hw revision     0x107
driver version  4.4.194

Device topology
- entity 1: SZBSYGD (1 pad, 1 link)
            type Node subtype V4L flags 1
            device node name /dev/video0
        pad0: Sink
                <- "Extension 3":1 [ENABLED,IMMUTABLE]

- entity 2: SZBSYGD (0 pad, 0 link)
            type Node subtype V4L flags 0
            device node name /dev/video1

- entity 3: Extension 3 (2 pads, 2 links)
            type V4L2 subdev subtype Unknown flags 0
        pad0: Sink
                <- "Processing 2":1 [ENABLED,IMMUTABLE]
        pad1: Source
                -> "SZBSYGD":0 [ENABLED,IMMUTABLE]

- entity 4: Processing 2 (2 pads, 2 links)
            type V4L2 subdev subtype Unknown flags 0
        pad0: Sink
                <- "Camera 1":0 [ENABLED,IMMUTABLE]
        pad1: Source
                -> "Extension 3":0 [ENABLED,IMMUTABLE]

- entity 5: Camera 1 (1 pad, 1 link)
            type V4L2 subdev subtype Unknown flags 0
        pad0: Source
                -> "Processing 2":0 [ENABLED,IMMUTABLE]

执行dmesg 信息:
[90247.126888] ======== PULL WL_REG_ON(-1) LOW! ========
[90247.127439] [WLAN_RFKILL]: rockchip_wifi_power: 0
[90247.129491] [WLAN_RFKILL]: wifi shut off power.
[90247.129923] wl_android_wifi_on: Failed
[90247.130366] dhd_open : wl_android_wifi_on failed (-1)
[90247.130828] dhd_stop: Enter ffffffc07153d000
[90247.131258] wl_android_wifi_off in 1
[90247.133717] wl_android_wifi_off in 2: g_wifi_on=0, on_failure=1
[90247.134314] dhd_wl_ioctl: returning as busstate=0
[90247.134751] dhd_dbg_detach_pkt_monitor, 2204
[90247.135219] dhd_net_bus_devreset: dhd_bus_devreset: -35
[90247.137592] sdioh_disable_func_intr: error for read SDIO_CCCR_IENx : 0xffffff92
[90247.138309] wifi_platform_set_power = 0
[90247.138664] ======== PULL WL_REG_ON(-1) LOW! ========
[90247.139121] [WLAN_RFKILL]: rockchip_wifi_power: 0
[90247.141439] [WLAN_RFKILL]: wifi shut off power.
[90247.141869] wl_android_wifi_off out
[90247.142279] wl_ext_iapsta_dettach_netdev: ifidx=0
[90247.144124] dhd_stop: Exit
[90247.144447] dhd_open : the lock is released.
[90247.144845] dhd_open: Exit ret=-1
[90247.160312] dhd_ioctl_entry: Interface is down
[90260.621981] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[90260.625272] rk_gmac-dwmac fe300000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx
[90336.351184] uvcvideo: Non-zero status (-71) in video completion handler.
[90444.619066] uvcvideo: Failed to resubmit video URB (-1).
[95270.971547] usb 3-1-port2: disabled by hub (EMI?), re-enabling...
[95270.972657] usb 3-1.2: USB disconnect, device number 3
[95271.174049] usb 3-1.2: new low-speed USB device number 11 using xhci-hcd
[95271.256498] usb 3-1.2: New USB device found, idVendor=15d9, idProduct=0a4e
[95271.257206] usb 3-1.2: New USB device strings: Mfr=0, Product=1, SerialNumber=0
[95271.258026] usb 3-1.2: Product:  USB OPTICAL MOUSE
[95271.261008] usb 3-1.2: ep 0x81 - rounding interval to 64 microframes, ep desc says 80 microframes
[95271.296381] input:  USB OPTICAL MOUSE as /devices/platform/usb1/fe900000.dwc3/xhci-hcd.8.auto/usb3/3-1/3-1.2/3-1.2:1.0/0003:15D9:0A4E.0004/input/input7
[95271.351419] hid-generic 0003:15D9:0A4E.0004: input,hidraw0: USB HID v1.11 Mouse [ USB OPTICAL MOUSE] on usb-xhci-hcd.8.auto-1.2/input0
[95271.358164] usb 3-1-port3: disabled by hub (EMI?), re-enabling...
[95271.359698] usb 3-1.3: USB disconnect, device number 5
[95271.654157] usb 3-1.3: new low-speed USB device number 12 using xhci-hcd
[95271.738721] usb 3-1.3: New USB device found, idVendor=1a2c, idProduct=20c0
[95271.739432] usb 3-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[95271.740255] usb 3-1.3: Product: USB Keyboard
[95271.740661] usb 3-1.3: Manufacturer: USB
[95271.743922] usb 3-1.3: ep 0x81 - rounding interval to 64 microframes, ep desc says 80 microframes
[95271.744822] usb 3-1.3: ep 0x82 - rounding interval to 64 microframes, ep desc says 80 microframes
[95271.776975] input: USB USB Keyboard as /devices/platform/usb1/fe900000.dwc3/xhci-hcd.8.auto/usb3/3-1/3-1.3/3-1.3:1.0/0003:1A2C:20C0.0005/input/input8
[95271.834553] hid-generic 0003:1A2C:20C0.0005: input,hidraw1: USB HID v1.10 Keyboard [USB USB Keyboard] on usb-xhci-hcd.8.auto-1.3/input0
[95271.847899] input: USB USB Keyboard as /devices/platform/usb1/fe900000.dwc3/xhci-hcd.8.auto/usb3/3-1/3-1.3/3-1.3:1.1/0003:1A2C:20C0.0006/input/input9
[95271.902557] hid-generic 0003:1A2C:20C0.0006: input,hidraw2: USB HID v1.10 Device [USB USB Keyboard] on usb-xhci-hcd.8.auto-1.3/input1
我该怎么做来支持我的摄像头??
回复

使用道具 举报

troy

版主

积分
2346
沙发
发表于 2021-12-2 18:26:19 | 只看该作者
手上有源码的话,可以menuconfig看一下USB UVC相关的配置宏是否打开了。
回复

使用道具 举报

macfee_feng

注册会员

积分
59
板凳
发表于 2021-12-3 10:14:47 | 只看该作者
是不是找错设备号了,你拔插以下摄像头,看看增加的是哪个?ls  /dev/video*  
回复

使用道具 举报

zoutianyang

注册会员

积分
107
地板
 楼主| 发表于 2021-12-3 17:18:51 | 只看该作者
troy,你好,我的usb2.0摄像头是好使的,是不是可以确认系统开启了uvc驱动呢,还有我用guvcview工具是可以看到usb3.0摄像头,但是视频很卡顿,macfee_feng插拔看到的是/dev/video0和/dev/video1。这是我插上usb3.0摄像头的dmesg,[103368.695544] usb 4-1.4: new SuperSpeed USB device number 10 using xhci-hcd
[103368.707532] usb 4-1.4: LPM exit latency is zeroed, disabling LPM.
[103368.710005] usb 4-1.4: New USB device found, idVendor=4e45, idProduct=5501
[103368.710695] usb 4-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[103368.711525] usb 4-1.4: Product: SZBSYGD
[103368.711908] usb 4-1.4: Manufacturer: Mysher
[103368.736128] uvcvideo: Found UVC 1.10 device SZBSYGD (4e45:5501)
[104430.336084] usb 4-1.4: USB disconnect, device number 10
[104434.302539] usb 3-1.4: new high-speed USB device number 20 using xhci-hcd
[104434.438021] usb 3-1.4: New USB device found, idVendor=1555, idProduct=15aa
[104434.438714] usb 3-1.4: New USB device strings: Mfr=1, Product=4, SerialNumber=3
[104434.439498] usb 3-1.4: Product: USB2.0_Camera_RGB
[104434.439951] usb 3-1.4: Manufacturer: USB2.0_Camera_RGB
[104434.440516] usb 3-1.4: SerialNumber: 01.00.00
[104434.457962] uvcvideo: Found UVC 1.00 device USB2.0_Camera_RGB (1555:15aa)
[104828.514614] uvcvideo: Failed to resubmit video URB (-1).
[168693.993739] uvcvideo: Failed to resubmit video URB (-1).
[170748.770123] uvcvideo: Failed to resubmit video URB (-1).
[197555.922412] usb 3-1.4: USB disconnect, device number 20
[197572.090810] usb 4-1.4: new SuperSpeed USB device number 11 using xhci-hcd
[197572.103702] usb 4-1.4: LPM exit latency is zeroed, disabling LPM.
[197572.106008] usb 4-1.4: New USB device found, idVendor=4e45, idProduct=5501
[197572.106694] usb 4-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[197572.107365] usb 4-1.4: Product: SZBSYGD
[197572.107885] usb 4-1.4: Manufacturer: Mysher
[197572.127804] uvcvideo: Found UVC 1.10 device SZBSYGD (4e45:5501)


[168693.993739] uvcvideo: Failed to resubmit video URB (-1).
[170748.770123] uvcvideo: Failed to resubmit video URB (-1).
这是是不是说明有问题?
回复

使用道具 举报

zoutianyang

注册会员

积分
107
5#
 楼主| 发表于 2021-12-3 17:21:21 | 只看该作者
这是我lsusb 情况 4e45:5501就是usb3.0摄像头
root@debian10:/zty# lsusb
Bus 004 Device 011: ID 4e45:5501  
Bus 004 Device 009: ID 2109:0813 VIA Labs, Inc.
Bus 004 Device 008: ID 2109:0813 VIA Labs, Inc.
Bus 004 Device 002: ID 05e3:0616 Genesys Logic, Inc. hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 018: ID 0483:572b STMicroelectronics
Bus 003 Device 016: ID 1a2c:20c0 China Resource Semico Co., Ltd
Bus 003 Device 015: ID 15d9:0a4e Trust International B.V.
Bus 003 Device 014: ID 2109:2813 VIA Labs, Inc.
Bus 003 Device 013: ID 2109:2813 VIA Labs, Inc.
Bus 003 Device 002: ID 05e3:0610 Genesys Logic, Inc. 4-port hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 003: ID 04e2:1414 Exar Corp.
Bus 002 Device 002: ID 05e3:0610 Genesys Logic, Inc. 4-port hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

root@debian10:/zty# lsusb -D /dev/bus/usb/004/011
Device: ID 4e45:5501  
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               3.00
  bDeviceClass          239 Miscellaneous Device
  bDeviceSubClass         2
  bDeviceProtocol         1 Interface Association
  bMaxPacketSize0         9
  idVendor           0x4e45
  idProduct          0x5501
  bcdDevice            1.07
  iManufacturer           1 Mysher
  iProduct                2 SZBSYGD
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x00da
    bNumInterfaces          2
    bConfigurationValue     1
    iConfiguration          3 USB-3.0
    bmAttributes         0xc0
      Self Powered
    MaxPower               96mA
    Interface Association:
      bLength                 8
      bDescriptorType        11
      bFirstInterface         0
      bInterfaceCount         2
      bFunctionClass         14 Video
      bFunctionSubClass       3 Video Interface Collection
      bFunctionProtocol       0
      iFunction               0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass        14 Video
      bInterfaceSubClass      1 Video Control
      bInterfaceProtocol      0
      iInterface              0
      VideoControl Interface Descriptor:
        bLength                13
        bDescriptorType        36
        bDescriptorSubtype      1 (HEADER)
        bcdUVC               1.10
        wTotalLength       0x0051
        dwClockFrequency       48.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               0
        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      16384
        bControlSize            3
        bmControls     0x00000000
        iProcessing             0
        bmVideoStandards     0x00
      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     0x0040  1x 64 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      0
      iInterface              0
      VideoStreaming Interface Descriptor:
        bLength                            14
        bDescriptorType                    36
        bDescriptorSubtype                  1 (INPUT_HEADER)
        bNumFormats                         1
        wTotalLength                   0x0047
        bEndPointAddress                  131
        bmInfo                              0
        bTerminalLink                       4
        bStillCaptureMethod                 0
        bTriggerSupport                     0
        bTriggerUsage                       0
        bControlSize                        1
        bmaControls( 0)                     0
      VideoStreaming Interface Descriptor:
        bLength                            27
        bDescriptorType                    36
        bDescriptorSubtype                  4 (FORMAT_UNCOMPRESSED)
        bFormatIndex                        1
        bNumFrameDescriptors                1
        guidFormat                            {59565955-0000-0010-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                           1920
        wHeight                          1080
        dwMinBitRate                1990656000
        dwMaxBitRate                1990656000
        dwMaxVideoFrameBufferSize     4147200
        dwDefaultFrameInterval         166666
        bFrameIntervalType                  1
        dwFrameInterval( 0)            166666
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        bMaxBurst              15
Binary Object Store Descriptor:
  bLength                 5
  bDescriptorType        15
  wTotalLength       0x0016
  bNumDeviceCaps          2
  USB 2.0 Extension Device Capability:
    bLength                 7
    bDescriptorType        16
    bDevCapabilityType      2
    bmAttributes   0x00000002
      HIRD Link Power Management (LPM) Supported
  SuperSpeed USB Device Capability:
    bLength                10
    bDescriptorType        16
    bDevCapabilityType      3
    bmAttributes         0x00
    wSpeedsSupported   0x000e
      Device can operate at Full Speed (12Mbps)
      Device can operate at High Speed (480Mbps)
      Device can operate at SuperSpeed (5Gbps)
    bFunctionalitySupport   3
      Lowest fully-functional device speed is SuperSpeed (5Gbps)
    bU1DevExitLat           0 micro seconds
    bU2DevExitLat           0 micro seconds
can't get debug descriptor: Resource temporarily unavailable
Device Status:     0x0001
  Self Powered
回复

使用道具 举报

troy

版主

积分
2346
6#
发表于 2021-12-6 09:08:32 | 只看该作者
zoutianyang 发表于 2021-12-3 17:21
这是我lsusb 情况 4e45:5501就是usb3.0摄像头
root@debian10:/zty# lsusb
Bus 004 Device 011: ID 4e45:550 ...

USB2.0可以用,那UVC配置应该是正常的。至于你说的视频卡顿问题,应该是分辨率太大,USB的带宽顶不住。虽然板子上有3.0的口,但是都是从Hub上分出来的,3.0的Hub上,如果有挂2.0的设备,那么只会被当做2.0使用。
回复

使用道具 举报

zoutianyang

注册会员

积分
107
7#
 楼主| 发表于 2021-12-6 14:13:06 | 只看该作者
troy,能帮我分析一下,为什么v4l2命令和/usr/share/rockchip-isp里面的实例代码,不能够获取到usb3.0的视频流的原因么?以及cheese获取不到设备,我该如何调试?
回复

使用道具 举报

troy

版主

积分
2346
8#
发表于 2021-12-6 14:41:24 | 只看该作者
zoutianyang 发表于 2021-12-6 14:13
troy,能帮我分析一下,为什么v4l2命令和/usr/share/rockchip-isp里面的实例代码,不能够获取到usb3.0的视 ...

USB  Camera估计要自己看一下,这个是内核标准的驱动,跟一下ioctl命令,是不是有哪些没实现。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

产品中心 购买渠道 开源社区 Wiki教程 资料下载 关于Toybrick


快速回复 返回顶部 返回列表