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]
硬件平台:HI3516CV300
内核版本:linux 3.18.20
SDK版本:Hi3516C_V300R001C01SPC030
问题描述:
想在Hi3516cv上面集成双路摄像头,一路mipi,一路采用USB HOST的方式挂载一个UVC的USB摄像头,在使用V4L2接口采集USB摄像头数据时,发现无法获取到数据。(NOTE:程序在虚拟机下运行可以抓取到USB摄像头数据)
下面我的操作步骤:
1、配置内核,使能USB UVC摄像头
[code]
Device Drivers —>
<*> EHCI HCD (USB 2.0) support
<*> 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 —>
<*>Media USB Adapters —>
<*> USB Video Class (UVC)
<*>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]
展开》
折叠》