Logitec webcam - getting it to work

chris (2003-05-26 00:26:46)
1 replies
logitec quickcam driver - compiling the module

Fist I wanted to compile the qce-ga-0.40d driver, but it was barfing with:

quickcam.c: In function `quickcam_mmap':
quickcam.c:2099: warning: passing arg 1 of `remap_page_range_R2baf18f2' makes pointer from integer without a castquickcam.c:2099: incompatible type for argument 4 of `remap_page_range_R2baf18f2'
quickcam.c:2099: too few arguments to function `remap_page_range_R2baf18f2'
quickcam.c: At top level:
quickcam.c:2126: warning: initialization from incompatible pointer type
make: *** [quickcam.o] Error 1

After a bit of googling, it turns out that the mmap() interfaces have changed under RH9 so basically the driver now takes 5 arguments instead of 4.

This was fairly simple to fix. Make sure the mmap() function definition looks like:

static int function_mmap(struct vm_area_struct *vma, struct whatever *btv, const char *adr, unsigned long size)

and then make sure any remap_page_range() calls have 'vma' as their first
argument. Insert it if they don't.

Installing the module

less /proc/bus/usb/devices | grep Camera to find a line that says Camera. This indicates the webcam has been detected.

You need to have the kernel source RPM for your current kernel installed. Installation of that RPM automatically creates a /usr/src/linux-2.4 symbolic link to the /usr/src/linux-2.4.x kernel source (where x is your sub-version of 2.4). Now go to the /usr/src directory by typing cd /usr/src. I got this off Redhat's SRPMS2 cd and installed it.

Once you are in the /usr/src folder and you see the /usr/src/linux-2.4 symbolic link, create a new symbolic link called linux by typing ln -s linux-2.4 linux. Now type exit to go back and become your regular user again.

Enter the quickcam driver source code directory by typing cd /usr/src/qce-ga-0.40b. Type make to create the driver file. You should now see a file if you type ls -l mod_quickcam.o. Become root again, and type chown root:root mod_quickcam.o to change ownership of the mod_quickcam.o file to the root user. That's the driver module compiled (thanks to the patch above).

As root, open your /etc/modules.conf. If there isn't a line present that reads keep, add it. Add the following statement after the 'keep' line: path=/usr/src/qce-ga-0.40d. This will add that qce directory to the list of places for the operating system to look for kernel modules.

Now, still as root, type depmod -a. You will notice that it complains that several files in the qce* directory do not belong to root. Ignore these warnings.

At this point it may be possible to start up the quickcam driver by unplugging it from the USB port and plugging it back into the USB port, but I'm not certain. Rebooting the computer should start the quickcam driver at boot time, and you can tell if the driver is loaded by executing an lsmod when you are the root user. You should see the quickcam driver in the list of modules currently loaded at that time.

Find an install the latest xawtv for your distribution. I recommend using the RPM file, which you can find at rpmfind.net by searching for 'xawtv'.

The webcam will probably be installed as /dev/video0. Once you have installed the xawtv program, you can see the video coming from the webcam by running xawtv -c /dev/video0. I did and it's fucking awsome!! But I don't want to record movies at the moment.. I want stills, so..

Now to get it grabbing and uploading to Brezhnev:
2003-05-28 22:17:15


Okay, so we can get xawtv to feed back from the camera to the screen. I have also successfully used the right click image grab to collect a snapshot from the camera - and that seems to be fine.

However, the movie capture (to .avi) is poor and I haven\'t managed to get that working.

Anyway, moving on to my attempts to get a good timed capture utility - I read on this page (http://www.roe.ac.uk/~hme/webcam/acquire.html) about an image acquisition application called castream. I downloaded the sources and gave it a try..:

camstream v 0.26.2

./configure && make && make install - all ran fine
shell> camstream - pushed up the camstream application and a new window opened a feedback from the camera - cool

the response was much slower than with xawtv - and it crashed much quicker, but there y\'go - If I can just get this thing to grab snapshots, then my mission is accomplished.. moving on.

Well, although the website shows some lovely functionality - on a par with that of webcam32, I rarely got further than loading the viewer. Even moving the mouse during the load would cause the application to halt - and once the viewer was loaded, the toolbar was just about unclickable

cqcam v0.91

compiled easily and looked simple enough - in fact it reminded me of the w3cam application I tried back in time anyway, a simple command such as the one below only managed to create an empty file - and didn\'t return a prompt. I tried all sorts of combinations of what was generated by prompt> cqcam -h but to no avail.. oh, here\\\'s that example:

cqcam -d /dev/video0 -j > /home/chris/images/test.jpg

I wonder if there is something else out there I might try....

Poor man\\\'s can

Mote, PMC won\'t actually talk to the v4l device. all it does is collect output files and do something vaguely useful with them.. ie comvert them and place them somewhere else. The thing that makes PCM interesting to me at the moment is that it can act as a wrapper round qcam, and by building a mainingful $HOME/.pmcamrc, PMC might take control of qcam, which I have failed to get working.. let\'s see..

dependencies are listed as:

* ImageMagick (specifically mogrify)
* qcam
* perl
* Net:FTP (This should be standard with perl)
* {OPTIONAL} Stamp (http://stamp.netpedia.net) is now usable from

first step, install ftp://ftp.cs.unm.edu/pub/chris/quickcam/qcam-0.91.tar.gz
next, ImageMagik: I installed the rpm ImageMagick-5.5.7-1.i386.rpm
perl - I already have it
Net::FTP - installed thanks to cpan>
Stamp - I can\'t be arsed with that one right now.

Now, construct that .pmcamrc file:

camera_command qcam
camera_options -x 320 -y 240 -E0 -s1
filename webcam
ftp_server brezhnev
ftp_directory /home/iain/webcam/grabbed
ftp_account iain
ftp_password wda4qhyf
convert_command mogrify -format jpg
seconds 2
debug 1
delete 1

and make sure that the pmcam.pl script is somewhere im the executable path..

Running the script will initally error on line 38 ( at least in the version I\'m using, cos the creator hard-coded in the path to his .pmcamrc file, which means that it still points to /home/craig/webcam..or whatever.

Fix this, then try again. I did and this is what happened:

[chris@kerenski chris]$ pmcam.pl
Qcam not found
Cannot open QuickCam; exiting.

I have tried running as root as well as chris, but this really seems to be a problem with qcam not finding the /dev/video0 device. I tried to leverage some of the intel pmc has provided back into my use of cqcam, but to no avail.. however, I do see a promising utility lying around which goes by the name of....:


I have been put off this application up until now, because of the nasty images of a very sad looking dude apparently trying to let out a fart (see the lower half of http://csce.unl.edu/~cluening/gqcam/). But anyway, farting prejudices vanquished, I decided to give it a go.. here goes:

1) download the sources and extract:
prompt> wget http://csce.unl.edu/~cluening/gqcam/download/gqcam-0.9.tar.gz
prompt> tar -zxvf gqcam-0.9.tar.gz && cd gqcam-0.9

followed by the ususal ./configure && make to build it

I decided to just forget about reading the docs and try running the appilcation with ./gqcam from the local folder (I could see the binary waiting there for me). Running it, gave the error:

/dev/video: Is a directory

well so what? I don\'t care what /dev/video is - I want this thing to look at /dev/video0, which is where my camera is haging out.. so let\'s try something else.

[root@kerenski gqcam-0.9]# mv /dev/video /dev/video.old
[root@kerenski gqcam-0.9]# ln -s /dev/video0 /dev/video
[root@kerenski gqcam-0.9]# ls -al /dev/video

So I moved the /dev/video device out of the way, and then symlinked /dev/video to /dev/video0 - bit of a hack, but let\'s see if it works.

./gqcam then fired up a lovely looking application , with a 6fps feed off my qc, with no crashes and a usable GUI. Remarkable -. Unfortunately the colours are a bit odd and the screen does look very blue - either that or very, er, something else (I\'m colour blind and reds/greens can be a problem).. but lo and behold, the little bugger works !! - and here\'s some info about my camera:

Name: Logitech USB Camera
Type: 513
Can capture
Can capture subareas of the image
Channels: 1
Audios: 0
Maxwidth: 352
Maxheight: 288
Minwidth: 176
Minheight: 144
X: 0
Y: 0
Width: 352
Height: 288
Chromakey: 0
Flags: 30
Brightness: 49408 (193)
Hue: 59392 (232)
Color: 52736 (206)
Contrast: 45824 (179)
Whiteness: 0 (0)
Depth: 24
Palette: 4

I\'m off to play now - there are timing utilities imcluded with this package, and I understand it can also be fun from the command line. I\'ll post back if I managed any remarkably useful hacks :)

reply icon