2007/09/23

Fedora 7 上安裝 V-Gear的WebCam: Live TalkCam

前一陣子買了便宜的webcam:
V-Gear TalkCam Live激
V-Gear 拍拍看 Live激
http://v-gear.com.tw/products/intro.asp?CATEGORY1_ID=D01&CATENAME=WebCam+%BA%F4%B8%F4%C4%E1%BCv%BE%F7&PROD_ID=AMVG1-010-063-02-G
http://buy.yahoo.com.tw/gdsale/gdsale.asp?gdid=422433

參考了這篇:
How To Set Up A Debian Linux WebCam Server Using a USB Web Cam
http://www.aboutdebian.com/webcam.htm

想在Fedora 7 上跑webcam,
無法馬上抓到該設備,
參閱網路上的一些說明而OK。

1.
# lsusb
Bus 002 Device 001: ID 0000:0000
Bus 001 Device 001: ID 0000:0000
Bus 001 Device 002: ID 0c45:612c Microdia
得知 USB的ID序號是 0c45:612c

2.
# lsusb -d 0c45:612c -v |less
Bus 001 Device 002: ID 0c45:612c Microdia
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x0c45 Microdia
idProduct 0x612c
bcdDevice 1.01
iManufacturer 0
iProduct 1 USB camera
iSerial 0
bNumConfigurations 1
......

3.
安裝以下兩工具可控制webcam
yum install v4l2-tool xawtv

為了compiling新的driver而要裝kernerl的source
yum install kernel-devel

4.
抓相容許多usb webcam的driver並compiling
wget http://mxhaard.free.fr/spca50x/Download/gspcav1-20070508.tar.gz
tar zxvf gspcav1-20070508.tar.gz
cd gspcav1-20070508
make
make install

5.
modprobe gspca
就可抓到webcam,
然後下指令看到更詳細的資料:
xawtv -hwscan
This is xawtv-3.95, running on Linux/i686 (2.6.22.5-76.fc7)
looking for available devices
/dev/video0: OK [ -device /dev/video0 ]
type : v4l
name : Typhoon Easy Cam 1.3 MPix
flags: capture

6.
參考:
http://ubuntuforums.org/archive/index.php/t-38215.html
v4lctl -c /dev/video0 list
看到更詳細的資訊:
attribute | type | current | default | comment
-----------+--------+---------+---------+-------------------------------------
input | choice | (null) | SN9CXXX | SN9CXXX
norm | choice | PAL | PAL | PAL NTSC SECAM AUTO
bright | int | 4144 | 0 | range is 0 => 65535
hue | int | 0 | 0 | range is 0 => 65535
color | int | 32768 | 0 | range is 0 => 65535
contrast | int | 16128 | 0 | range is 0 => 65535

7.
把webcam抓到的畫面放到某web,
透過ftp,就裝vsftpd:
yum install vsftpd

8.
參考:
http://phorum.study-area.org/viewtopic.php?t=20881
設定Virtual User:
http://gentoo-wiki.com/HOWTO_vsftpd#Virtual_Users
編輯/etc/vsftpd/vsftpd.conf

anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
anon_upload_enable=NO
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_std_format=YES
chroot_local_user=YES
listen=YES
pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES
guest_enable=YES
guest_username=virtual_user_name
anon_upload_enable=YES

9.
在Xwindow上執行:
xawtv
即可看到畫面。

10.
編輯.webcamrc

[grab]
device = /dev/video0
width = 320
height = 240
delay = 0
input = SN9CXXX
norm = pal
quality = 75
trigger = 180

[ftp]
host = localhost
user = virtual_user_name_for_ftp
pass = password_for_login
dir = /where/web/html/directory
file = webcam.jpeg
tmp = uploading.jpeg
local = 1

11.
執行webcam
就會不斷更新webcam.jpeg了!

Labels: , , , , , ,