插入USB摄像头
$ dmesg
Linux video capture interface: v2.00
zc0301: V4L2 driver for ZC0301[P] Image Processor and Control Chip v1:1.05
usb 1-2: ZC0301[P] Image Processor and Control Chip detected (vid/pid 0x0AC8/0x301B)
usb 1-2: No supported image sensor detected
usbcore: registered new driver zc0301
$ lsusb
Bus 001 Device 005: ID 0ac8:301b Z-Star Microelectronics Corp. ZC0301 WebCam
Bus 001 Device 004: ID 0bda:8150 Realtek Semiconductor Corp. RTL8150 Fast Ethernet Adapter
Bus 001 Device 002: ID 0ace:1215 ZyDAS
Bus 001 Device 001: ID 0000:0000
ZC0301 WebCam就是我们USB摄像头的芯片,内核是有驱动支持的。
drivers/media/video/zc0301/, 支持V4L2.
$ apt-get install spca5xx-source
[确认源:
deb http://debian.cn99.com/debian etch main contrib non-free
deb-src http://debian.cn99.com/debian etch main contrib non-free
]
看看源码放在哪里拉
$ dpkg -L spca5xx-source
/.
/usr
/usr/src
/usr/src/spca5xx-source.tar.bz2
/usr/share
/usr/share/doc
/usr/share/doc/spca5xx-source
/usr/share/doc/spca5xx-source/README-SONIX
/usr/share/doc/spca5xx-source/README-TV8532
/usr/share/doc/spca5xx-source/RGB-YUV%2fmodule-setting
/usr/share/doc/spca5xx-source/README.Debian
/usr/share/doc/spca5xx-source/copyright
/usr/share/doc/spca5xx-source/changelog.gz
/usr/share/doc/spca5xx-source/README.gz
/usr/share/doc/spca5xx-source/changelog.Debian.gz
/usr/share/modass
/usr/share/modass/overrides
/usr/share/modass/overrides/spca5xx-source
$ cd /usr/src
$ tar jxf spca5xx-source.tar.bz2
$ cd modules/spca5xx/
参考INSTALL文件
$ make clean
$ make
$ make install
加载模块
$ modprobe spca5xx
$ lsmod | grep sp
spca5xx 642544 0
videodev 21120 2 spca5xx,zc0301
pcspkr 3072 0
usbcore 112644 7 spca5xx,zc0301,zd1211b,rtl8150,usbhid,ohci_hcd
[pcspkr是在modprobe之前原来就有的]
这个时候/dev/video0就建好了。
安装一个应用程序
$ apt-get install camorama
运行camorama,就可以看到了。
另外: 换另一个摄像头(芯片sn9c101),因为装过了spca驱动,所以这次可以直接用了。
下面是插拔时dmesg的信息。
usb 1-2: new full speed USB device using ohci_hcd and address 4
usb 1-2: configuration #1 chosen from 1 choice
Linux video capture interface: v2.00
/usr/src/modules/spca5xx/drivers/usb/spca5xx.c: USB SPCA5XX camera found. SONIX sn9c101 +Tas 5110
/usr/src/modules/spca5xx/drivers/usb/spca5xx.c: [spca5xx_probe:5480] Camera type SN9C
/usr/src/modules/spca5xx/drivers/usb/spca5xx.c: [spca5xx_getcapability:1765] maxw 352 maxh 288 minw 160 minh 120
usbcore: registered new driver spca5xx
/usr/src/modules/spca5xx/drivers/usb/spca5xx.c: spca5xx driver 00.60.00 registered
sn9c102: V4L2 driver for SN9C10x PC Camera Controllers v1:1.27
usbcore: registered new driver sn9c102
usb 1-2: USB disconnect, address 4