NSLU2-Linux
view · edit · print · history

Adding a USB webcam

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.

If you have a Logitech Quickcam Messenger, see UseALogitechQuickcamMessenger.

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.

Well, with the slug it got another brief smell of life. Fortunately these drivers support more than the crappy AverMedia?? InterCam?? Elite -- the list is extensive and include all (eh... "warning: broad sweeping statement") cameras using the OV511?? and compatible (OV518?? etc) controllers with various sensor types. For a good list of webcams and the controllers they use, see http://webcam-osx.sourceforge.net/cameras/index.php?orderBy=controller

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:

    * ipkg install -force-depends kernel-module-videodev
    * ipkg install -force-depends kernel-module-ov511 
(:cell:)
 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 OpenEmbedded GettingStarted??.
   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: 
(:cell:)
 Jan 13 20:29:21 klogd: Linux video capture interface: v1.00
 Jan 13 20:29:25 klogd: usb.c: registered new driver ov511
 Jan 13 20:29:25 klogd: ov511.c: USB OV511?? video device found
 Jan 13 20:29:25 klogd: ov511.c: model: AverMedia?? InterCam?? Elite
 Jan 13 20:29:25 klogd: ov511.c: Sensor is an OV7610??
 Jan 13 20:29:25 klogd: ov511.c: Device at usb-00:01.1-2 registered to minor 0
 Jan 13 20:29:25 klogd: ov511.c: v1.63 for Linux 2.4 : ov511 USB Camera Driver
    * 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. 

Loading the driver modules on startup

Create a file named S89wcam in /opt/etc/init.d as this:

(:cell:)
 #!/bin/sh
 #
 # Startup script for webcam
 #

 # Make sure the device has a /dev entry
 # Make device if not present (not devfs)
 if ( [ ! -c /dev/videodev ] ) then
  # Make /dev/net directory if needed
  mknod /dev/videodev c 81 0
 fi

 # Make sure the driver is running
 if ( !(lsmod | grep "^videodev" -q) ); then                                     
        insmod videodev &
 fi

 if ( !(lsmod | grep "^ov511" -q) ); then
        insmod ov511 &
 fi

and make it executable (chmod +x S89wcam). OpenSlug method

The OpenSlug is a bit different. Building vidcat

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

 VIDIOCMCAPTURE: Invalid argument
 args: width=320 height=240 palette=4
 Error: Can't get image

For my camera, creative brand:

 ./vidcat -p y -s 640x480 > test.jpg

tftp

To download files to the slug, from the slug prompt:

 tftp -r filename -g 192.168.1.2

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.

To build the pwc.o module follow these steps: Get pwc-9.0.2.tar.gz from http://www.smcc.demon.nl/webcam.

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.

Unpack only the 2.4 part for instance in /tmp:

 cd /tmp
 tar xvzf pwc-9.0.2.tar.gz pwc-9.0.2/2.4

Go to that directory:

 cd /tmp/pwc-9.0.2/2.4

Add the following before the #includes in the file pwc-if.c:

 static void set_bit(int nr, volatile void *addr)
 {
	((unsigned char *) addr)[nr >> 3] |= (1U << (nr & 7));
 }

 static void clear_bit(int nr, volatile void *addr)
 {
	((unsigned char *) addr)[nr >> 3] &= ~(1U << (nr & 7));
 }

This fixes getting unresolved symbols. I do not know why set_bit and clear_bit do not get properly resolved.

Get a copy of videodev.c there as well:

 cp /usr/src/linux-2.4.22/drivers/media/video/videodev.c .

Add this Makefile (put the CFLAGS on a single line, they break the wikipage without line breaks):

 EMULATION	= armelfb_linux
 ARCH		= armv5
 CC		= armv5b-softfloat-linux-gcc
 LD		= armv5b-softfloat-linux-ld
 KERNEL_INCLUDE = /opt/crosstool/armv5b-softfloat-linux/gcc-3.3.4-glibc-2.2.5/armv5b-softfloat-linux/include
 MODVERSIONS	=

 CFLAGS		= -D__KERNEL__ -DNEED_SETBIT -I$(KERNEL_INCLUDE) -Wall -Wstrict-prototypes   

-Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -fomit-frame-pointer -pipe -march=$(ARCH)

 -mbig-endian -DMODULE -DMODVERSIONS -nostdinc -iwithprefix include $(MODVERSIONS)
 LDFLAGS	= -m $(EMULATION) -r

 all: pwc.o videodev.o

 clean:
	-rm *.o

 pwc-if.o:
	$(CC) $(CFLAGS) -DKBUILD_BASENAME=pwc_if -c -o pwc-if.o pwc-if.c
 pwc-misc.o:
	$(CC) $(CFLAGS) -DKBUILD_BASENAME=pwc_misc -c -o pwc-misc.o pwc-misc.c
 pwc-ctrl.o:
	$(CC) $(CFLAGS) -DKBUILD_BASENAME=pwc_ctrl -c -o pwc-ctrl.o pwc-ctrl.c
 pwc-uncompress.o:
	$(CC) $(CFLAGS) -DKBUILD_BASENAME=pwc_uncompress -DEXPORT_SYMTAB -c pwc-uncompress.c

 pwc.o: pwc-if.o pwc-misc.o pwc-ctrl.o pwc-uncompress.o
	$(LD) $(LDFLAGS) -o pwc.o pwc-if.o pwc-misc.o pwc-ctrl.o pwc-uncompress.o

 videodev.o:
	$(CC) $(CFLAGS) -DKBUILD_BASENAME=videodev -DEXPORT_SYMTAB -c videodev.c

Set the correct environment:

	export PATH=/opt/crosstool/armv5b-softfloat-linux/gcc-3.3.4-glibc-2.2.5/bin

And now issue the make command:

	/usr/bin/make -f Makefile

This will result in the pwc.o and videodev.o modules for a big-endian ARM running a Linux 2.4.22 kernel (like the Unslung NSLU2).

First, make sure you have a video device on the slug:

	mknod /dev/video0 c 81 0
	mknod /dev.state/video0 c 81 0
	chown admin.everyone /dev/video0
	chown admin.everyone /dev.state/video0
	chmod g+w /dev/video0
	chmod g+w /dev.state/video0

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:

 CONFIG_SND_USB_AUDIO=m

But it is quite possible I also enabled some of the following:

CONFIG_SND=m CONFIG_SND_TIMER=m CONFIG_SND_PCM=m CONFIG_SND_HWDEP=m CONFIG_SND_RAWMIDI=m

   1. CONFIG_SND_SEQUENCER is not set 

CONFIG_SND_OSSEMUL=y CONFIG_SND_MIXER_OSS=m CONFIG_SND_PCM_OSS=m

The most tricky thing here was to get them loaded in the right order. Here is the output of lsmod on my slug to help you getting started:

snd_usb_audio 44800 0 snd_pcm 54472 1 snd_usb_audio snd_timer 14020 1 snd_pcm snd_page_alloc 4584 1 snd_pcm snd_usb_lib 9120 1 snd_usb_audio snd_rawmidi 13056 1 snd_usb_lib snd_hwdep 4324 1 snd_usb_audio snd 26680 5 snd_usb_audio,snd_pcm,snd_timer,snd_rawmidi,snd_hwdep soundcore 3844 1 snd

Note that although everything loads, I still have been unable to get any sound from the cam (although I can get sound on it on my fedora system). PWC: The Debian NSLU2 method

http://www.cyrius.com/debian/nslu2/

1. Get the Installer 2. Install debian/Nslu2 etch 3. Get pwc sources with apt-get ("apt-get install pwc-source") 4. Install kernel headers ("apt-get install linux-headers-2.6.18-5-ixp4xx", check kernel version first) 5. compile and install pwc( "tar xjvf pwc-source.tar.bz2", "cd modules/pwc", "make" "make install") 6. Create a device node for your audio input device . Get webcam with apt-get ( test your cam - fetch still images ) 8. Get ffserver / ffmpeg with apt-get ( for streaming ) - use mplayer on client side 9. Create a ramdisc for the video buffer data

mkdir ramdisc /*create a directory for your ramdisc in the root directory mkfs /dev/ram0 /*maybe we should put this into an init script mount /dev/ram0 /ramdisc /*mount your ramdisc

/etc/ffserver.conf:(only Real Media seems to work for me)

Port 8090 <Feed feed.ffm> File /ramdisc/feed.ffm FileMaxSize?? 1M ACL allow 127.0.0.1 </Feed>

/* Real Media /* cif 352x288

<Stream cam.rm> Feed feed.ffm Format rm AudioBitRate?? 32 VideoBitRate?? 500 VideoFrameRate?? 6 VideoSize?? cif </Stream>

Start streaming with the following two commands:

ffserver ffmpeg -vd /dev/video0 http://localhost:8090/feed.ffm

Output from ffmpeg:

FFmpeg?? version SVN-rUNKNOWN, Copyright (c) 2000-2004 Fabrice Bellard

  configuration:  --enable-gpl --enable-pp --enable-pthreads --enable-vorbis
  --enable-libogg --enable-a52 --enable-dts --enable-libgsm --enable-dc1394
  --disable-debug --enable-shared --prefix=/usr
  libavutil version: 0d.49.0.0
  libavcodec version: 0d.51.11.0
  libavformat version: 0d.50.5.0
  built on Oct  7 2006 07:39:35, gcc: 4.1.2 20060920 (prerelease) (Debian 4.1.1-14)

[video4linux2 @ 0x4009a104][4]Capabilities: 5000001 Input #0, video4linux2, from '':

  Duration: N/A, bitrate: N/A
  Stream #0.0: Video: rawvideo, yuv420p, 352x288, 7299 kb/s,  6.00 fps(r)

Input #1, audio_device, from '':

  Duration: N/A, bitrate: N/A
  Stream #1.0: Audio: pcm_s16le, 22050 Hz, mono, 352 kb/s

Output #0, ffm, to 'http://localhost:8090/feed.ffm':

  Stream #0.0: Audio: ac3, 22050 Hz, mono, 32 kb/s
  Stream #0.1: Video: rv10, yuv420p, 352x288, q=3-31, 500 kb/s,  6.00 fps(c)

Stream mapping:

  Stream #1.0 -> #0.0
  Stream #0.0 -> #0.1

Press [q] to stop encoding [rv10 @ 0x4044234c]rc buffer underflow frame= 23 q=1.6 Lsize= 176kB time=3.8 bitrate= 376.1kbits/s video:103kB audio:18kB global headers:0kB muxing overhead 45.889019%

Receive your Webcam Video/Audio Stream on client side with the following command:

mplayer http://<your-nslu-ip-number>:8090/cam.rm(approve sites)

/* You can also use Realplayer 8 to rcceive your webcam stream, but Realplayer 10 does not work !

Output from mplayer:

MPlayer?? 1.0rc1-SUSE Linux 10.1 (i686)-Packman-4.1.0 (C) 2000-2006 MPlayer?? Team CPU: Intel(R) Pentium(R) M processor 1.73GHz (Family: 6, Model: 13, Stepping: 8) CPUflags??: MMX: 1 MMX2??: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2??: 1 Compiled with runtime CPU detection. Can't open joystick device /dev/input/js0: No such file or directory Can't init input joystick mplayer: could not connect to socket mplayer: Connection refused Failed to open LIRC support. You will not be able to use your remote control.

Playing http://192.168.1.77:8090/cam.rm. Resolving 192.168.1.77 for AF_INET6... Couldn't resolve name for AF_INET6: 192.168.1.77 Connecting to server 192.168.1.77[192.168.1.77]: 8090... Cache size set to 320 KBytes?? Cache fill: 17.50% (57344 bytes) REAL file format detected. Stream description: The Audio Stream Stream mimetype: audio/x-pn-realaudio Stream description: The Video Stream Stream mimetype: video/x-pn-realvideo VIDEO: [RV10??] 352x288 24bpp 6.000 fps 0.0 kbps ( 0.0 kbyte/s) ========================================================================== Opening video decoder: [ffmpeg] FFmpeg??'s libavcodec codec family Selected video codec: [ffrv10] vfm: ffmpeg (FFmpeg?? RV10?? decoder) ========================================================================== ========================================================================== Opening audio decoder: [liba52] AC3?? decoding with liba52 Using SSE optimized IMDCT transform Using MMX optimized resampler AUDIO: 22050 Hz, 2 ch, s16le, 32.0 kbit/4.54% (ratio: 4000->88200) Selected audio codec: [a52] afm: liba52 (AC3??-liba52) ========================================================================== AO: [oss] 22050Hz 2ch s16le (2 bytes per sample) Starting playback... VDec??: vo config request - 352 x 288 (preferred colorspace: Planar YV12??) VDec??: using Planar YV12?? as output csp (no 0) Movie-Aspect is undefined - no prescaling applied. VO: [xv] 352x288 => 352x288 Planar YV12?? 11.2 V: 11.2 A-V: 0.003 ct: -0.331 68/ 68 2% 0% 0.2% 2 0 18%

Have Fun, Peter

=========================================================================== Quickcam 4000 Webcam on Debian Etch RC2???

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:

 apt-get install streamer

 streamer -c /dev/video0 -b 16 -o webcamfile.jpeg

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:

  apt-get install webcam
  nano /root/.webcamrc

 [grab]
       device = /dev/video0
       text = "NSLU2 webcam m-H:S (BST)"
 #       infofile =
       fg_red = 255
       fg_green = 255
       fg_blue = 255
       width = 640
       height = 480
 # delay = number of seconds between snapshots
       delay = 30
       wait = 1
       input = usb
       norm = webcam
       rotate = 0
       top = 0
       left = 0
       bottom = -1
       right = -1
       quality = 75
       trigger = 0
       once = 0
 #      archive =

 [ftp]
       host = 127.0.0.1
       user = root
       pass = xxxx
       dir  = /var/mywebroot/webcam
       file = webcam.jpeg
       tmp  = uploading.jpeg
       passive = 1
       debug = 0
       auto = 0
 # local = 1 means just use the local directory specified above, do not use ftp or ssh
       local = 1
       ssh = 0

You can then start webcam

  webcam

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:

  apt-get install motion
  and a more conventionally named /etc/motion/motion.conf

 # Minimal motion example config file provided by the
 # Debian motion package - for basic webcam operation.
 #
 # You most certainly want to investigate
 # /usr/share/doc/motion/examples/motion-dist.conf.gz
 # for further configuration options. Also, refer to the
 # motion man page and /usr/share/doc/motion/motion_guide.html
 # for detailed information on configuration options.
 daemon on
 quiet on
 # You may very well need to change this (check with 'dmesg'
 # after plugging in your webcam).
 videodevice /dev/video0
 # Image size in pixels (valid range is camera dependent).
 width 320
 height 240
 #
 framerate 2
 quality 85
 auto_brightness off
 #
 # Make automated snapshot every N seconds (default: 0 = disabled)
 snapshot_interval 60
 #
 # General threshold level and noise threshold
 # level (for distinguishing between noise and motion).
 threshold 4500
 noise_level 64
 #
 # Initial brightness, contrast, hue (NTSC), and saturation.
 # 0 = disabled (valid range 0-255).
 brightness 0
 contrast 0
 saturation 0
 hue 0
 #
 # for low-powered cpus
 low_cpu 1
 #
 # Target base directory for pictures and films (you may need
 # to change this (or change its permissions) depending on
 # which system user runs motion).
 target_dir /var/mywwwroot/motion/snapshots
 #
 # filenames recycle after 1 month
 jpeg_filename HS-%q
 #
 # snapshot_filename YdM??%S-snapshot
 snapshot_filename last-snapshot
 #
 # Define a port number (e.g. 8000) to enable the mini-http server.
 # 0 = disabled.
 webcam_port 0
 #
 # Set to 'off' to allow anybody (not just localhost) to view the
 # webcam via the mini-http server (http://hostname:port(approve sites)).
 webcam_localhost off
 #
 webcam_quality 50
 webcam_maxrate 1

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....

Vic Z

=========================================================================== More on Logitech Quickcam 4000 Webcam, using Debian Etch R3 - Aug 29, 2008

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:

 Aug 29 16:09:58 Sluggy kernel: usb 1-1: new full speed USB device using ohci_hcd and address 2
 Aug 29 16:09:58 Sluggy kernel: usb 1-1: configuration #1 chosen from 1 choice
 Aug 29 16:10:00 Sluggy kernel: Linux video capture interface: v2.00
 Aug 29 16:10:00 Sluggy kernel: pwc: Philips webcam module version 10.0.12 loaded.
 Aug 29 16:10:00 Sluggy kernel: pwc: Supports Philips PCA645??/646, PCVC675??/680/690, PCVC720??[40]/730/740/750 & PCVC830??/840.
 Aug 29 16:10:00 Sluggy kernel: pwc: Also supports the Askey VC010??, various Logitech Quickcams, Samsung MPC-C10 and MPC-C30,
 Aug 29 16:10:00 Sluggy kernel: pwc: the Creative WebCam?? 5 & Pro Ex, SOTEC Afina Eye and Visionite VCS-UC300?? and VCS-UM100??.
 Aug 29 16:10:00 Sluggy kernel: pwc: Logitech QuickCam?? 4000 Pro USB webcam detected.
 Aug 29 16:10:00 Sluggy kernel: pwc: Registered as /dev/video0.
 Aug 29 16:10:00 Sluggy kernel: usbcore: registered new driver Philips webcam
 Aug 29 16:10:01 Sluggy kernel: usbcore: registered new driver snd-usb-audio

No downloading or compiling required!

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:

 [grab]
 device = /dev/video0
 text = NSLU2 Webcam - m-H:S (GMT)
 fg_red = 255
 fg_green = 255
 fg_blue = 255
 width = 640
 height = 480
 delay = 5
 wait = 1
 input = usb
 norm = webcam
 rotate = 0
 top = 0
 left = 0
 bottom = -1
 right = -1
 quality = 75
 trigger = 0
 once = 0

 [ftp]
 host = 127.0.0.1
 user = root
 pass = xxxx
 dir  = /var/www/webcam
 file = webcam.jpeg
 tmp  = uploading.jpeg
 passive = 1
 debug = 0
 auto = 0
 local = 1
 ssh = 0

Finally I threw together a simple HTML page with auto-refresh:

 <html>
 <head>
 <meta http-equiv="refresh" content="5;url=index.html">
 </head>
 <body>
 <h1>Webcam</h1>
 <img src="webcam.jpeg"/>
 </body></html>

And I was up and running with 5-second snaphots displaying through Apache2!

Chris W

====================================================================================

Using GSPCA drivers for Debian Etch (added 14 Apr 2008)

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...

1. Install module-assistant

apt-get install module-assistant

2. Install gspca driver m-a auto-install gspca

and voila, your Quickcam and compatible webcam works...

Roland G.

====================================================================================

Using QUICKCAM driver for Debian Etch R4 (added 31 July 2008)

It was a pain in the axxx to get my Logitech QuickCam??? Express Camera (ID 046d:0870) working. Thus, I though it would be helpful to write this down here to help other fellows.

First, I tried to compile the pure sources without success. At the end it was the same procedure as described by Roland:

1. Install module-assistant apt-get install module-assistant

2. Install QC-USB driver m-a auto-install qc-usb

and it worked...

Best regards anothermike

==================================================================================== NSLU2 Webcams

http://www.matthewsmith.id.au/webcam.php

http://wake.willmeroth.com/webcam.html - No live images as of Dec 8,2006. (Found active 30 May 2012.)

http://tech.groups.yahoo.com/group/nslu2-linux/message/16388

http://www.zonko.ath.cx/webcam.html

http://3secs.ownit.nu/ - info about ftp-upload pictures and Z-Star Microelectronics Corp. ZC0301??? WebCam??? works with gspca. - info about IP camera and slug

==================================================================================== OpenWRT??? Kamikaze

See http://johnarthur.wordpress.com/2008/03/25/a-high-resolution-ip-webcam/ for an implementation using the QuickCam??? Pro 9000

====================================================================================

This guy made it sound so easy: http://daubers.homelinux.net/?p=23 but didn't publish any details, and there's no obvious way of getting in touch.

====================================================================================

SlugOS/BE Logitech Quickcam Pro 9000 Implementation running uvc / v4l driver howto http://www.walcherstrasse17.com(approve sites) cherz p003876

This page is password protected.

The password is "webcam". Let's see if that stops the automated wiki spam.