第一步:?开启Tina USB HOST功能.
具体开启方法,可参考《Linux_USB_开发指南》文档
第二步:修改测试用例:
打开Tina menuconfig,配置MPP对UVC设备的支持。
?其次配置内核,打开内核对UVC设备的支持.内核选项CONFIG_USB_VIDEO_CLASS,支持UVC设备.
make kernel_menuconfig
?务必保证配置结束后,下列选项打开:
第三步,重新编译整个SDK,最后打包
之后烧录
第四步,编译UVC测试用例,之后adb推入平台端
打开对 framwork的支持:
修改framwork下的tina.mk,增加对sample_USBCamera用例的支持.
编译完成之后,用例和配置文件可以用ADB,也可以直接用磁盘,拷贝到TF卡上。
第五步:打开对USB HOST的支持
方法是控制台中输入以下命令
cat?/sys/devices/platform/soc/usbc0/usb_host
?在插入UVC设备的情况下,输入以上命令,内核会自动探测并加载成功UVC设备,产生新的video设备节点,根据下面的LOG输出可以知道,一开始系统只有内部的/dev/video[0,1,2]三个节点,输入开启USB HOST命令成功后,会出现第四个/dev/video3节点,它就是我们想要的UVC的设备节点。
root@(none):/# cat /sys/devices/platform/soc/usbc0/usb_host
[ 441.096205]
[ 441.096205] rmmod_device_driver
[ 441.096205]
[ 441.103186] android_work: did not send uevent (0 0 (null))
[ 441.109694]
[ 441.109694] insmod_host_driver
[ 441.109694]
[ 441.109702] [ehci0-controller]: sunxi_usb_enable_ehci
[ 441.109717] [sunxi-ehci0]: probe, pdev->name: 5101000.ehci0-controller, sunxi_ehci: 0xc06f3474, 0x:d08e0000, irq_no:12c
[ 441.109779] sunxi-ehci 5101000.ehci0-controller: SW USB2.0 'Enhanced' Host Controller (EHCI) Driver
[ 441.109843] sunxi-ehci 5101000.ehci0-controller: new USB bus registered, assigned bus number 1
[ 441.154834] sunxi-ehci 5101000.ehci0-controller: irq 300, io mem 0xcf44bea7
[ 441.185459] sunxi-ehci 5101000.ehci0-controller: USB 0.0 started, EHCI 1.00
[ 441.194840] hub 1-0:1.0: USB hub found
[ 441.199207] hub 1-0:1.0: 1 port detected
[ 441.204489] [ohci0-controller]: sunxi_usb_enable_ohci
[ 441.210258] [sunxi-ohci0]: probe, pdev->name: 5101000.ohci0-controller, sunxi_ohci: 0xc06f2c24
[ 441.220025] sunxi-ohci 5101000.ohci0-controller: SW USB2.0 'Open' Host Controller (OHCI) Driver
[ 441.229878] sunxi-ohci 5101000.ohci0-controller: new USB bus registered, assigned bus number 2
[ 441.239644] sunxi-ohci 5101000.ohci0-controller: irq 301, io mem 0xced14000
[ 441.320968] hub 2-0:1.0: USB hub found
[ 441.325284] hub 2-0:1.0: 1 port detected
host_chose finished!
root@(none):/#
root@(none):/# ls /dev/video*
/dev/video0 /dev/video1 /dev/video2
root@(none):/# [ 463.366514] sunxi-ehci 5101000.ehci0-controller: ehci_irq: highspeed device connect
[ 463.555691] sunxi-ehci 5101000.ehci0-controller: ehci_irq: highspeed device connect
[ 463.625448] usb 1-1: new high-speed USB device number 2 using sunxi-ehci
[ 464.005448] usb 1-1: device descriptor read/64, error -71
[ 464.205454] sunxi-ehci 5101000.ehci0-controller: ehci_irq: highspeed device disconnect
[ 464.504838] sunxi-ehci 5101000.ehci0-controller: ehci_irq: highspeed device connect
[ 464.513465] sunxi-ehci 5101000.ehci0-controller: ehci_irq: highspeed device disconnect
[ 464.603249] sunxi-ehci 5101000.ehci0-controller: ehci_irq: highspeed device connect
[ 464.865457] sunxi-ehci 5101000.ehci0-controller: ehci_irq: highspeed device disconnect
[ 465.054032] sunxi-ehci 5101000.ehci0-controller: ehci_irq: highspeed device connect
[ 465.305684] sunxi-ehci 5101000.ehci0-controller: ehci_irq: highspeed device disconnect
[ 465.375448] usb 1-1: device descriptor read/64, error -71
[ 465.569827] sunxi-ehci 5101000.ehci0-controller: ehci_irq: highspeed device disconnect
[ 468.198548] sunxi-ehci 5101000.ehci0-controller: ehci_irq: highspeed device connect
[ 468.395452] sunxi-ehci 5101000.ehci0-controller: ehci_irq: highspeed device disconnect
[ 468.450194] sunxi-ehci 5101000.ehci0-controller: ehci_irq: highspeed device connect
[ 468.458807] sunxi-ehci 5101000.ehci0-controller: ehci_irq: highspeed device disconnect
root@(none):/#
root@(none):/# [A[[ 485.499793] sunxi-ehci 5101000.ehci0-controller: ehci_irq: highspeed device connect
[ 485.765446] usb 1-1: new high-speed USB device number 5 using sunxi-ehci
[ 485.956660] usb 1-1: config 1 interface 0 altsetting 0 endpoint 0x83 has an invalid bInterval 32, changing to 9
[ 485.970307] uvcvideo: Found UVC 1.00 device GENERAL WEBCAM (1b3f:2247)
[ 485.979750] uvcvideo: UVC non compliance - GET_DEF(PROBE) not supported. Enabling workaround.
[ 485.990154] uvcvideo 1-1:1.0: Entity type for entity Extension 7 was not initialized!
[ 485.999057] uvcvideo 1-1:1.0: Entity type for entity Extension 6 was not initialized!
[ 486.007894] uvcvideo 1-1:1.0: Entity type for entity Processing 5 was not initialized!
[ 486.016836] uvcvideo 1-1:1.0: Entity type for entity Camera 1 was not initialized!
[ 486.026177] input: GENERAL WEBCAM as /devices/platform/soc/5101000.ehci0-controller/usb1/1-1/1-1:1.0/input/input2
[ 487.078609] sunxi-ehci 5101000.ehci0-controller: ehci_irq: highspeed device disconnect
[ 487.087527] sunxi-ehci 5101000.ehci0-controller: ehci_irq: highspeed device connect
[ 487.096293] usb 1-1: USB disconnect, device number 5
[ 487.425609] sunxi-ehci 5101000.ehci0-controller: ehci_irq: highspeed device connect
[ 487.495450] usb 1-1: new high-speed USB device number 6 using sunxi-ehci
[ 487.805453] sunxi-ehci 5101000.ehci0-controller: ehci_irq: highspeed device disconnect
[ 488.275444] usb 2-1: new full-speed USB device number 2 using sunxi-ohci
[ 488.528493] usb 2-1: not running at top speed; connect to a high speed hub
[ 488.539514] usb 2-1: config 1 interface 1 altsetting 3 endpoint 0x85 has invalid maxpacket 1024, setting to 1023
[ 488.551003] usb 2-1: config 1 interface 1 altsetting 4 endpoint 0x85 has invalid maxpacket 2816, setting to 1023
[ 488.562470] usb 2-1: config 1 interface 1 altsetting 5 endpoint 0x85 has invalid maxpacket 3072, setting to 1023
[ 488.573926] usb 2-1: config 1 interface 1 altsetting 6 endpoint 0x85 has invalid maxpacket 4948, setting to 1023
[ 488.585387] usb 2-1: config 1 interface 1 altsetting 7 endpoint 0x85 has invalid maxpacket 5120, setting to 1023
[ 488.605772] uvcvideo: Found UVC 1.00 device GENERAL WEBCAM (1b3f:2247)
[ 488.615490] uvcvideo: UVC non compliance - GET_DEF(PROBE) not supported. Enabling workaround.
[ 488.625974] uvcvideo 2-1:1.0: Entity type for entity Extension 7 was not initialized!
[ 488.634837] uvcvideo 2-1:1.0: Entity type for entity Extension 6 was not initialized!
[ 488.643686] uvcvideo 2-1:1.0: Entity type for entity Processing 5 was not initialized!
[ 488.652629] uvcvideo 2-1:1.0: Entity type for entity Camera 1 was not initialized!
[ 488.661935] input: GENERAL WEBCAM as /devices/platform/soc/5101000.ohci0-controller/usb2/2-1/2-1:1.0/input/input3
root@(none):/#
root@(none):/#
root@(none):/#
root@(none):/# ls /dev/video*
/dev/video0 /dev/video1 /dev/video2 /dev/video3
root@(none):/#
第六步:测试验证:
首先执行命令挂载卡
mount -t vfat /dev/mmcblk0p1 /mnt/extsd
之后进入卡目录,输入以下命令验证测试用例
./sample_USBCamera -path ./sample_USBCamera.conf
结束!
|