PreshBlog

Logitech QuickCam Messenger under Linux

by on May.23, 2007, under Linux, System Administration

Logitech QuickCam MessengerI bought a cheap (~£20) Logitech Quickcam Messenger to connect up to my Linux box at home to act as a basic security camera – coupled with the cunningly-titled motion detection program “motion”, it can detect movement, capture images and/or video, and execute any commands etc. (More on this setup in a future post!).

The Linux kernel now includes a quickcam_messenger driver, but it didn’t work for my camera. Checking the USB ID showed that it’s a different product ID, so they’ve changed the way the camera works, but kept the name (I wish they wouldn’t do that). I had to use the spca5xx/gspca driver.

I compiled a nice fresh 2.6.21.1 kernel, being sure to include Video4Linux support, along with the quickcam_messenger driver. Fine, apart from the camera wasn’t detected or handled by the quickcam_messenger driver. Doh.

Checking the USB vendor/product ID shows:

[root@supernova:/usr/local/src]# lsusb | grep Logitech
Bus 003 Device 003: ID 046d:08da Logitech, Inc.

So it’s vendor ID 046d (0x046d) and product ID 08da (0x08da).

A quick Google suggests that this ID is handled by the spca5xx driver. It seems spca5xx is being superceded by gspca, which supports ridiculous numbers of different cameras. The gspca compatibility chart shows that my cam should be supported.

I downloaded the driver, and untarred it. Installation consists of a script called gspca_build (which needs to be run as root).

If all goes well, you’ll end up with output a little like the following:


COMPILE gspca Please Wait ....!!
INSTALL gspca in the kernel binary tree
mkdir -p /lib/modules/`uname -r`/kernel/drivers/usb/media/
rm -f /lib/modules/`uname -r`/kernel/drivers/usb/media/spca5xx.ko
rm -f /lib/modules/`uname -r`/kernel/drivers/media/video/gspca.ko
install -c -m 0644 gspca.ko /lib/modules/`uname -r`/kernel/drivers/usb/media/
/sbin/depmod -ae
LOAD gspca in memory
PRINT COMPILATION MESSAGES if ERRORS look kgspca.err
make -C /lib/modules/`uname -r`/build SUBDIRS=/usr/local/src/gspcav1-20070508 CC=cc modules
make[1]: Entering directory `/usr/src/linux-2.6.21.1'
CC [M] /usr/local/src/gspcav1-20070508/gspca_core.o
CC [M] /usr/local/src/gspcav1-20070508/decoder/gspcadecoder.o
LD [M] /usr/local/src/gspcav1-20070508/gspca.o
Building modules, stage 2.
MODPOST 1 modules
CC /usr/local/src/gspcav1-20070508/gspca.mod.o
LD [M] /usr/local/src/gspcav1-20070508/gspca.ko
make[1]: Leaving directory `/usr/src/linux-2.6.21.1'
[root@supernova:/usr/local/src/gspcav1-20070508]#

OK, that looked promising, it’s compiled us a new kernel module (note – this won’t work if you don’t have kernel sources installed).

Let’s see if the new module got loaded:


[root@supernova:/usr/local/src/gspcav1-20070508]# cat /proc/modules
gspca 651088 0 - Live 0xde99e000

It did indeed.

I’d already installed and configured motion to capture video from the camera and do motion detection, so it was just a case of starting it, and sure enough, it now captures perfectly!

Update: you can buy the Logitech QuickCam Messenger on Amazon (or what looks like a newer version).


I hope this brief write-up is useful to someone trying to get it to work. Do let me know in the comments :)


8 Comments for this entry

  • Wilbert

    I’m sure somebody will find this useful, but I regret to say that I got the same webcam (ID 046d:08da) working with the latest Ubuntu (7.04) without any hassle. Plugged it in and it worked!

    I also use motion which does a nice job watching my front door. I’m wondering what the native resolution is of the camera. According to the box it is 320×240.
    But motion does a better job at 640×480. The hallway may not be the brightest place in the house, but at 640×480 I get a decent picture, while at 320×240 it is too dark.
    BTW: In both cases I have auto_brightness turned off.

    I would like to know what your experiences are and which settings you are using.

  • bigpresh

    @Wilbert:

    Glad your experience was even smoother :)

    I assume Ubuntu already had the right kernel module available for this camera (IIRC, they compile just about everything as a module).

    The machine I performed the install on had a custom-compiled kernel containing just the stuff needed for this particular machine.

    I run my cam at 640×480, although the picture isn’t great.

    When I plug it in, dmesg shows the following:


    /usr/local/src/gspcav1-20070508/gspca_core.c: USB GSPCA camera found.(ZC3XX)
    /usr/local/src/gspcav1-20070508/gspca_core.c: [spca5xx_probe:4098] Camera type JPEG
    /usr/local/src/gspcav1-20070508/Vimicro/zc3xx.h: [zc3xx_config:515] Sensor ID:7
    /usr/local/src/gspcav1-20070508/Vimicro/zc3xx.h: [zc3xx_config:597] Find Sensor HV7131R(c)
    /usr/local/src/gspcav1-20070508/gspca_core.c: [spca5xx_getcapability:1215] maxw 640 maxh 480 minw 176 minh 144

    From the last line of that, it seems to agree that 640×480 is the max resolution the camera provides.

    I’m still experimenting with my settings for motion, I need to mount the camera properly, then get it all configured. Ideally, I’d like a way to deactivate motion sensing before entering, so I don’t get events of me entering recorded, with alerts etc being sent. I’ll detail all the setup in a future blog post :)

  • Wilbert

    It looks like I got it working quite well now. But I have to test it a few days in different light conditions.
    Most pictures and films I get contain my girlfriend or me entering or leaving the house. But I also get a notice when the local newspaper is delivered. (The letterbox is in the door and can be seen by the camera.) OK, it is not really useful, but it is fun to get the pictures and films in the mail. And I am able to watch the front door live, via the build in webserver.

    Maybe you can use bluetooth to let the watchdog know that it is you. You can use a mobile phone with bluetooth switched on and a bluetooth USB-stick in your computer. That’s the hardware part… :-)

    Most useful setting in motion.cfg I found was ‘minimum_motion_frames’. It prevents sending me mail when there was (what looks like a) short distortion in the image or a bad frame.

    My girlfriend came up with a nice idea: make it a real watchdog. Let it bark when someone opens the door. Hmmm… I think I have a spare speakerset somewhere and the sound of an angry dog should be easy to find on the net… :-)
    (to be continued!)

  • bigpresh

    @Wilbert:

    Maybe you can use bluetooth to let the watchdog know that it is you. You can use a mobile phone with bluetooth switched on and a bluetooth USB-stick in your computer…

    Genious! :) That would do the job nicely… a USB Bluetooth adaptor on an extension cable to bring it near the door, and a script on the computer continually scanning for Bluetooth devices… when a device with the right “MAC” (or the Bluetooth equivalent) comes into range, disable motion detection.

    With a second cam to cover the area outside the door, and some X10-style switchery, the system could even turn on the lights when someone approaches – doing the job of a PIR sensor, but with fine-grained control over the area monitored for movement.

    I like the watchdog idea too… bonus points for using a decent sub-woofer to get a really deep, scary growl, and delaying the sound so that it happens once they’re already inside… that’ll have then running quick! (I guess another scary sound would be a shotgun being loaded ;) ).

    And yes, I’ve used minimum_motion_frames to avoid false alarms – so far, it seems to work well. I currently have it set to 8 frames. I have lightswitch set to 70 to hopefully ignore lights going on/off (need to test that properly).

  • Wilbert

    @bigpresh:

    I found a tool called “btscanner” in the Ubuntu repository.

    btscanner is a tool designed specifically to extract as much information
    as possible from a Bluetooth device without the requirement to pair.

    Sounds good!

    And here someone uses it for intelligent call routing with the Asterisk open source PBX (highly recommended BTW :-)). In the script a grep is done on what looks like a MAC-address.

    You can let the system compile a list of Bluetooth-MAC’s and use it as a kind of password.

    Hmmm… X10. I looked at it a few years ago. Must be fun. The combination with Bluetooth MAC’s opens up new possibilities.

    Cheap home automation is starting to get reality. The ingredients:
    – webcam(s) with motion (detects motion)
    – bluetooth recognition (identifies people with mobile phones)
    – X10 home automation (switch equipment)
    – Asterisk (place a call or react on it)
    – email (send email at a certain event or react on it)
    – Jabber (send message at a certain event or react on it)

    Let the fun begin! :-)

    So, if you’re leaving home your home is watched by webcams, a watchdog lets intruders know that it is better to leave, incoming phone calls are relayed to your mobile phone, you get an email/SMS/MMS/IM (if possible with picture and or film) when something is detected by your webcams (or your Bluetooth device), etc. etc.

    If I only had time…

  • bigpresh

    @wilbert:

    Nice one – btscanner looks like just the thing I’d need, thanks!

    There’s so many things you could do. If you could have a secure way of identifying your phone that couldn’t be faked, you could even do away with keys, and have electronic locks, released when your phone is in range. (With a mechanical key to override in case the power is out, or the system is otherwise dead).

    I’d be interested to see how long it would take the system to detect the bluetooth device in range (and pair with it to perform some sort of authentication).

    I look forward to the day I get home, walk towards the front door and the door unlocks, lights come on (if it’s dark), my music comes on, and the coffee machine starts up. :)

  • mac

    Thanks to you & thanks to Mathias Küster too !
    This infor was provided by mathias :

    Here are some information about the driver:

    * Support for Quickcam Messenger (0x046D, 0x08F0)
    * Support for Quickcam Messenger Plus (0x046D, 0x08F6)
    * Support for Quickcam Communicate (0x046D, 0x08F5)
    * 162×124, 162×248, 324×124, 324×248 resolution available
    * Auto exposure works (need some tuning though)
    * Auto shutter-control works (need some tuning though)
    * Read status of the button on the camera
    * Compressed format is still unknown
    * Driver is compiled and tested with Quickcam Messenger and
    * Fedora Core 1 (kernel 2.4.22-1.2197.nptl) and
    * Fedora Core 3 (kernel 2.6.9-1.667smp).
    * Fedora Core 4 (kernel 2.6.14-1.1637_FC4).
    * Fedora Core 6
    * Kernel 2.6.15
    * Kernel 2.6.18
    * Kernel 2.6.19
    * Ubunto Feisty, Kernel 2.6.20

  • wanderer

    hey folks,

    nice post, thank you for your reportings, and I attached the 046d:08da (logitech quickcam, lol) too at my linux-server and it works right well. have installed the gspca too, cause my kernel was a self-build one also (2.6.24.3) and didn’t supported it from scratch on. but I’m not this great admin and still experiencing ;-).
    at the moment I’m grabbing pics with “v4lctl -c /dev/video0 snap jpeg 160×120 test.jpg”. though this works I would like to make pics with a resolution of 320×240 or 640×480 which the cam supports I think. but v4lctl doesn’t produce a pic when using a higher resolution. using the debug mode “-v 2” does not throw an error. maybe one of you has an idea what is going wrong.
    anyway, don’t spend too much time with this, ;-), beeing a much experimenting guy I perhaps will find a solution in the coming year, lol.

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!