Irfan’s Corner on the Web On Mac, Linux, Grid, Virtualization and Software Technology

14May/070

How to make use of the extra Multimedia keys in Laptops and Keyboards in Linux

I bought my notebook some months ago, OpenSUSE 10.2 turned out to have excellent hardware support for it and supported nearly all hardware, except those multimedia keys which come embedded on the notebook. This tutorial will show how you can easily add support for these keys to your Linux computer. This tutorial can not just be used for adding support for the extra multimedia keys on notebooks, but also for multimedia keyboards for Desktops.

In this tutorial we will add support for the "MediaDirect" key and the multimedia keys in the front of the Dell Inspiron.

Some keys such as Mute, Volume UP/Down are supported by default. We will add support for the additional keys and integrate the functionality with Amarok, my favorite media player.

lapkey.jpg

mediadirectbuttonssmall.jpg

First of all you will need the necessary program, xbindkeys. Download it and install it.

xbindkeys offers the following CLI interface:

xbindkeys 1.8.2 by Philippe Brochard
usage: xbindkeys [options]
where options are:
-V, --version Print version and exit
-d, --defaults Print a default rc file
-dg, --defaults-guile Print a default guile configuration file
-f, --file Use an alternative rc file
-fg, --file-guile Use an alternative guile configuration file
-h, --help This help!
-X, --display Set X display to use
-v, --verbose More information on xbindkeys when it run
-s, --show Show the actual keybinding
-k, --key Identify one key pressed
-mk, --multikey Identify multi key pressed
-g, --geometry size and position of window open with -k|-mk option
-n, --nodaemon don't start as daemon

Intially you need to create a stub configuration file

xbindkeys --defaults-guile > ~/.xbindkeysrc.scm

Now you need to identify the keycodes for the multimedia buttons, this is done by first invoking xbindkeys with the following switch

xbindkeys -mk

Some window pop ups, and now start pressing the buttons, one after another, when you press a button some information is printed on the console as depicted in the screenshot

login6.jpg

The "m:0x10 + c:160" part of the output identifies the specific button to the computer. You can now open up the configuration file and associate a command with this. KDE is such an advanced environment that it allows users to interact with programs from the console through the Desktop Communications Protocol (DCOP). I had pressed the mute button, so I will associate the mute action in KDE with it, by invoking:

dcop kmix Mixer0 toggleMute 0

so in the configuration file this would look like:

"dcop kmix Mixer0 toggleMute 0 "
m:0x10 + c:160

So here are some parts of my configuration file, which associate different keys to different actions, like if I press the MediaDirect key amarok should open, If I press forward, it should go to the next playlist item, If I press previous it should go to the previous playlist item etc..

"amarok"

m:0x10 + c:237
"dcop amarok player play"
m:0x10 + c:162

"dcop amarok player prev"
m:0x10 + c:144

"dcop amarok player next"
m:0x10 + c:153

"dcop amarok player stop"
m:0x10 + c:164

So this is how basically you can add support for special multimedia keys to your Linux environment. Now the key mappings will not have an effect until you do not run xbindkeys in the background, you can do that by simply saying

xbindkeys &

You could also add it to your startup files so the key mappings work automatically.

Filed under: open source No Comments
10May/071

Finally Got my Webcam to work in Linux!

I bought this extremely cheap webcam from the market, named "Pasaris". It came packaged with a Windows driver, it worked fine on Windows. However because I wanted to use it on my notebook I needed to make it work on Linux. I installed all relevant modules from the kernel, believing that udev will pick the right one. However it did not work this way. Next I looked up this massive list, hoping that it is supported by the spca5xx driver. But in the entire list there doesn't seem to be any vendor called "Pasaris".

I shelved the webcam away, hoping to get a new one which would have Linux support. Today while reading Greg KH's book "Linux kernel in a nutshell", I decided to have another look at that webcam. I used lsusb to find the Vendor and Product ID, which turned out to be:

fast5.jpg

0x0c45:0613b, the kernel doesn't support any such device, so I had another look at the spca5xx support webcam list.
And viola! I found that device filed under "Sonix" brand. I was over joyed! I immediately downloaded the driver, and downloaded an application to test the setup, gqcam, and it worked pretty well!

So the moral of the story: Never be deceived by the branding on a device made in China! All of them are mostly from a single source

Filed under: open source 1 Comment
7May/072

Tales from Softec, Lahore

I've just returned from another software competition in Lahore. I highly regard Softec, however this year, I would say that it was close to a disaster.

First, the food: Last year participants were offered 3 meals a day, break fast, meal and dinner, however this time around, the first day it went well, however the second day they did not offer any meal, and participants were left to fend for themselves. I also heard that the accommodation which was provided to participants was below standard and even the police broke into it during 2am in the night to check up something, and participants had to be shifted to some other facility.

Second about the judges for the software competition: They were the most pathetic and rude lot I've ever seen in any competitions. I've never witnessed a judge telling a participant that I'm not interested in your project so I'll not evaluate you, this was common place in Softec 2007. All judgments were purely ad-hoc, some projects got as many as 6-7 evaluations (we got 6), while others just got 1. Some projects like SIGMa, which was presented by my friend,a judge was sent to evaluate, he flatly said I'm not interested in your project so I won't evaluate you.

The judges we got were disappointing, the judge who came to us on the second round, did not know that running programs are represented in the form of pages in memory, and by transferring all the pages of a program you transfer the address space of the process. He found this difficult to understand as he had no concepts about paging in Operating systems. Paging was not part of my project, rather Grid enabling application was, hence in process migration I made a passing mention of it, and thats were the judge got stuck and spent some 30 minutes in this basic theory, at the end he got tired and left, without listening to the entire project.

Except 1-2 judges of all the 6 which came to us, none of them knew about CERN, the largest particle physics lab in the World, and the birthplace of the WWW.

The main issue as I see it was that most judges were from the local industry, the local industry is still in its infancy. People who are employed in these industries mostly came there by just having learnt some Microsoft technologies like .NET or VC++, so have no indepth knowledge about systems such as Operating systems. ProCom featured some of the best judges I've come across, some of them were from IBM. The reason we won there was that both judges and us, spoke the same language, this was not the case in Nascon or Softec, where the judges were either FAST faculty members (Nascon), or local industry professionals (Softec) and were low on indepth knowledge about systems. Additionally cause ours was a research project on Grid computing, in Pakistan there is no requirement for Grids as massive processing is not carried out here, so people just do not know about it and thus are in a poor position to evaluate a project in this domain.

However Softec, still had a happy ending, another project from my university, the National University of Sciences and Technology (nust), won 1st prize! It is an IP-geolocation software. This means that NUST has won ALL major software competitions this year, which include Nascon (1st and 3rd prize to NUST), ProCom (1st prize to NUST), and Softec (1st prize to NUST), still one major competition remains, that is SoftCom held by the GIK Institute. However I would not be able to attend it as I will be in CERN, Faran, who wrote the IP geolocation software might be unavailable aswell.

Filed under: personal 2 Comments