Getting FN keys of Vaio VGN-FS38GP working in Ubuntu 8.10

Ubuntu 8.10 does not support the Vaio FS series by default, and needs a little bit of hacking to get working. The old fsfn program does not work anymore unfortunately. Some poking around found me this error in my dmesg output everytime I pressed a FN key: 

atkbd.c: Use ‘setkeycodes e075 <keycode>’ to make it known.
atkbd.c: Unknown key released (translated set 2, code 0xf5 on isa0060/serio0).

This was repeated multiple times. I also found that a file located at /sys/devices/platform/sony-laptop/fnkey had the right value after a FN key press.

I realised I could combine these to come up with a hack solution that would work. I decided to write a perl script that would be called everytime a fn key was pressed, that would figure out which key was pressed (using the fnkey file) and then do the right thing.

To get the key recognised to start our perl script, we use xbindkeys and we use the setkeycodes command. I made a script that maps all FN keys to keycode 235. I then use this .xbindkeysrc (it must be named .xbindkeysrc in your home directory and you need to install xbindkeys) to start my perl script.

The perl script itself just invokes some scripts that come with ubuntu. At the moment it only supports the volume controls and brightness (as these are what I wanted). The script is located here.

Turns out the ubuntu scripts need root access to run, so I ran the following commands to ensure all executions of the program run as root (I wasn’t too worried about security in this case..)

sudo chmod a+s /etc/acpi/sonybright.sh
sudo chmod a+s /usr/bin/acpi_fakekey 

My files use hardcoded paths of /home/prashant so you will have to change those to make it work.

All the files needed can be found here:
http://blog.prashantv.com/files/vaio_fs/ 

I took a look at the driver (/drivers/misc/sony-laptop.c) and realised that fn keys do not generate any event in the sony-laptop code currently, and seem to only generate normal keyboard events. Unfortunately I don’t have any experience with the linux kernel to figure out how to fix it at the kernel level.

Perl Mail Checker

So I got sick of Outlook eating all my RAM. I have it open all the time during the day, so that I can see when I have new email. However, it also ate are about 140mb of my ram to do this simple task.

I wanted a light replacement. I tried some programs on the net but they used a fair bit of RAM. So decided I would write my own simple client in .NET that did exactly what I wanted.
While I was looking for .NET libraries to access my IMAP mail server, I found 
It looked pretty useful, and I realised perl would be a lot easier.. But I wanted a system tray icon when I had new mail.. Some more googling found me..

http://perl-win32-gui.sourceforge.net/cgi-bin/docs.cgi?doc=notifyicon

So I decided to play with it. And by the end of it, I got myself a nice simple imap mail checker using perl.
The way it works is not like most mail checkers. It does not run all the time. It only runs, checks if there is new mail, and if not, closes. So the way I use it:
  • Task Scheduler starts my script every 3 minutes
  • Script runs, and if there is no mail, closes. If there is mail, show a notify icon (for 2 minutes)
  • I click the notify icon to open Outlook.
The advantage – when there is no new mail, a new process is started every 3 minutes, and it ends straight away. When there is new mail, perl continues running, which takes up barely any ram. (13 mb last time I checked). I click the icon and Outlook starts up, allowing me to read the mail in my usual client.
So, RAM usage has been minimized, yet I am not missing any features. Files for this can be found here.