hi3516cv300 USB HOST 适配UVC摄像头

 2 E币 
成为会员,免费下载资料
文件大小:4.26 KB 上传者:346793103 时间:2019-08-01 12:45:10 下载量:17
本帖最后由 346793103 于 2019-8-1 12:51 编辑

硬件平台:HI3516CV300
内核版本:linux 3.18.20
SDK版本:Hi3516C_V300R001C01SPC030
问题描述:
想在Hi3516cv上面集成双路摄像头,一路mipi,一路采用USB HOST的方式挂载一个UVC的USB摄像头,在使用V4L2接口采集USB摄像头数据时,发现无法获取到数据。(NOTE:程序在虚拟机下运行可以抓取到USB摄像头数据)
下面我的操作步骤:
1、配置内核,使能USB UVC摄像头
[code]
Device Drivers —>
  • USB support —>
      <*> EHCI HCD (USB 2.0) support
       
  • Improved Transaction Translator scheduling (NEW)
       <*> Generic EHCI driver for a platform device
       <*> OHCI HCD (USB 1.1) support
       <*> Generic OHCI driver for a platform device
     PHY Subsystem —>
      <*> Hisilicon Inno USB2 PHY suppor

    Device Drivers —>
      <*> Multimedia support —>  
                   
  • Cameras/video grabbers support
                   
  • Media Controller API
                   
  • V4L2 sub-device userspace API
                    <*>Media USB Adapters —>
                            <*> USB Video Class (UVC)
                           
  • UVC input events devices support
                    GSPCA based webcams
                    <*>V4L platform devices —>
                            <*> Soc camera support
                            <*> platform camera support
    [/code]
    2、添加USB UVC设备支持
    因为在UVC中找不到我当前的摄像头,为了能够是被该摄像头,我在driver/media/usb/uvc/uvc_driver.c下面添加了摄像头的VID和PID信息
    [code]
    /* LogiLink Wireless Webcam */
            { .match_flags                = USB_DEVICE_ID_MATCH_DEVICE
                                    | USB_DEVICE_ID_MATCH_INT_INFO,
              .idVendor                = 0x058f,
              .idProduct                = 0x3841,
              .bInterfaceClass        = USB_CLASS_VIDEO,
              .bInterfaceSubClass        = 1,
              .bInterfaceProtocol        = 0,
              .driver_info                = UVC_QUIRK_RESTRICT_FRAME_RATE },
            /* LogiLink Wireless Webcam */
            { .match_flags                = USB_DEVICE_ID_MATCH_DEVICE
                                    | USB_DEVICE_ID_MATCH_INT_INFO,
              .idVendor                = 0x1bcf,
              .idProduct                = 0x2283,
              .bInterfaceClass        = USB_CLASS_VIDEO,
              .bInterfaceSubClass        = 1,
              .bInterfaceProtocol        = 0,
              .driver_info                = UVC_QUIRK_RESTRICT_FRAME_RATE },
    [/code]
    添加完成后,编译uImage,下载到hi3516cv300开发板上
    3、插上USB
    插上USB后显示如下日志
    [code]usb usb1-port1: unable to enumerate USB device
    usb 2-1: new full-speed USB device number 5 using ohci-platform
    usb 1-1: new high-speed USB device number 18 using ehci-platform
    usb 1-1: device descriptor read/64, error -71
    usb 1-1: device descriptor read/64, error -71
    usb 1-1: new high-speed USB device number 19 using ehci-platform
    usb 1-1: device descriptor read/64, error -71
    usb 1-1: device descriptor read/64, error -71
    usb 1-1: new high-speed USB device number 20 using ehci-platform
    usb 1-1: device not accepting address 20, error -71
    usb 1-1: new high-speed USB device number 21 using ehci-platform
    usb 1-1: device not accepting address 21, error -71
    usb usb1-port1: unable to enumerate USB device
    usb 1-1: new high-speed USB device number 22 using ehci-platform
    usb 1-1: device descriptor read/64, error -71
    usb 1-1: device descriptor read/64, error -71
    usb 1-1: new high-speed USB device number 23 using ehci-platform
    usb 1-1: device descriptor read/64, error -71
    usb 1-1: device descriptor read/64, error -71
    usb 1-1: new high-speed USB device number 24 using ehci-platform
    usb 1-1: device not accepting address 24, error -71
    usb 1-1: new high-speed USB device number 25 using ehci-platform
    usb 1-1: device not accepting address 25, error -71
    usb usb1-port1: unable to enumerate USB device
    usb 2-1: new full-speed USB device number 6 using ohci-platform
    usb 2-1: not running at top speed; connect to a high speed hub
    usb 2-1: New USB device found, idVendor=058f, idProduct=3841
    usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
    usb 2-1: Product: USB HD Camera audio
    usb 2-1: Manufacturer: AlcorMicroCorp
    uvcvideo: Found UVC 1.00 device USB HD Camera audio (058f:3841)
    input: USB HD Camera audio as /devices/soc/10110000.ohci/usb2/2-1/2-1:1.0/input/input0[/code]
    使用lsusb可以看到摄像头被加载了
    [code]
    /mnt # lsusb
    Bus 002 Device 006: ID 058f:3841
    Bus 001 Device 001: ID 1d6b:0002
    Bus 002 Device 001: ID 1d6b:0001
    /mnt # ls /dev/video0
    /dev/video0
    /mnt #
    [/code]
    然后运行编写v4l2程序,一直抓取不到数据。
    [code]
    /mnt # ./v4l2-video
    Open /dev/video0 successfull

    Driver Name:uvcvideo
    Card Name:USB HD Camera audio
    Bus info:usb-10110000.ohci-1
    Driver Version:3.18.20
    cap.capabilities:84000001

    Start capture 100 frames
    [/code]
  • 展开
    折叠
    2865
    评论
    共 0 个
    内容存在敏感词
      易百纳技术社区暂无数据
    相关资料
    关于作者
    易百纳技术社区
    346793103
    贡献资料 1
    易百纳技术社区 我上传的资料
    登录查看
    我赚取的积分
    登录查看
    我赚取的收益
    登录查看
    上传资料 赚取积分兑换E币
    易百纳技术社区
    删除原因
    广告/SPAM
    恶意灌水
    违规内容
    文不对题
    重复发帖
    置顶时间设置
    结束时间
    举报反馈

    举报类型

    • 内容涉黄/赌/毒
    • 内容侵权/抄袭
    • 政治相关
    • 涉嫌广告
    • 侮辱谩骂
    • 其他

    详细说明

    审核成功

    发布时间设置
    发布时间:
    是否关联周任务-资料模块

    审核失败

    失败原因
    备注
    易百纳技术社区