FreeBSD Webcam:传送门
1 查看摄像头USB驱动
CMD
ls /dev/v*
Result
/dev/vcs /dev/vcs4 /dev/vcsa1 /dev/vcsa5 /dev/vhost-net
/dev/vcs1 /dev/vcs5 /dev/vcsa2 /dev/vcsa6 /dev/vhost-vsock
/dev/vcs2 /dev/vcs6 /dev/vcsa3 /dev/vga_arbiter /dev/video0
/dev/vcs3 /dev/vcsa /dev/vcsa4 /dev/vhci
/dev/v4l:
by-id by-path
/dev/vfio:
vfio
Analysis
输入命令后,出现的结果里含有/dev/video0说明USB摄像头驱动安装成功,Ubuntu18.0以自动安装了USB摄像头驱动.
/dev/video0
2 查看USB信息
2.1 摄像头ID
CMD
lsusb
Result
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 0ac8:3420 Z-Star Microelectronics Corp. Venus USB2.0 Camera
Bus 001 Device 002: ID 17ef:6019 Lenovo
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Analysis
由第二行信息Device 003:ID 3240可知摄像头ID为3240.
2.2 查看设备名称
CMD
cd /dev
dmesg | grep video
Result
[ 22.137377] Linux video capture interface: v2.00
[ 27.358749] uvcvideo: Found UVC 1.00 device A4tech USB2.0 Camera (0ac8:3420)
[ 27.360265] uvcvideo 1-5:1.0: Entity type for entity Processing 2 was not initialized!
[ 27.360267] uvcvideo 1-5:1.0: Entity type for entity Camera 1 was not initialized!
[ 27.360268] uvcvideo 1-5:1.0: Entity type for entity Extension 4 was not initialized!
[ 27.360442] usbcore: registered new interface driver uvcvideo
Analysis
第二行信息Found UVC,可知摄像头使用UVC协议.
2.3 查看摄像头协议
cd /dev
sudo cat /sys/kernel/debug/usb/devices
Result
T: Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=480 MxCh=12
B: Alloc= 0/800 us ( 0%), #Int= 0, #Iso= 0
D: Ver= 2.00 Cls=09(hub ) Sub=00 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=1d6b ProdID=0002 Rev= 4.15
S: Manufacturer=Linux 4.15.0-43-generic xhci-hcd
S: Product=xHCI Host Controller
S: SerialNumber=0000:00:14.0
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr= 0mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub
E: Ad=81(I) Atr=03(Int.) MxPS= 4 Ivl=256ms
T: Bus=01 Lev=01 Prnt=01 Port=03 Cnt=01 Dev#= 2 Spd=1.5 MxCh= 0
D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
P: Vendor=17ef ProdID=6019 Rev= 1.00
S: Manufacturer=PixArt
S: Product=Lenovo USB Optical Mouse
C:* #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr=100mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=01 Prot=02 Driver=usbhid
E: Ad=81(I) Atr=03(Int.) MxPS= 8 Ivl=10ms
T: Bus=01 Lev=01 Prnt=01 Port=04 Cnt=02 Dev#= 3 Spd=480 MxCh= 0
D: Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=0ac8 ProdID=3420 Rev= 1.fa
S: Manufacturer=Vimicro Corp.
S: Product=A4tech USB2.0 Camera
C:* #Ifs= 4 Cfg#= 1 Atr=80 MxPwr=320mA
A: FirstIf#= 0 IfCount= 2 Cls=0e(video) Sub=03 Prot=00
A: FirstIf#= 2 IfCount= 2 Cls=01(audio) Sub=02 Prot=00
I:* If#= 0 Alt= 0 #EPs= 1 Cls=0e(video) Sub=01 Prot=00 Driver=uvcvideo
E: Ad=81(I) Atr=03(Int.) MxPS= 10 Ivl=2ms
I:* If#= 1 Alt= 0 #EPs= 0 Cls=0e(video) Sub=02 Prot=00 Driver=uvcvideo
I: If#= 1 Alt= 1 #EPs= 1 Cls=0e(video) Sub=02 Prot=00 Driver=uvcvideo
E: Ad=82(I) Atr=05(Isoc) MxPS= 128 Ivl=125us
I: If#= 1 Alt= 2 #EPs= 1 Cls=0e(video) Sub=02 Prot=00 Driver=uvcvideo
E: Ad=82(I) Atr=05(Isoc) MxPS= 512 Ivl=125us
I: If#= 1 Alt= 3 #EPs= 1 Cls=0e(video) Sub=02 Prot=00 Driver=uvcvideo
E: Ad=82(I) Atr=05(Isoc) MxPS=1024 Ivl=125us
I: If#= 1 Alt= 4 #EPs= 1 Cls=0e(video) Sub=02 Prot=00 Driver=uvcvideo
E: Ad=82(I) Atr=05(Isoc) MxPS=1536 Ivl=125us
I: If#= 1 Alt= 5 #EPs= 1 Cls=0e(video) Sub=02 Prot=00 Driver=uvcvideo
E: Ad=82(I) Atr=05(Isoc) MxPS=2048 Ivl=125us
I: If#= 1 Alt= 6 #EPs= 1 Cls=0e(video) Sub=02 Prot=00 Driver=uvcvideo
E: Ad=82(I) Atr=05(Isoc) MxPS=2688 Ivl=125us
I: If#= 1 Alt= 7 #EPs= 1 Cls=0e(video) Sub=02 Prot=00 Driver=uvcvideo
E: Ad=82(I) Atr=05(Isoc) MxPS=3072 Ivl=125us
I:* If#= 2 Alt= 0 #EPs= 0 Cls=01(audio) Sub=01 Prot=00 Driver=snd-usb-audio
I:* If#= 3 Alt= 0 #EPs= 0 Cls=01(audio) Sub=02 Prot=00 Driver=snd-usb-audio
I: If#= 3 Alt= 1 #EPs= 1 Cls=01(audio) Sub=02 Prot=00 Driver=snd-usb-audio
E: Ad=83(I) Atr=01(Isoc) MxPS= 98 Ivl=1ms
T: Bus=02 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=5000 MxCh= 6
B: Alloc= 0/800 us ( 0%), #Int= 0, #Iso= 0
D: Ver= 3.00 Cls=09(hub ) Sub=00 Prot=03 MxPS= 9 #Cfgs= 1
P: Vendor=1d6b ProdID=0003 Rev= 4.15
S: Manufacturer=Linux 4.15.0-43-generic xhci-hcd
S: Product=xHCI Host Controller
S: SerialNumber=0000:00:14.0
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr= 0mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub
E: Ad=81(I) Atr=03(Int.) MxPS= 4 Ivl=256ms
Analysis
由信息P: Vendor=0ac8 ProdID=3420 Rev= 1.fa知此信息(ProdID=3240)为摄像头信息.
3 捕捉视频
3.1 camorama软件
安装
sudo apt-get install camorama
启动
camorama
camorama界面:
图3.1 Camorama视频捕捉软件
3.2 cheese视频捕捉软件
安装
sudo apt-get install cheese
启动
cheese
Cheese软件界面:
图3.2 Cheese视频捕捉软件
# 4 总结
- Ubuntu使用USB摄像头,需安装USB驱动;
- 注意查看摄像头使用的协议;