页次: 1
UVC的实现主要是参考SDK中《外围设备驱动 操作指南.pdf》的2.3.8章节,按照步骤提示操作应该很顺利能实现,发个帖子记录一下实现过程。
文档中主要提到了几个驱动模块,这5个模块在Linux内核中编译实现:
libcomposite.ko
usb_f_uvc.ko
u_audio.ko
usb_f_uac1.ko
usb_f_uac2.ko
1.首先进入Linux内核顶层目录,复制.config文件:
$ cd dopi/linux
$ cp arch/arm/configs/hi3516ev200_dopi_defconfig .config
2.进入menuconfig菜单,勾选几项配置:
$ make ARCH=arm CROSS_COMPILE=arm-himix100-linux- menuconfig
PHY选项:
Device Drivers ->
PHY Subsystem ->
音频驱动选项:
Device Drivers ->
<*> Sound card support ->
<*> Advanced Linux Sound Architecture ->
<*> USB sound devices ->
USB Gadget选项:
Device Drivers ->
<*> USB support ->
<*> USB Gadget Support ->
退出并保存.config配置文件
编译内核:
$ make ARCH=arm CROSS_COMPILE=arm-himix100-linux- uImage
内核编译完成后,编译module模块:
$ make ARCH=arm CROSS_COMPILE=arm-himix100-linux- modules
完成后模块路径分别为:
drivers/usb/gadget/libcomposite.ko
drivers/usb/gadget/function/usb_f_uac2.ko
drivers/usb/gadget/function/usb_f_uac1.ko
drivers/usb/gadget/function/usb_f_uvc.ko
drivers/usb/gadget/function/u_audio.ko
把以上模块复制到板子文件目录/root/uvc_app下
1.解压SDK包里面的mpp.tgz
$ cd Hi3516EV200_SDK_V1.0.1.0/package/
$ tar -vxzf mpp.tgz
$ cd mpp/
2.修改camera配置(针对使用gc2053摄像头,imx307可跳过)
$ cd sample
$ vim Makefile.param
修改
SENSOR0_TYPE = GALAXYCORE_GC2053_MIPI_2M_30FPS_10BIT
3.编译uvc_app应用程序
$ cd sample/uvc_app/
$ make
编译完成后生成uvc_app和uvc_app.conf文件,把这两个文件也复制到板子的/root/uvc_app文件夹里。
在SDK包中进入目录Hi3516EV200R001C01SPC010/01.software/pc/usb_tools
解压usb_tools_linux.rar
把ConfigUVC.sh和Disable_UVC.sh复制到板子目录/root/uvc_app下
$ vi /etc/init.d/rcS
#! /bin/sh
/bin/mount -a
echo "
_ _ _ _ _ _ _ _ _ _ _ _
\ _ _ _ _ _ ___
/ /__/ \ |_/
/ __ / - _ ___
/ / / / / /
_ _ _ _/ / / \_/ \_ ______
___________\___\__________________
"
for initscript in /etc/init.d/S[0-9][0-9]*
do
if [ -x $initscript ] ;
then
echo "[RCS]: $initscript"
$initscript
fi
done
hostname -F /etc/hostname
# ifconfig eth0 192.168.117.2 up
# route add default gw 192.168.117.1
cd /root/uvc_app
insmod libcomposite.ko
insmod usb_f_uvc.ko
insmod u_audio.ko
insmod usb_f_uac1.ko
insmod usb_f_uac2.ko
export VID="0x12d1"
export PID="0x4321"
export MANUFACTURER="Huawei"
export PRODUCT="HiCamera"
export SERIALNUMBER="12345678"
export YUV="360p"
export MJPEG="360p 720p 1080p"
export H264="360p 720p 1080p"
./ConfigUVC.sh
cd /ko
insmod g_ether.ko
/ko/load3516ev200 -i -sensor gc2053
#mkdir -p /root/app
#mount -t tmpfs -o size=5M app /root/app
#tar zxf /root/app.tgz -C /root/app/
/bin/stupid-ftpd
telnetd
ifconfig usb0 192.168.137.25 up
route add default gw 192.168.137.1
# sed -i "5c bind_address = \"192.168.137.25\"" /etc/config.hcl
# /bin/mDNS --config /etc/config.hcl >/dev/null 2>&1 &
# /root/display.sh
# cat /root/rgb.565 >/dev/fb0
#cd /root
#/root/wifi.sh
#/root/dopi_rtsp
cd /root/uvc_app
./uvc_app &
1.新编译的内核固件烧录到板子上
2.USB接入电脑重启板子,电脑设备列表会出现UVC Camera设备
打开ECap软件(或者其他类似软件),可获取到板子采集的图形
页次: 1