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/
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: 

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.