Debian下使用芯片为ZC0301 WebCam的摄像头
http://blog.chinaunix.net/u/7667/showart_74010.html
我的摄像头型号是嘉华星2008+DM,操作系统Debian sid,内核版本 2.6.12,设置完成后可以使用gnomemeeting和kopete等工具查看到视频。
使用uname -a查看系统版本
sh-3.1$ uname -a
Linux blueice 2.6.12-1-k7-smp #1 SMP Tue Sep 27 13:37:32 JST 2005 i686 GNU/Linux
使用插好摄像头后使用lsusb可以查看摄像头的信息
sh-3.1$ lsusb
Bus 005 Device 001: ID 0000:0000
Bus 004 Device 001: ID 0000:0000
Bus 003 Device 002: ID 0ac8:301b Z-Star Microelectronics Corp. ZC0301 WebCam
Bus 003 Device 001: ID 0000:0000
Bus 002 Device 001: ID 0000:0000
Bus 001 Device 001: ID 0000:0000
安装软件包spca5xx-source
sh-3.1$ sudo wajig install spca5xx-source
Reading package lists... Done
Building dependency tree... Done
The following extra packages will be installed:
build-essential module-assistant
Suggested packages:
dialog
The following NEW packages will be installed
build-essential module-assistant spca5xx-source
0 upgraded, 3 newly installed, 0 to remove and 195 not upgraded.
Need to get 269kB of archives.
After unpacking 618kB of additional disk space will be used.
Do you want to continue [Y/n]?
Get: 1 http://debian.ustc.edu.cn sid/main build-essential 11.2 [6916B]
Get: 2 http://debian.ustc.edu.cn sid/main module-assistant 0.10.2 [72.2kB]
Get: 3 http://debian.ustc.edu.cn sid/main spca5xx-source 20060101-2 [190kB]
Fetched 269kB in 27s (9855B/s)
Selecting previously deselected package build-essential.
(Reading database ... 194256 files and directories currently installed.)
Unpacking build-essential (from .../build-essential_11.2_i386.deb) ...
Selecting previously deselected package module-assistant.
Unpacking module-assistant (from .../module-assistant_0.10.2_all.deb) ...
Selecting previously deselected package spca5xx-source.
Unpacking spca5xx-source (from .../spca5xx-source_20060101-2_all.deb) ...
Setting up build-essential (11.2) ...
Setting up module-assistant (0.10.2) ...
Setting up spca5xx-source (20060101-2) ...
sh-3.1$ 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/README.gz
/usr/share/doc/spca5xx-source/changelog.Debian.gz
/usr/share/doc/spca5xx-source/changelog.gz
/usr/share/modass
/usr/share/modass/overrides
/usr/share/modass/overrides/spca5xx-source
编译spca5xx-source
blueice:~# cd /usr/src/
blueice:/usr/src# ls
fglrx.tar.bz2 linux-2.6.11.tar.bz2 linux-headers-2.6.12-1 linux-source-2.6.12.tar.bz2
kernel-headers-2.6.11-1 linux-2.6.12.tar.bz2 linux-headers-2.6.12-1-k7-smp modules
kernel-headers-2.6.11-1-k7-smp linux-2.6.13 linux-headers-2.6.14-2 rpm
kernel-headers-2.6.8-2 linux-2.6.13.tar.bz2 linux-headers-2.6.14-2-k7-smp spca5xx-source.tar.bz2
kernel-headers-2.6.8-2-386 linux-2.6.14 linux-headers-2.6.15-1
kernel-image-2.6.12_10.00.Custom_i386.deb linux-2.6.14_2.6.14_i386.deb linux-headers-2.6.15-1-k7-smp
kernel-kbuild-2.6-3 linux-2.6.14.tar.bz2 linux-source-2.6.12
blueice:/usr/src# tar jxvf spca5xx-source.tar.bz2
modules/
modules/spca5xx/
modules/spca5xx/debian/
modules/spca5xx/debian/rules
modules/spca5xx/debian/control.modules.in
modules/spca5xx/debian/postinst.modules.in
modules/spca5xx/debian/control
modules/spca5xx/debian/compat
modules/spca5xx/debian/copyright
modules/spca5xx/debian/changelog
modules/spca5xx/cutlog.py
modules/spca5xx/INSTALL
modules/spca5xx/README-TV8532
modules/spca5xx/CHANGELOG
modules/spca5xx/RGB-YUV%2fmodule-setting
modules/spca5xx/README-SONIX
modules/spca5xx/Makefile
modules/spca5xx/README
modules/spca5xx/drivers/
modules/spca5xx/drivers/usb/
modules/spca5xx/drivers/usb/spcaCompat.h
modules/spca5xx/drivers/usb/spca5xx.h
modules/spca5xx/drivers/usb/pac207.h
modules/spca5xx/drivers/usb/spca500_init.h
modules/spca5xx/drivers/usb/spcausb.h
modules/spca5xx/drivers/usb/sonix.h
modules/spca5xx/drivers/usb/cxlib.h
modules/spca5xx/drivers/usb/tas5130c.h
modules/spca5xx/drivers/usb/spca508_init.h
modules/spca5xx/drivers/usb/sp5xxfw2.h
modules/spca5xx/drivers/usb/spcadecoder.c
modules/spca5xx/drivers/usb/pb0330.h
modules/spca5xx/drivers/usb/cs2102.h
modules/spca5xx/drivers/usb/dummy_cam.h
modules/spca5xx/drivers/usb/cx11646.h
modules/spca5xx/drivers/usb/pas106b.h
modules/spca5xx/drivers/usb/spcadecoder.h
modules/spca5xx/drivers/usb/sn9cxxx.h
modules/spca5xx/drivers/usb/hdcs2020.h
modules/spca5xx/drivers/usb/spcagamma.h
modules/spca5xx/drivers/usb/hv7131b.h
modules/spca5xx/drivers/usb/hv7131c.h
modules/spca5xx/drivers/usb/jpeg_header.h
modules/spca5xx/drivers/usb/spca501_init.h
modules/spca5xx/drivers/usb/icm105a.h
modules/spca5xx/drivers/usb/jpeg_qtables.h
modules/spca5xx/drivers/usb/spca505_init.h
modules/spca5xx/drivers/usb/et61xx51.h
modules/spca5xx/drivers/usb/tv8532.h
modules/spca5xx/drivers/usb/zc3xx.h
modules/spca5xx/drivers/usb/spca506.h
modules/spca5xx/drivers/usb/spca561.h
modules/spca5xx/drivers/usb/mr97311.h
modules/spca5xx/drivers/usb/spca5xx.c
modules/spca5xx/drivers/usb/sp5xxfw2.dat
blueice:/usr/src# cd modules/
blueice:/usr/src/modules# ls
fglrx spca5xx
blueice:/usr/src/modules# cd spca5xx/
blueice:/usr/src/modules/spca5xx# ls
CHANGELOG cutlog.py debian drivers INSTALL Makefile README README-SONIX README-TV8532 RGB-YUV%2fmodule-setting
blueice:/usr/src/modules/spca5xx# ls -al
total 108
drwxr-xr-x 4 root root 4096 2006-02-07 23:39 .
drwxr-xr-x 4 root root 4096 2006-02-07 23:39 ..
-rw-r--r-- 1 root root 44666 2006-01-13 09:14 CHANGELOG
-rwxr-xr-x 1 root root 372 2005-09-24 15:31 cutlog.py
drwxr-xr-x 2 root root 4096 2006-02-07 23:39 debian
drwxr-xr-x 3 root root 4096 2006-02-07 23:39 drivers
-rwxr-xr-x 1 root root 947 2005-11-01 09:01 INSTALL
-rw-r--r-- 1 root root 7192 2006-01-13 09:14 Makefile
-rwxr-xr-x 1 root root 20375 2006-01-13 09:14 README
-rwxr-xr-x 1 root root 478 2005-11-01 09:01 README-SONIX
-rwxr-xr-x 1 root root 513 2006-01-13 09:14 README-TV8532
-rwxr-xr-x 1 root root 828 2005-11-01 09:01 RGB-YUV%2fmodule-setting
blueice:/usr/src/modules/spca5xx# more INSTALL
Module compile outside the kernel tree but need the source of your running
kernel installed and configured.
be sure your kernel include usb and v4l stuff
Kernel 2.4.x
configure your kernel
make dep
go to the spca5xx directories
make clean (to be sure)
make
if all goes right as root :
make install
Kernel 2.6.x
make clean
make
if all goes right as root :
make install
To test please use the command line spcaview you need libsdl installed with the
header from your distro or goto http:www.libsdl.org
plug the cam
as root
lsmod
spca5xx should be load with videodev, if not somethings goes wrong,
verify that your cam is supported if not and you are sure for a Sunplus
chip goto irc.freenode.net channel #spca50x and ask for help
if yes run spcaview with this parameters (maybe read the readme is the
best)
spcaview -f yuv
if you have a bttv card use the -d parameters to change the video
setting
that should work
Enjoy !!
blueice:/usr/src/modules/spca5xx# make clean
rm -r -f drivers/usb/*.o drivers/usb/.spcadecoder.o.cmd \
drivers/usb/.spca5xx.o.cmd *.o *.ko *.mod.* .[a-z]* core *.i
blueice:/usr/src/modules/spca5xx# make
Building SPCA5XX driver for 2.5/2.6 kernel.
Remember: you must have read/write access to your kernel source tree.
make -C /lib/modules/`uname -r`/build SUBDIRS=/usr/src/modules/spca5xx CC=cc modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.12-1-k7-smp'
CC [M] /usr/src/modules/spca5xx/drivers/usb/spca5xx.o
/usr/src/modules/spca5xx/drivers/usb/spca5xx.c: In function 'spca50x_configure':
/usr/src/modules/spca5xx/drivers/usb/spca5xx.c:5390: warning: 'defaultpipe' may be used uninitialized in this function
/usr/src/modules/spca5xx/drivers/usb/spca5xx.c:5389: warning: 'defaultrows' may be used uninitialized in this function
/usr/src/modules/spca5xx/drivers/usb/spca5xx.c:5388: warning: 'defaultcols' may be used uninitialized in this function
CC [M] /usr/src/modules/spca5xx/drivers/usb/spcadecoder.o
/usr/src/modules/spca5xx/drivers/usb/spcadecoder.c: In function 'make_jpeg':
/usr/src/modules/spca5xx/drivers/usb/spcadecoder.c:3993: warning: ISO C90 forbids mixed declarations and code
LD [M] /usr/src/modules/spca5xx/spca5xx.o
Building modules, stage 2.
MODPOST
CC /usr/src/modules/spca5xx/spca5xx.mod.o
LD [M] /usr/src/modules/spca5xx/spca5xx.ko
make[1]: Leaving directory `/usr/src/linux-headers-2.6.12-1-k7-smp'
blueice:/usr/src/modules/spca5xx# make install
mkdir -p /lib/modules/`uname -r`/kernel/drivers/usb/media/
rm -f /lib/modules/`uname -r`/kernel/drivers/usb/media/spca50x.ko
rm -f /lib/modules/`uname -r`/kernel/drivers/usb/media/et61x.ko
install -c -m 0644 spca5xx.ko /lib/modules/`uname -r`/kernel/drivers/usb/media/
/sbin/depmod -ae
装载模块
blueice:/usr/src/modules/spca5xx# modprobe spca5xx
blueice:/usr/src/modules/spca5xx# lsmod|grep sp
spca5xx 689872 0
videodev 10176 1 spca5xx
usbcore 125564 4 spca5xx,ehci_hcd,uhci_hcd
pcspkr 4104 0
我测试了gnomemeeting,kopete(msn视频聊天),和camorama,均可以正常使用摄像头。camorama可以直接制作图片。
更多信息请参考
Linux 中使用中星微 301 芯片的摄像头
http://mxhaard.free.fr/download.html
http://www.qbik.ch/usb/devices/showdev.php?id=1953
camorama运行时的图片
camorama拍摄的图片