Instalasi Logitech WebCam (Quick and Dirty)

Tutorial kali ini menggunakan Logitech USB webcam yang berbeda dengan webcam yang digunakan pada tutorial webcam terdahulu.

Sebelum menginstal driver untuk webcam Logitech USB, harus diketahui VendorID dan ProductIDnya terlebih dahulu. Caranya, hubungkan webcam ke PC via port USB, kemudian jalankan perintah dibawah ini sebagai root:

# lsusb
Bus 3 Device 2: ID 046d:0920 Logitech, Inc. QuickCam Express
Bus 3 Device 1: ID 0000:0000
Bus 2 Device 1: ID 0000:0000
Bus 1 Device 1: ID 0000:0000

Tampilan output diatas menunjukkan bahwa webcam Logitech ini memiliki VendorID 046d dan ProductID 0920. Driver untuk webcam dengan VendorID dan ProductID ini bisa didapat di http://mxhaard.free.fr/. Silahkan lihat disini, untuk mengetahui daftar webcam yang didukung oleh driver ini.

Download driver untuk kernel 2.6.11 keatas atau untuk kernel sebelum 2.6.11.

Ekstrak dan kemudian jalankan make sebagai user biasa:

$ tar zxf spca5xx-20060501.tar.gz
$ cd spca5xx-20060501
$ make
make -C /lib/modules/`uname -r`/build SUBDIRS=/home/oeban/gspcav1-20061216 CC=cc modules
make[1]: Entering directory `/usr/src/linux-2.6.18'
  CC [M]  /home/oeban/gspcav1-20061216/gspca_core.o
  CC [M]  /home/oeban/gspcav1-20061216/decoder/gspcadecoder.o
  LD [M]  /home/oeban/gspcav1-20061216/gspca.o
  Building modules, stage 2.
  MODPOST
  CC      /home/oeban/gspcav1-20061216/gspca.mod.o
  LD [M]  /home/oeban/gspcav1-20061216/gspca.ko
make[1]: Leaving directory `/usr/src/linux-2.6.18'

Setelah itu sebagai root lakukan instalasi:

# make install
mkdir -p /lib/modules/`uname -r`/kernel/drivers/usb/media/
rm -f /lib/modules/`uname -r`/kernel/drivers/usb/media/spca5xx.ko
rm -f /lib/modules/`uname -r`/kernel/drivers/media/video/gspca.ko
install -c -m 0644 gspca.ko /lib/modules/`uname -r`/kernel/drivers/usb/media/
/sbin/depmod -ae

Cabut webcam Anda kemudian sebagai root jalankan:

# tail -f /var/log/message

Kemudian tancapkan kembali webcam dan perhatikan output dari perintah diatas. Jika menampilkan seperti dibawah ini berarti instalasi driver webcam telah berhasil:

Jan  2 10:09:35 oeban kernel: ohci_hcd 0000:00:03.1: wakeup
Jan  2 10:09:36 oeban kernel: usb 3-2: new full speed USB device using ohci_hcd and address 5
Jan  2 10:09:36 oeban kernel: usb 3-2: configuration #1 chosen from 1 choice
Jan  2 10:09:36 oeban kernel: /home/oeban/gspcav1-20061216/gspca_core.c: USB SPCA5xx camera found. (TV8532)
Jan  2 10:09:36 oeban kernel: /home/oeban/gspcav1-20061216/gspca_core.c: [spca5xx_probe:3936] Camera type GBGR
Jan  2 10:09:36 oeban kernel: /home/oeban/gspcav1-20061216/gspca_core.c: [spca5xx_getcapability:1177] maxw 352 maxh 288 minw 160 minh 120

Baiklah, instalasi driver telah berhasil. Sekarang kita membutuhkan aplikasi untuk menampilkan snapshot dari webcamnya.

Download Spca5xx VideoGrabber SpcaGui, ekstrak kemudian kompilasi sebagai user biasa.

$ tar zxf spcagui20060127.tar.gz
$ cd spcagui20060127
$ make
cc -DUSE_SDL -O2 -DLINUX -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -DHAVE_LIBJPEG=1   -c -o spcagui.o spcagui.c
cc -DUSE_SDL -O2 -DLINUX -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -DHAVE_LIBJPEG=1   -c -o gui.o gui.c
cc -DUSE_SDL -O2 -DLINUX -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -DHAVE_LIBJPEG=1   -c -o spcav4l.o spcav4l.c
cc -DUSE_SDL -O2 -DLINUX -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -DHAVE_LIBJPEG=1   -c -o spcadecoder.o spcadecoder.c
cc -DUSE_SDL -O2 -DLINUX -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -DHAVE_LIBJPEG=1   -c -o utils.o utils.c
cc -DUSE_SDL -O2 -DLINUX -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -DHAVE_LIBJPEG=1   -c -o avilib.o avilib.c
cc -DUSE_SDL -O2 -DLINUX -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -DHAVE_LIBJPEG=1   -c -o SFont.o SFont.c
cc -DUSE_SDL -O2 -DLINUX -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -DHAVE_LIBJPEG=1   -c -o intro.o intro.c
gcc -DUSE_SDL -O2 -DLINUX -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -DHAVE_LIBJPEG=1 -o spcagui spcagui.o gui.o spcav4l.o spcadecoder.o utils.o avilib.o SFont.o intro.o -lSDL_image -L/usr/lib -Wl,-rpath,/usr/lib -lSDL -lpthread -ljpeg -lm

Sebagai root, lakukan instalasi:

# make install
install -s -m 755 -g root -o root spcagui /usr/local/bin
mkdir -p /usr/local/share/spcagui
install -m 644 icons/Fonts/*.png /usr/local/share/spcagui
install -m 644 icons/Danil/*.png /usr/local/share/spcagui

Sesuaikan hak akses device agar bisa dijalankan sebagai user biasa:

# ls -l /dev/v4l/
total 0
crw-rw---- 1 root video 81, 0 2007-01-02 10:15 video0

# id oeban
uid=1000(oeban) gid=100(users) groups=100(users)

Device video0 bisa dijalankan oleh user dengan group video, untuk itu user yang akan menjalankan device ini (dalam tutorial ini user tersebut adalah oeban, sesuaikan user tersebut dengan user Anda sendiri) harus dimasukkan ke group video. Jalankan perintah dibawah ini sebagai root kemudian lihat hasilnya:

# usermod -G video oeban
# id oeban
uid=1000(oeban) gid=100(users) groups=100(users),18(video)

User oeban sudah menjadi anggota group video. Sebelum user dapat menjalankan tool ini maka user tersebut harus logout terlebih dahulu kemudian login kembali setelah itu jalankan:

$ /usr/local/bin/spcagui
SpcaGui version: 0.3.5 date: 18 September 2005
video device /dev/video0
Camera found: QC Express
VIDIOCGPICT brightnes=25536 hue=0 color=0 contrast=32768 whiteness=0depth=24 palette=4
Bridge found: TV8532
Unable to find a StreamId !!
StreamId: 6 Unknow Camera
try palette 15 depth 12
Available  palette 15
try palette 3 depth 16
Available  palette 3
try palette 4 depth 24
Available  palette 4
try palette 5 depth 32
Available  palette 5
probe size in
skip size 640 x 480
skip size 384 x 288
Available Resolutions width 352  heigth 288
Available Resolutions width 320  heigth 240
Available Resolutions width 192  heigth 144
Available Resolutions width 176  heigth 144
Available Resolutions width 160  heigth 120
 grabbing method default MMAP asked
VIDIOCGMBUF size 2457616  frames 2  offets[0]=0 offsets[1]=1228808
VIDIOCGPICT brightnes=25536 hue=0 color=0 contrast=32768 whiteness=0depth=12 palette=15
VIDIOCGPICT brightnes=25536 hue=0 color=0 contrast=32768 whiteness=0depth=12 palette=15
VIDIOCGPICT brightnes=25536 hue=0 color=0 contrast=32768 whiteness=0depth=12 palette=15
VIDIOCSPICT brightnes=25536 hue=0 color=0 contrast=32768 whiteness=0depth=12 palette=15

Jika bisa menampilkan gambar seperti berikut ini, berarti instalasi driver dan aplikasi untuk webcam ini telah berhasil.

screenshot

Langkah selanjutnya adalah menampilkan snapshot webcam ini ke internet, langkah-langkahnya bisa dibaca disini (pada sub-judul Publish It!)

FYI, tutorial diatas saya implementasikan dengan mengunakan Linux Slackware 11.0 dengan kernel 2.6.18.

Update:
Untuk Windows cukup download dan install drivernya saja, silahkan ambil disini.

3 thoughts on “Instalasi Logitech WebCam (Quick and Dirty)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.