Category: HowTos

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

Posted at 08:04:26 pm by hari under Linux/*nix, HowTos (1220 views)

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! :)

My first GIMP video tutorial - lighting and bump mapping

Posted at 09:57:40 am by hari under HowTos, Software, Videos (897 views)

I thought it would be cool to create a video tutorial showing how easy it is to use GIMP to create 3d objects using lighting and bump-mapping effects, combined with the 2d blending mode. More than words, this video shows how simple GIMP really is. Writing a full fledged tutorial would have complicated the whole process. I created the following video using XVidCap.

(Yes, YouTube does blur the video even though I tried to keep the captured region as small as possible)

GIMP tutorial - creating a Kubrick-like website theme

Posted at 01:18:01 pm by hari under HowTos, Software (1871 views)

Kubrick is the default theme used by WordPress and it's a quite popular theme to build upon, but the plain blue header image used is quite unattractive. Here I'll show you how easily you can create web headers which look like Kubrick but with header graphics of your own choosing. All you need is to choose a decent image to use as a header and you can prepare it in GIMP to use with your style sheets. A good header looks extremely attractive in a curved, fixed width theme and here's how you can get the images you need to create your style sheet.

Step 1: Get a good header image

Screen 1

Open a good header graphic you want to use in GIMP. I've chosen a simple blend effect as a background image, but you can use cross-sections of good photos or any other background image which you think fits in well with your theme.

Click on a page number to continue the tutorial. :)

Pages: 1 · 2 · 3 · 4 · 5 · 6 · 7

Combating the mosquito menace

Posted at 02:15:20 pm by hari under General, HowTos (257 views)

I mentioned the mosquito problem in passing in a previous article of mine, but I've been reluctant to expand upon it, mainly because I didn't want to be seen as complaining too much about our new home. But I decided to write a post on the ways in which we combat the problem, so that it doesn't seem totally negative in tone. Anyway, here goes!

Window screens

Net screens on windows and doors are largely ineffective, but they are the first line of defence against swarms and swarms of mosquitoes which seem to attack with a persistence that is calculated to drive any normal reasonable human being insane. The biggest problem is that it is nearly impossible to keep all the doors closed at all time and it's difficult to secure every opening or vent in this manner. Mosquito screens also tend to accumulate a lot of dust so it becomes necessary to wash and clean them regularly.

Electronic swatters

These swatters in the shape of tennis racquets do help, but they require to be recharged regularly and they require careful handling as they are quite fragile. Aiming and hitting mosquitoes is a great pastime (and exercise), but can get tiring quickly as you need to keep swishing it rapidly to and fro to be really effective. And just when you put it down after a swatting session, you tend to find yet another critter buzzing above your head. The biggest issue with these swatters is that they're cheaply built and of poor quality, so don't last very long.

Chemical repellents

There are two types of chemical repellents which burn and release odours to drive out mosquitoes. Liquid repellents and solid repellents. Some of these are fitted on an electric device that can be plugged in to a wall socket and there are mosquito coils which burn and release a pungent aroma. They help in controlling mosquitoes within a confined space, but the room can become stuffy and suffocating very quickly. These chemical also aren't exactly healthy for human consumption either and so breathing these vapours can be harmful, particularly for people suffering from respiratory problems.

Skin creams, lotions and sprays

These creams and sprays are meant for application on exposed areas of the skin, and they are very effective at preventing these buzzing creatures from swirling above the head all the time, but are good only for a few hours at best. Moreover, skin creams tend to get wiped off on contact. And in spite of your best efforts, it is likely that you would leave just a small area of your skin free of the protective cream and mosquitoes unerringly target that region with uncanny precision.

Nets and mesh enclosures

Nets over beds are the best protection at nights, but if one or two mosquitoes do manage to get in through a small gap somewhere, they are guaranteed to ruin your sleep for the rest of the night. However, I've been able to sleep well at night only after installing a net over my bed. Not recommended in the summer (when the mosquito population is lower in any case), but in mild, cool weather it's a pleasant, and undoubtedly the best option.

Other tips to keep mosquitoes away

Keep the dark corners of your house to a minimum. Avoid accumulating a lot of stuff. Avoid black coloured or dark furniture. Allow sunlight into the house at daytime (as much as possible), keep your windows and doors closed after dark. Keep your bathrooms dry and clean and keep the bathroom doors closed all the time. Try and keep your surroundings free of stagnant water. Use a combination of the above strategies to control mosquitoes and finally hope for the best!

Website generation using asciidoc

Posted at 10:41:15 am by hari under Linux/*nix, HowTos, Software, Programming (199 views)

asciidoc is a pretty neat document generation and formatting system which relies on plain text files with minimum formatting codes to generate documentation in a variety of different formats. It's very easy to use and very flexible. In fact, with a bit of scripting, you can automate building an entire website using asciidoc sources. I'm aware that this method is a bit dated what with advanced database-driven CMSes to build dynamic websites these days, but it's still a neat way to create a simple, no-frills, fully portable website.

Here's a rough and ready script I wrote in Python to build a website from a directory tree. Feel free to customize it and use it as you wish.

Usage notes:

  1. You need to have asciidoc and python installed on your system.
  2. Save the script below as website-gen.py and make it executable (using chmod +x website-gen.py from the command line).
  3. Customize the source and destination directory in the script to your needs.
  4. Create the asciidoc sources in the source directory tree.
  5. Create a layout.conf file (optional) or remove the -f layoutfile option from the script to use default settings.
  6. Run the script to generate the output in XHTML 1.1 format in the destination directory tree.
  7. For more information on asciidoc, you can read the man page and the full online documentation.

The Python script:

#!/usr/bin/env python          

import os          

# The source directory containing the asciidoc .txt files 
# (you can modify this to your needs) 
source_dir = './source/'          

# The destination directory 
# (you can modify this to your needs) 
dest_dir = './html'          

# The layout configuration file 
# (you can use your own layout file. Modify the layout file 
# to your needs or remove the 
layout_file = './layout.conf'          

# Run through the source directory and compile the asciidoc files 
for root, dirs, files in os.walk (source_dir): 
    for file in files: 
        if (file.endswith ('.txt')): 
            fullfilepath = os.path.join (root, file) 
            # Use the commented command to generate with no 
            # custom layout file 
            # command = 'asciidoc ' + fullfilepath 
            command = 'asciidoc -f ' + layout_file + ' ' + fullfilepath 
            os.system (command) 
            print fullfilepath          

print 'Completed generating documentation from sources'          

# Remove the destination directory if it exists 
command = 'rm -rf ' + dest_dir 
os.system (command)          

print 'Copying to destination dir...'          

# Copy the source dir to the destination 
command = 'cp -dpR ' + source_dir + ' ' + dest_dir 
os.system (command)          

# Remove the source files from the destination directory 
for root, dirs, files in os.walk (dest_dir): 
    for file in files: 
        if (file.endswith ('.txt')): 
            os.remove (os.path.join (root, file))          

print 'Completed successfully'

1 2 3 4 »