HOW TO:- Logitech Pro 4000 webcam with 2.4.22 Kernel

Talk about anything related to Gentoox or Gentoo.
Post Reply
XBoxgeek
Pro
Posts: 77
Joined: Sat Sep 27, 2003 6:55 pm
Location: London
Contact:

HOW TO:- Logitech Pro 4000 webcam with 2.4.22 Kernel

Post by XBoxgeek »

*** Tutorial:- Installation of a Logitech Pro 4000 webcam with 2.4.22 Kernel ***

Both Trixter & myself have spent a fair bit of time trying to get our Logitech Pro 4000's working with GentooX & until 2.4.22 this was not possible (if it was we could not figure it out :lol: ) Now 2.4.22 is released for Gentoox it is a simple process.

We wanted to be able use our pro 4000 directly with the xbox & have an app that would take a snapshot every x seconds and save this to the root of our apache web-server.

Step 1:-
You will need to upgrade your Kernel to 2.4.22. Read this tutorial for instructions.
Do an emerge sync to get an up-to-date list of applications.

Step 2:-
emerge usb-pwcx
emerge camsource

This will install the pwc driver pack and camsource. Camsource is the application we are going to use to stream/serve our webcam feed.
Note:- The pwcx driver supports a lot more webcams then just the pro 4000. Take a look here for a complete list

Step 3:-
Once this is done we need to configure the pwc driver to load automatically, as well as add some default parameters so the driver will work correctly.

For a full list of parameters that can be passed to the pwc driver at load time look here

For my purpose I just need "pwc size=sif" this allows me to capture at 320x240.
You can change size to:-
sqcif for 128x96
qsif for 160x120
qcif for 176x144
sif for 320x240
cif for 352x288
vga for 640x480

All the other parameters I just accept the default.

To autoload this module you need to:-
pico -w /etc/modules.autoload
under "hid" add
pwc size=sif
Hit ctrl+x, then y, then enter
plug in your webcam
reboot

To check that pwc has loaded type lsmod from a command prompt. You will see that pwc has also loaded 2 other modules:-

Code: Select all

pwcx-i386              87040   1
pwc                    44520   1  [pwcx-i386]
videodev                6176   2  [pwc]
That's it for the driver, now we need to work on Camsource.

Step 4:-
When you emerged camsource it created a camsource.conf.example file in /etc
you will need to edit this file and rename it to camsource.conf for it to work. I suggest making a copy of this file just in case you mess up. To do this type:-
cp /etc/camsource.conf.example /etc/camsource.conf
from a command prompt and then edit camsource.conf to your liking.

Camsource can ftp an image to a remote ftp site, it has a built in webserver to view your images from a web browser, it can also just save an image locally. The last option is the one I am interested in and my camsource.conf looks like this:-

Code: Select all

?xml version="1.0"?>
<!-- $Id: camsource.conf.example,v 1.56 2003/05/01 10:29:11 dfx Exp $ -->

<camsourceconfig>

	<!-- Global config options -->
	
	<camdev>			
		<plugin>input_v4l</plugin>
		<path>/dev/video0</path>
		<width>max</width>
		<height>max</height>
		<fps>4</fps>
		<channel>0</channel>
		<norm>auto</norm>

		<!-- <brightness>32767</brightness> -->
		<!-- <hue>32767</hue> -->
		<!-- <colour>32767</colour> -->
		<!-- <contrast>32767</contrast> -->
		<!-- <whiteness>32767</whiteness> -->
		<autobrightness>60</autobrightness>
	</camdev>
	
	
	<logfile>~/.camsource.log</logfile>
	
	
	<module name="input_v4l" active="yes"/>
		
	
		
	<module name="filewrite" active="yes">
	        <path>/home/httpd/htdocs/TinCam.jpg</path>
		<interval unit="sec">15</interval>
		<chmod>0644</chmod>
		<filter name="text"/>
	</module>
	
	<module name="text" active="yes">
			<text>%b %d %Y %H:%M:%S</text>
			<color>ffffff</color>
			<bgcolor>000000</bgcolor>
			<pos>tr</pos>
	</module>
		
	
	<module name="jpeg_comp" active="yes">
	  <quality>75</quality>
	</module>	
	
	<module name="flip" active="no"/>
	<module name="resize" active="no"/>
	
	<module name="rgbbgr" active="no"/>
	<module name="rotate" active="no"/>
	<module name="bw" active="no"/>
	<module name="motiondetect" active="no"/>
	<module name="regrab" active="no"/>
	<module name="invert" active="no"/>
	
		
	<filter name="rgbbgr"/>
	<filter name="rotate">
		<direction>right</direction>
	</filter>
	<filter name="bw"/>
	<filter name="invert"/>
	
</camsourceconfig>
This config file will:-
Take a snapshot every 15 seconds
Add the time & date to the top right of the image
save the image as TinCam.jpg
to /home/httpd/htdocs/
with a jpg compression level of 75
Take a good look at the original camsource.conf.example to see all the options and comments.

Once you have done that we can start camsource by typing camsource from a command prompt. If all went well you should see this:-

Code: Select all

Camsource 0.7.0 starting up...
Loading modules:
  input_v4l (alias input_v4l) version 0.7.0 OK
  jpeg_comp (alias jpeg_comp) version 0.7.0 OK
  filewrite (alias filewrite) version 0.7.0 OK
  text (alias text) version 0.7.0 OK
Main init done and logfile opened.
Closing stdout and going into background...
I must admit I sometimes get an error regarding FPS at this point, I just type "camource -k" to kill the process and then type "camsource" again to restart it. (I have only had this error once or twice)

Once it is running you will find it has created your image in the directory you specified in the config file.
Like this:-
Image

That's it!! :lol:

You may want to create your own config file or change the pwc driver options to suit your own needs.

Good luck :wink:
XBoxgeek
Post Reply