Page 360 - Hacking Roomba
P. 360

Chapter 15 — RoombaCam: Adding Eyes to Roomba                     341



                             Installing Drivers
                             Similar to the USB serial adapter installation, two drivers must be downloaded and installed.
                             The first is the generic video device driver, called videodev.The second is spca5xx_lite.The
                             steps to get and install the drivers are:
                             root@OpenWrt:~# ipkg install videodev
                             root@OpenWrt:~# wget
                             http://roombahacking.com/software/openwrt/spca5xx_lite.o.gz
                             root@OpenWrt:~# gunzip spca5xx_lite.o.gz
                             root@OpenWrt:~# mv spca5xx_lite.o /lib/modules/`uname -r`
                             root@OpenWrt:~# insmod videodev
                             root@OpenWrt:~# insmod spca5xx_lite
                             root@OpenWrt:~# echo “videodev”     >> /etc/modules
                             root@OpenWrt:~# echo “spca5xx_lite” >> /etc/modules

                             As before, the insmod commands load the drivers immediately. Adding the driver names to
                             /etc/modules causes the drivers to be loaded on reboot. With the drivers installed, plug in
                             the webcam and watch the output of dmesg. You should see the driver recognize the camera.
                             For the camera shown in this example, you see:
                             root@OpenWrt:~# dmesg
                             [...]
                             usb.c: registered new driver spca5xx
                             spca_core.c: USB SPCA5XX camera found. Type Creative Instant P0620
                             spca_core.c: spca5xx driver 00.57.06LE registered

                             Taking Pictures
                             The driver creates a standard Video For Linux (v4l) device, so you could use any v4l program.
                             But the easiest way to start capturing images is to get the spcacat program, from the author
                             of the spca5xx driver. The program expects devices to be in /dev, not in a subdirectory, so a
                             symlink (also known as a symbolic link, a file that points to another file) needs to be created.
                             root@OpenWrt:~# wget
                             http://roombahacking.com/software/openwrt/spcacat.gz
                             root@OpenWrt:~# gunzip spcacat.gz
                             root@OpenWrt:~# chmod +x spcacat
                             root@OpenWrt:~# mv spcacat /usr/bin
                             root@OpenWrt:~# ln -s /dev/v4l/video0 /dev/video0
                             root@OpenWrt:~# spcacat -d /dev/video0 -g -f jpg -p 1000 -o
                             You can run spcacat with no arguments to see what its options are. The notable ones being
                             used here are:

                                 -f jpg: Data format is JPEG stream from camera.
                                 -p 1000: Pause 1000 milliseconds between images.
                                 -o: Overwrite image. Output image is SpcaPict.tif and is overwritten each time.
   355   356   357   358   359   360   361   362   363   364   365