Other Hardware

Wiki Resources

Sponsored Links

Note: the first part of this page is severly outdated. I believe the ov511 etc are supported standard by kernel-module-ovcamchip. For Philips chip based webcams there is package pwc (together with its companion setpwc).

The first part concerns the ov511 driver e.g. for the Avermedia Intercam webcam. The second part discusses the pwc driver for many Philips chip based webcams.

I have bought a lot of computer equipment in my days, but few things have I used as little as my webcam. It has basically lived its life in one of those drawers that also house SCSI to D-shell cables and other things once thought useful. Since my webcam, an AverMedia?? InterCam?? Elite, is probably one of the worst commercial webcams ever made, I had little idea that it would leave its drawer for anything but the garbage.

Also note that the module that needed to be changed is the generic module videodev.o and most controller specific modules can now be used with no change, like with most of the Creative Webcams. Have a look in the Linux support list to see whether your camera is listed and make some noise to have it compiled. Unslung 5.x: Getting the software

Since 5.0 using a cam is really easy as all required kernel modules are available as ipkg packages. Just type:

Warning: Cannot satisfy the following dependencies for kernel-module-ov511:
update-modules kernel-image-2.4.22-xfs

**note**: This dependencies warning can be disregarded.

Then load the drivers using

* insmod videodev
* insmod ov511

and see the 'Testing it' chapter below. Building it yourself

1. Get the OpenEmbedded cross compilation system running and make the unslung image like described in OpenEmbeddedGettingStarted??.
2. Go to ${OEBUILD}/tmp/work/unslung-able-kernel-2.3r25-r7/linux-2.4.22/drivers/media/video and replace videodev.c with the newly downloaded one.
3. Remove the object module videodev.o (if present) created during the previous build.
4. Go to ${OEBUILD}/tmp/work/unslung-able-kernel-2.3r25-r7 and make sure that the configuration
variables are set to compile these modules are set in defconfig:
1. CONFIG_VIDEO_DEV=m
2. CONFIG_USB_OV511=m
3. CONFIG_DEVFS_FS=y (yes, that looks silly, but it must be set to get it to compile)
4. (there might be more, but I think they are on by default -- please add if you find some to be missing)
5. Delete ${OEBUILD}/tmp/stamps/unslung-able-kernel-2.3r25-r7.do_compile
6. Build unslung image again
7. The videodev.o driver should now be in

${OEBUILD}/tmp/work/unslung-able-kernel-2.3r25-r7/\install/kernel-module-videodev/lib/modules/2.4.22-xfs/kernel/drivers/media/video/ and the ov511.o driver in
${OEBUILD}/tmp/work/unslung-able-kernel-2.3r25-r7/install/\kernel-module-ov511/lib/modules/2.4.22-xfs/kernel/drivers/usb

8. if using openslug, use the .ko files - look in

${OEBUILD}/tmp/work/openslug-kernel-2.6.9-r11/ ... linux-2.6.9/drivers/media/video/videodev.ko and similar for the ov511 module (like linux-2.6.9/drivers/usb/media/ov511.ko). The find command is your friend.

Alternative kernel compile

Edit build/conf/local.conf and add the lines:

OPENSLUG_EXTRA_INSTALL = "kernel-module-vidoedev kernel-module-ov511"

then rm tmp/stamps/openslug-kernel-2.6.9-r11.do_configure and run

bitbake openslug-kernel

the results should end up in the tmp/work/openslug-kernel-2.6.9-r11/install/kernel-module-videodev/ blah blah directories. I think they may even find their way into the images when you do a bitbake openslug-image Getting it running for testing

1. Place the two modules videodev.o and ov511.o in /opt/lib/modules
2. Connect your webcam and check /var/log/messages to see that it has been detected by the USB driver
3. From /opt/lib/modules, do "insmod videodev.o" followed by "insmod ov511.o"
4. Check /var/log/messages to see that it has been recognized properly. Expect something like:

* openslug: I put the modules in '/lib/modules/2.6.9'. I had to upload the compiled openslug-image
to get past a symbols error.
* Create the device in /dev by doing: mknod /dev/video0 c 81 0

Testing it

Now your driver need a test application to see that the driver is working. I compiled w3cam, which
provides a CGI script for putting webcam still images in your web pages. I made this work with the stock Linksys thttpd, though I managed to crash my slug by running multiple concurrent instances. Better for our purpose is the vidcat command line program for fetching a still image. I put both these programs as well as ppmtoascii (all compiled to use /dev/video0) in http://folk.uio.no/ingeba/w3camapps.tar.gz, but I suggest looking elsewhere for better webcam apps. I tried compiling several others using the old native toolchain, but most builds failed compilation with "CPP preprocessor failed sanity check" or "syslimits.h not found". This is fixed in a new version of the native toolchain coming out, so don't bother trying with the old one. Do cross compile or wait for new native toolchain.

1. Place these programs in /opt/bin and do: vidcat -s 640x480 > /share/hdd/data/public/test.jpg
2. Copy test.jpg to your PC using FTP or by copying it to an accessible file share on your slug.
3. View it on your PC and see what beautyful images the OV511?? controller can bring you.
4. You may also try placing w3cam.cgi in /home/httpd/html and browsing to it (on my setup it is
http://naseem.swampman.net/w3cam.cgi?help), but I found it rather unstable.

I think the vidcat supplied in the tgz of this page might also work but I wanted to attempt to build it.

* Create a .bb file for w3cam and put it in the openembedded/packages dir under 'w3cam/w3cam_0.7.2.bb'
DESCRIPTION="Set of small programs to grab images and videos from video4linux devices"
SECTION = "media-gfx"
LICENSE = "GPLV2???"
DEPENDS="jpeg"
SRC_URI="http://mpx.freeshell.net/${P}.tar.gz"
inherit autotools
* Link to it from the nslu2-package-symlinks/packages directory
* bitbake w3cam - it fails at some point but builds the vidcat package before failing.
* Get the binary from build/tmp/work/w3cam-0.7.2-r0/w3cam-0.7.2/vidcat

Note: currently there is a working bb file in the openslug development head. vidcat command line

I had to muck about with the palette and size args to make it work. Otherwise you just get

You'll need to put the files in the tftpboot dir if running tftpd with -s and make sure the tftpd user (nobody by default) can read the file.

I had to configure tftpd to allow access to uploading into the tftpboot directory. Run tftpd with -s /tftpboot -c -p and make sure that the nobody user can write to the tftpboot dir. Once you've got it working you can tighten up security by running as a special user etc.

tftp -l test.jpg -p 192.168.1.2

Troubleshooting

I've found the slug to almost freeze up when loading an image. Please check this out with your cams and report back. I have no cure for this yet, but it could be a semaphore in the driver.

I have problems with multiple applications accessing the drivers.

I am not sure if the driver, as is, support more than one webcam, but I can't test it as I only have one :-)

For the Logitech QuickCam?? Zoom silver Vendor=046d ProdID??=08b4, get the pwc.o kernel module and the vidcat snapshot software from the files section of the yahoo group nslu2-linux. Use "insmod pwc size=cif fps=5 power_save=1" (without power_save=1, vidcat will hang). Do snapshots with the undocumented option -m of vidcat (otherwise you will have all green image): vidcat -p y -q 100 -f png -s 352x288 -m -o xxx.png

Making the installation permanent

This works until you reboot, for two reasons:

The modules videodev.o and ov511.o have to be loaded on startup - a startup script will be provided.

The /dev files system is not persistant - must be done to the flash file system.

Future

If this becomes stable, we can expect:

Webcam still and motion support

Remote video surveilance with multiple cameras, motion detection etc.

I thought I'd place my camera in the window of my Oslo apartement so I can browse to it from Amsterdam to see what the sun looks like from time to time.

Bob_tm Webcams using the pwc driver, e.g. Logitech Quickcam Pro 4000

There are two different approaches to get this done. The text just below is Unslung related. After that (large) section there is also a section on Openslug.

Note also that a PWC webcam might not work properly if you connect it to the slug with a USB 2.0 hub. Best thing is to use a 1.1 hub or to connect directly to the slug. PWC: the Unslung method

Assumes you have crosstool-0.28-rc35 or later installed on a Linux machine.

Note: Development for this driver stopped a long time ago, with verion 9.0.2, but a new project took over, at http://www.saillard.org/linux/pwc/ . It includes all the features of 9.0.2, including those which were only available using the binary decompressors. The instructions below use the 9.0.2 version, but it would probably be worth testing the new driver.

Then copy the modules over to the slug and put them in /opt/lib/modules. Install them with:

insmod /opt/lib/modules/videodev.o
insmod /opt/lib/modules/pwc.o

It is up to you to write the necessary rc diversion scripts to have this done upon every boot. You could just put the insmod commands in /share/hdd/conf/unslung/rc.local.

Get some webcam utility that accesses the webcam via the videodev interface. I used vidcat from w3cam-0.7.2.tar.gz and compiled it on the slug using the crosstool-native packages. Mind that I had to resort to using the read() call instead of mmap() (see vidcat.c) to get my Logitech Quickcam Pro 4000 working but only at 160x120 resolution. I use the command "vidcat -s 160x120 -p y".

You can also find the precompiled binaries for pwc.o, videodev.o, vidcat and setpwc in the "files" section of the Yahoo nslu2 news group (click on Yahoo group in sidepanel on the left).

Have fun,

Geert PWC: the Openslug method

Note: the text below used the pwc driver from the kernel. This one is quite old. Instead better use the driver from the pwc package.

In order to get my cam up and running I did the following. Rebuild the kernel. Make sure that in your defconfig file the line CONFIG_USB_PWC=m is entered. In the 2.7 version this define al already there. This will assure that you get a file pwc.ko. You also need CONFIG_VIDEO_DEV=m in order to get videodev.ko

I also needed v4l2_common.ko. If I recall correctly this came with videodev. Anyway, when you have these three files you can just copy them to the slug, insmod them, do a depmod -a and off you go.

However instead, I decided to go for the latest version (10.0.7a). As the version in Openslug is older, I just did a build as before, then overwrote my tmp/work/*kernel*/linux*/drivers/usb/media/pwc directory with the 10.0.7a version (from www.saillard.org). After that remove tmp/stamps/*kernel*compile and do a bb openslug-kernel That will give you the most recent .ko file

Note that this last thing is not very decent. If you do a bb -cclean or so, your changes will be lost. However, I am not comfortable enough with bb and friends to do that in a nicer way.

Make the entries in /dev as needed (see above) and compile vidcat. With that you should be able to grab pictures, e.g. with "vidcat -s 160x120 -p y". I also managed to get motion 3.2.3 to work (just downloaded it and natively compiled it on the slug). For streaming video you can just do something like: cat /dev/video0 >videofile. On a linux box you can playback the file by giving a command like: mplayer -rawvideo on:fps=10:w=176:h=144 videofile where you have to specify the right values for fps, w and h.

I also managed to compile the sound drivers. I'm not really sure what I changed to do that (sorry!). I definitely changed in defconfig:

I had an old Logitech Quickcam 4000 lying around so I decided to see if it could be made to work on a Slug. It turns out it is one of the easiest webcams to support, using the Philips pwc driver, If you are not sure which USB webcam you have, try plugging it in and typing

lsusb

You can check that the driver is not already loaded with

lsmod

and if not, see if it can be loaded

modprobe pwc
lsmod

I was pleasantly surprised to find that the module was available and loaded fine. To have it load automatically in future on reboot add the following to /etc/modules

# for webcam
pwc

with your favourite editor. After this the video device should become available, and can be identified with this command, mine turned out to be /dev/video0, which is normal:

ls /dev/video*

You can check it is working OK with the simple framegrabber application Streamer:

You will need to copy webcamfile.jpeg to your client to view it, it should be a single frame image from your webcam, so remember to smile ;-)

The next step was to find a proper webcam application. The first I came across was the imaginatively named ‘webcam’. I installed it and after a fair bit of digging in the man files and surfing finally got it to work. Quirkily it uses a config file called /root/.webcamrc . The default supplied is mostly rubbish for our purposes. Also I suggest you supply the full filename when editing it in your fave editor so you don’t end up editing a file in the wrong place which will be ignored. I have copied my file here which should be easy enough to follow along with the man page:

and test that it is working by pointing your browser at <your web root>/webcam/webcam.jpeg in the above example.

I found it ran well, using negligible resources, and it was easy to knock up some html to pretty it up a bit and auto refresh.

If you want it to run automatically you could set up a crontab:

crontab -e
@reboot /usr/bin/webcam

A (much) more sophisticated webcam package which includes motion detection is the equally imaginatively called ‘motion’. This is so complex that it has its own wiki (always a bad sign!) but it wasn’t too hard to get running:

Start motion from your shell and because of the daemon on setting it will run as a daemon and begin both taking 60 second snapshots (overwriting the same jpeg file in this case), and creating one jpeg per frame while detecting motion. If you like you can stream near-real-time images via its built in web server to a chosen port but be prepared for 97% CPU usage while doing it! In fact performance generally seems to be on the margins for a Slug. I disabled the mini-server, set all the frame rates to their minimum, added the low-cpu statement, and reduced the video size to 320x240. Collectively these took CPU and Memory usage down from both being at about 20% to both being at about 10%, which I guess is just about OK for most users. Beware that by default the motion detection creates zillions of jpeg files, one per frame while something is moving in the webcam’s field of view. I changed it to loop around the day of the month, by changing the filename, which I estimate would create at worst a few gigabytes of data. If you are shorter of space you could loop around say a days or even an hours worth of files, although it could be frustrating to arrive home only to find the only image you had of a burglar was a shot of his arse disappearing thru the window...

I didn’t try out any of the timelapse or mpeg creation options yet, maybe I will give these a go at a later date. In the meantime I have created a rough webcam page here http://www.zonko.ath.cx/webcam.html where you can see either webcam or motion in action (though only one at a time!). I can’t promise it will always be on, though. Having proved the concept I’m not sure really where I want to put it or how to best use it....

I first tried to get a Logitech Quickcam 4000 running on Unslung but got put off by all the cross compilation required. That and the other limitations of this OS persuaded me to convert to Debian, which was a great move - the PWC modules were available out of the box! And in addition all the usual Unix utilities were now present, and behaved the way I am used to.

Once I had Etch R3 running and configured I just plugged in the camera and immediately saw this in /var/log/messages:

I then used 'apt-get install webcam' to get the webcam package, found that the webcamrc settings defined above did not work - got 'invalid norm: pal' and 'invalid input: composite0'. My working settings are:

Most of the instructions here are helpful, but not complete, so I decided to add this. I've installed Debian on my NSLU2, because I wasn't able to find a quick solution for adding SPCA5xx??? drivers to uNSLUng. And along the way, I found some info on GSPCA, which works fine with my Quickcam Communicate STX and debian. This is basically the same as the How-to for using Quickcam messenger...