346793103

346793103

0个粉丝

6

问答

0

专栏

1

资料

346793103  发布于  2019-08-01 12:51:39
采纳率 0%
6个问答
3139

hi3516cv300 USB HOST 适配UVC摄像头

 
本帖最后由 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]
  • 易百纳技术社区文件: v4l2-video2.rar
    下载
    我来回答
    回答12个
    时间排序
    认可量排序

    lishiqi

    0个粉丝

    19

    问答

    0

    专栏

    0

    资料

    lishiqi 2019-08-02 10:31:50
    认可0
    正常情況是不需要添加vid pid的,看你的日志是枚舉有問題,現在usb camera 都是免驅的(uvc),實在不行的可以移植libusb+libuvc,这样就可以不用内核的uvc了。

    346793103

    0个粉丝

    6

    问答

    0

    专栏

    1

    资料

    346793103 2019-08-02 17:54:35
    认可0
    [quote][url=forum.php?mod=redirect&goto=findpost&pid=146092&ptid=75348]lishiqi 发表于 2019-8-2 10:31[/url]
    正常情況是不需要添加vid pid的,看你的日志是枚舉有問題,現在usb camera 都是免驅的(uvc),實在不行的可 ...[/quote]

    无法操作,安装好libuvc和相关的依赖,使用测试代码,找不到设备,在uvc_find_device的时候出现断错误。

    346793103

    0个粉丝

    6

    问答

    0

    专栏

    1

    资料

    346793103 2019-08-03 11:33:32
    认可0
    [quote][url=forum.php?mod=redirect&goto=findpost&pid=146092&ptid=75348]lishiqi 发表于 2019-8-2 10:31[/url]
    正常情況是不需要添加vid pid的,看你的日志是枚舉有問題,現在usb camera 都是免驅的(uvc),實在不行的可 ...[/quote]

    libusb+libuvc的方式一样读取不到数据流,

    lishiqi

    0个粉丝

    19

    问答

    0

    专栏

    0

    资料

    lishiqi 2019-08-05 09:42:11
    认可0
    [quote][url=forum.php?mod=redirect&goto=findpost&pid=146154&ptid=75348]346793103 发表于 2019-8-3 11:33[/url]
    libusb+libuvc的方式一样读取不到数据流,[/quote]

    有没换一个usb camera 试一下,嵌入式上面usb camera支持不是很好的,在3536上面支持我的usb camera都支持的,但是在3519a支持就很差的,这个跟底层的USB 驱动有关!

    346793103

    0个粉丝

    6

    问答

    0

    专栏

    1

    资料

    346793103 2019-08-05 22:41:09
    认可0
    本帖最后由 346793103 于 2019-8-5 22:43 编辑

    [quote][url=forum.php?mod=redirect&goto=findpost&pid=146184&ptid=75348]lishiqi 发表于 2019-8-5 09:42[/url]
    有没换一个usb camera 试一下,嵌入式上面usb camera支持不是很好的,在3536上面支持我的usb camera都支 ...[/quote]

    没有用,应该是驱动的问题,在获取视频流的时候,USB还处于ISO模式,没有在bluk模式。

    lishiqi

    0个粉丝

    19

    问答

    0

    专栏

    0

    资料

    lishiqi 2019-08-06 11:18:28
    认可0
    [quote][url=forum.php?mod=redirect&goto=findpost&pid=146234&ptid=75348]346793103 发表于 2019-8-5 22:41[/url]
    没有用,应该是驱动的问题,在获取视频流的时候,USB还处于ISO模式,没有在bluk模式。[/quote]

    嗯 这样的话是带宽严重不够,有没有试过jpeg去采?

    346793103

    0个粉丝

    6

    问答

    0

    专栏

    1

    资料

    346793103 2019-08-06 17:48:42
    认可0
    [quote][url=forum.php?mod=redirect&goto=findpost&pid=146249&ptid=75348]lishiqi 发表于 2019-8-6 11:18[/url]
    嗯 这样的话是带宽严重不够,有没有试过jpeg去采?[/quote]

    也试过的,带宽不够的话,为什么gadget能使用?

    qn1510837625

    0个粉丝

    11

    问答

    8

    专栏

    26

    资料

    qn1510837625 2019-08-06 20:53:38
    认可0
    赞,找时间搞个板子玩一下

    rafael_wl

    0个粉丝

    12

    问答

    0

    专栏

    7

    资料

    rafael_wl 2019-08-07 10:39:15
    认可0
    怎么把海思的这个芯片搞成 UVC的摄像头?

    346793103

    0个粉丝

    6

    问答

    0

    专栏

    1

    资料

    346793103 2019-08-09 13:13:21
    认可0
    [quote][url=forum.php?mod=redirect&goto=findpost&pid=146287&ptid=75348]rafael_wl 发表于 2019-8-7 10:39[/url]
    怎么把海思的这个芯片搞成 UVC的摄像头?[/quote]

    不是UVC摄像头,USB接海思3516cv300的HOST接口采集USB摄像头数据

    qn1543394364

    0个粉丝

    11

    问答

    0

    专栏

    0

    资料

    qn1543394364 2019-12-25 16:39:47
    认可0
    楼主请问你现在解决了不?

    346793103

    0个粉丝

    6

    问答

    0

    专栏

    1

    资料

    346793103 2019-08-08 23:18:03
    认可0
    [quote][url=forum.php?mod=redirect&goto=findpost&pid=146287&ptid=75348]rafael_wl 发表于 2019-8-7 10:39[/url]
    怎么把海思的这个芯片搞成 UVC的摄像头?[/quote]

    我这是通过海思芯片通过USB读取摄像头数据
    或将文件直接拖到这里
    悬赏:
    E币
    网盘
    * 网盘链接:
    * 提取码:
    悬赏:
    E币

    Markdown 语法

    • 加粗**内容**
    • 斜体*内容*
    • 删除线~~内容~~
    • 引用> 引用内容
    • 代码`代码`
    • 代码块```编程语言↵代码```
    • 链接[链接标题](url)
    • 无序列表- 内容
    • 有序列表1. 内容
    • 缩进内容
    • 图片![alt](url)
    + 添加网盘链接/附件

    Markdown 语法

    • 加粗**内容**
    • 斜体*内容*
    • 删除线~~内容~~
    • 引用> 引用内容
    • 代码`代码`
    • 代码块```编程语言↵代码```
    • 链接[链接标题](url)
    • 无序列表- 内容
    • 有序列表1. 内容
    • 缩进内容
    • 图片![alt](url)
    相关问答
    无更多相似问答 去提问
    举报反馈

    举报类型

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

    详细说明

    易百纳技术社区