Thursday, August 2, 2007

Ubuntu 6.10 + Logitech QuickCam Pro 4000

Quirky little thing, the QuickCam Pro 4000 is on the Ubuntu 6.10...

First make sure your Ubuntu detects the device:
  • From the Terminal, do: lsusb (it gives a list of USB devices that are connected to your PC)
  • If it finds the webcam, it should say something like: Logitech, Inc. QuickCam Pro 4000 in one of those Bus 00# Device 00#: ID ####:#### lines. If not, I don't have an answer to that yet.
To make it work, you need the pwc driver: pwc-10.0.12-rc1 which you can obtain from http://www.saillard.org/linux/pwc. A very nice and helpful site, I must say. On the main page, under Documentation you can find a handy howto to install the driver (click on the "Read this Howto to install the driver in English" - if you're opening it in Windows, just use Notepad/Wordpad to read it). Scroll down until you find the Files section and click on the "Full source code that don't need patching the kernel" link to get the file.

Just FYI, I'm using Ubuntu 6.10 with 2.6.17-12-generic kernel. After you get into the Files page, grab the latest version: pwc.10.0.12-rc1.tar.bz2 (per the time this blog is written (Aug '07) ), the description of the file should say: "Last Updated: Apr 13, 2006, Size: 47.72 KB".

(The following explanations are done on the Terminal, unless noted otherwise)

A little quirk here... For some reason when I try to unpack the file with the command:
tar xjf pwc-10.0.12-rc1.tar.bz2

It failed with the message:
bzip2: (stdin) is not a bzip2 file.
tar: Child returned status 2
tar: Error exit delayed from previous errors

No idea why, since I do have bzip2 installed. Therefore, I prefer to download it from the website (instead of using wget http://www.saillard.org/linux/pwc/files/pwc-10.0.12-rc1.tar.bz2 from the Terminal) using Firefox (for example) and choose Open File which automatically unpacks the file with some other unpacker and just unpack it in some folder (/tmp/pwc10012rc1 for example).

Once it is unpacked in that folder, go to that folder, and you should see the Makefile in it.

Do make

Before doing anything else, check to see if you have an older version of pwc installed
  1. go to /lib/modules
  2. do ls -- you should see several folders that indicates your available kernels, for example: 2.6.17-10-generic 2.6.17-11-generic 2.6.17-12-generic
  3. go to whichever kernels (folder) you're using (for example: I use the 12, so i go to it: cd 2.6.17-12-generic)
  4. then do find -name "pwc*.ko*"
  5. if you have an older version of pwc installed, it should give some result like: ./kernel/drivers/usb/media/pwc.ko
  6. Get rid of that old file by doing: rm ./kernel/drivers/usb/media/pwc.ko (make sure you have the right path... If you're not sure, go into the folder where the file pwc.ko is, and do rm pwc.ko from there
Once you got rid of the old pwc, go back to the folder where you unpacked the new pwc, and login as root: sudo su (that's how Ubuntu does it)

Then do make install. What this does is copying the new pwc.ko into the folder where the old pwc.ko used to be. So, another way to do it is to simply copy the new pwc.ko into that folder using the cp command (i.e. cp pwc.ko /lib/modules/2.6.17-12-generic/kernel/drivers/usb/media/) Note that you have to login as root to be able to write or modify anything in those root folders (folders that are located in the ~root directory (which is one folder up from your /home directory))

After all is done, reboot your PC and you should have your Logitech QuickCam Pro 4000 up and running. I used Camorama (installed from the Package Manager) to test it out.

Here's a good website: http://www.noah.org/wiki/index.php/Logitech_QuickCam_Pro_4000_on_Ubuntu

It explains the installation process step-by-step (and far more 'cleaner' than my explanation here). However I got stuck on step 2 (imagine that) when I tried to unpack the file (see the above explanation on unpacking using tar command).

NOTE:
I tried looking the pwc up through the Package Manager. It founds a version: pwc-10.0.12-rc1-1 however, when I installed it, it didn't seem to work. So I would suggest to avoid that for now. Downloading it and installing it from the saillard.org website is straightforward enough, and doesn't cause too big of a headache.
Also, if you tried it from the website and it didn't work, don't panic and grab the libpwc files listed on the site... you don't need it for now. Look around some more (google).

Off we go with some image processing with OpenCV!