Hari's Corner

Humour, comics, tech, law, software, reviews, essays, articles and HOWTOs intermingled with random philosophy now and then

Getting the HP Pavilion 6314 in-built webcam working on Linux

Filed under: Tutorials and HOWTOs by Hari
Posted on Thu, Dec 20, 2007 at 20:04 IST (last updated: Wed, Oct 29, 2008 @ 21:53 IST)

I have just discovered how to get the in-built webcam on my HP Pavilion laptop (webcam model: Microdia) to work in Linux. Since I haven't found a single clear tutorial on this particular model anywhere on the web (and knowing that such obscure topics do require to be documented), I wanted to write this tutorial and to create a record for my personal future reference as well as for the benefit of others with a similar issue.

This tutorial works with Debian. For other distributions that don't have module-assistant, simple compile the driver source as you would normally do: make, make install and copy the module output file to the directory /lib/modules/2.6.x/ (substitute 2.6.x for your kernel version).

Get the kernel headers

You should first install the kernel headers package. On my system this is currently the package named linux-headers-2.6.22-3. Usually the package is named kernel-headers or linux-headers along with the version number. Choose the correct headers package matching your running kernel.

The command is
apt-get install linux-headers-2.6.22-3

Get the source code for uvcvideo

On Debian this package is named linux-uvc-source. If you cannot find that package simply download the uvc sources from this website: http://linux-uvc.berlios.de/ and compile the driver like you would compile any other application.

On Debian (or Debian-like systems, e.g. Ubuntu) run:
apt-get install linux-uvc-source

This will automatically install module assistant and other necessary tools to simplify compiling and installing this driver.

Install the driver module

Login or su as root and then run the following commands.
m-a prepare
m-a a-i linux-uvc

That's it! This will automatically compile and install the kernel module required for this device. Then run modprobe to load the driver:
modprobe uvcvideo
If you didn't get any error messages at this stage, you've successfully installed the driver! Otherwise check whether your compilation failed and why it did. module-assistant works 99.99% of the time on Debian since it automatically takes care of the necessary dependencies.

Now check the video output

To check whether video works, you can use ffmpeg. Install ffmpeg (if you haven't already) using apt-get. Then to test whether recording works via the webcam run something like this:
ffmpeg -f video4linux2 -s pal -i /dev/video0 temp.mpg
It won't show anything while recording, but the blue LED near your webcam's lens show now glow. After you have recorded for a few seconds, quit ffmpeg and play back the temp.mpg file to check the video output. Obviously audio wouldn't have been captured in this case. But I can confirm the the built-in microphone on this laptop also works with ALSA, so you should merely have to specify the audio input parameter in ffmpeg.

That's all. If I have missed out any steps or you have any questions regarding this HOWTO, just feel free to drop a comment here! :)

4 comment(s)

  1. Tip: to get the proper version of linux headers use `uname -r`.

    Comment by Ramshankar (visitor) on Fri, Dec 21, 2007 @ 11:06 IST #
  2. Ram, that's a good idea.

    Comment by hari (blog owner) on Fri, Dec 21, 2007 @ 11:29 IST #
  3. It worked for me too, thanks a lot :) But I had to install udev and reload the modules (can also do a restart).

    Comment by shadow.seeker (visitor) on Tue, Apr 1, 2008 @ 10:14 IST #
  4. Shadow.skeer, I assumed that most people using Linux have switched to udev. At least Debian users should have, by now. :yes:

    Comment by hari (blog owner) on Tue, Apr 1, 2008 @ 10:23 IST #

Comments closed

The blog owner has closed further commenting on this entry.