I'm Ready for my Cam Closeup

When I started, I had no idea what should happen when a cam is plugged in and what has to be done to make it work. That's a bit like flying blind to a target unknown--frustrating indeed. It would have been immensely helpful if I had some idea of what the end result ought to be.

What I now know is that it all works automagically--provided the necessary driver modules are bundled with the kernel and the hotplug agent is properly set up. I was using Mandrake 9.1 so both were true. Thus, the challenge mostly is in selecting the cam device.

(Note: If you have trouble seeing the listings below, hit "switch to printable format" at the bottom of the page.)

Here is a rough description of what you should expect when you install your cam:

  • Plug the cam into the USB port.
  • The kernel detects the insertion and invokes the hotplug agent. The hotplug process (hopefully) recognizes the cam type and loads the required device modules.
  • You should be able to see this process in the /var/log/messages file. Here is an example:
    kernel: hub.c: new USB device 00:07.2-1, assigned address 3
    kernel: usb.c: USB device 3 (vend/prod 0x5a9/0xa511) is not claimed by any active driver.
    /etc/hotplug/usb.agent: Setup ov511 for USB product 5a9/a511/100
    kernel: i2c-core.o: i2c core module version 2.7.0 (20021208)
    kernel: Linux video capture interface: v1.00
    kernel: usb.c: registered new driver ov511
    kernel: ov511_main.c: USB OV511+ video device found
    kernel: ov511_main.c: model: Generic Camera (no ID)
    kernel: ov511_main.c: i2c write retries exhausted
    kernel: ov511_main.c: I2C write error (-1)
    kernel: ov511_main.c: Sensor is an OV6620
    kernel: ov511_main.c: Device 3 on bus 1 registered to minor 0
    kernel: ov511_main.c: v2.16 : ov511 USB Camera Driver
    
  • Here is an example of what an unsupported cam looks like:
    kernel: hub.c: new USB device 00:07.2-2, assigned address 5
    kernel: usb.c: USB device 5 (vend/prod 0x46d/0x810) is not claimed by any active driver.
    /etc/hotplug/usb.agent: ... no modules for USB product 46d/810/100
    
  • After a successful hotplug, you should have both a cam driver module and the videodev driver module loaded into the kernel. I verified this for my ov511 cam by doing:
    $ /sbin/lsmod | grep ov511
    ov511                105580   0
    videodev               7872   1 [ov511]
    i2c-core              21192   0 [ov511]
    usbcore               72992   1 [ov511 usb-uhci]
    

    I knew I needed to search for ov511 by looking at the messages log to find which driver was registered.

  • The videodev module should have created the appropriate nodes in the /dev directory.
    $ ls -l /dev/v4l/* /dev/vid*
    crw-------    1 chip     sys       81,   0 Dec 31  1969 /dev/v4l/video0
    lr-xr-xr-x    1 root     root           10 Oct 14 10:31 /dev/video -> v4l/video0
    lr-xr-xr-x    1 root     root           10 Oct 14 10:31 /dev/video0 -> v4l/video0
    

    Notice how the cam hotplug script was clever enough to give me ownership of the video0 device.

  • At this point you should be ready to crank things up. I found xawtv and camstream to be useful utilities for testing the cam. Mandrake 9.1 includes RPMS for both. For my application, I'm using the webcam utility that's part of the xawtv package.

See, wasn't that easy? The tough part is yet to come: selecting a compatible cam.

There is an online database of USB cams that are supported by Linux. It was useless for this task. Most of the entries are for devices you can't find in the store, and current models are frequently not listed. Moreover, the data are user-contributed and not verified, and thus suspect. For instance, is the Ezonics USB Cam II compatible or not? The database provides conflicting answers. It doesn't can't seem to agree on the name of the device, let alone whether or not it works. (Answer: this cam was made with three different chipsets. Some work, others don't.)

The best solution for finding a compatible device is to visit the web sites for the various cam drivers. These sites will tell you which web cams are supported and provide any necessary documentation you might need to get it going. Here are some of the driver sites I visited:

  • pwc - Phillips Webcam. This driver supports the current mid-to-upper end Logitech cams, among others. The driver is included with Mandrake 9.1. The compressor module is not! More on that in a sec.
  • qce - Logitech QuickCam Express. The driver module actually is called mod_quickcam and is included in Mandrake 9.1.
  • Mandrake 9.1 also includes the following drivers for older and lower-end cams: cpia and ov511

I ended up selecting the Logitech QuickCam Zoom and I'm delighted with it. It provides clear, sharp images at resolutions up to 640x480. I'm surprised at how well it does in low-light situations. It is supported by the pwc driver, so Mandrake recognized it.

There was just one tiny problem: at anything but the smallest image sizes you get nothing but a green image. That's because at the larger sizes the cam compresses the image, and decompression is handled by a separate pwcx module. That module is not provided with Mandrake Linux because it's not available in source form. The author had to sign a non-disclosure to get the specs. He provides a binary version at his web site. So, I download the module and installed it manually.

Here is what I did:

  • Download the pwcx and unbundle the archive.
  • Run:
    # cp usb-pwcx-8.2.2/x86/gcc-3.2/pwcx-2.4.20.o /usr/local/webcam/pwcx-i386.o
    
  • Add a line to the end of /etc/modules.conf that says:
    post-install pwc /sbin/insmod --force /usr/local/webcam/pwcx-i386.o >/dev/null 2>&1 || :
    

I'm pleased with how well the cam works under Linux. Under Windows, it's another story. The bloated Logitech crapware trashed my Windows 98 installation. The system now boots up to no taskbar, no icons and no processes running--not even the Windows Explorer. This happens even in safe mode! So, the next time somebody tells you how much easier it is to setup stuff on Windows than it is on Linux, point them here.

Comments

Comments have been closed for this entry.

re: I'm Ready for my Cam Closeup

Very helpful! I've done a lot with video/webcams since 1997, and haven't been too impressed with the new USB cams, nor the quality I've gotten from the Linux drivers of the few I've tried, but after looking at your page, and the great quality image (compared to ones I've seen), I decided to have a go at it.

Here's MY experience on Redhat 9:

I took your advice and got the Logitech QuickCam Zoom.

Plugged it in to the USB port, but it was not recognized.

I checked my version of "hotplug" and it was from April 2002 (as installed from the RH9 CDs). I went to http://sourceforge.net/project/showfiles.php?group_id=17679 and downloaded the latest RPMs of hotplug for RH9, and they installed fine.

This time, when I plugged in the camera it was detected just fine, and the pwc driver was loaded. I got a picture with xawtv, but, as you said... only the smallest size image.

So, I grabbed the pwcx bundle you linked to above...
copied the proper driver to the modules directory (for RH9) "cp pwcx-2.4.20.o /lib/modules/2.4.20-20.9/kernel/drivers/usb/"
then "depmod"
and finally "insmod --force /lib/modules/2.4.20-20.9/kernel/drivers/usb/pwcx-2.4.20.o" to load the module.

Of course it spit out some warning about mismatched kernel version (Redhat adds their extra version number), but after it was loaded I was able to get larger image sizes.

Hopoefully this will help someone who wants to do it on Redhat !

re: I'm Ready for my Cam Closeup

My sister has exactly the same problem as you got when you installed the Logitech Zoom on Win 98. Please can you tell me what you did to fix this? (Her university degree may depend upon this problem being solved!)

Please could you email me if you have the solution. Thank you very much in anticipation.

re: I'm Ready for my Cam Closeup

I was not so lucky as you guys :-(

At home I have Mandrake 9.2 installed.
First I had to upgrade kernel because the default one from the CD had a bug. Any time when I plugged the Logitech Zoom - my system just stop responding...
After upgrading the kernel I could see pwc/pwcx and videodev modules loaded but any time I was trying to get an image camstream just reported I/O timeouts...

Next I was trying webcam under Mandrake 9.1 in my office.
I got other type of problems.
It looks like hotplug is not working there.
(It is installed, I checked)
When I manually insmod pwx I could see
normall messages in the log, but
no videodev.
I was following Chip's instructions, but it looks like my MDK9.1 installation does not have all required packages installed.

Anyway, I'm planning to bring back my Logitech Zoom cam. The biggest problem with it is dependency from the binary driver (pwcx).

Everytime when you change/upgrade your kernel you are on a mercy of module the provider...

Yes, and I tryed it on my frieds XP notebook.
I works just fine.