
To use the Fn keys I use the sony_laptop module modifying the necessary scripts for each functionality.
Because this laptop came with two video cards you need to use the appropriate utility in each case, nvclock in the nVidia case and spicctrl for the Intel card. You can also use smartdimmer with the nVidia card but it seems that it has a bug and the increase command doesn't work.
To add some fn key action you should follow these steps:
Obtain the key code. To do this, execute acpi_listen command and press the desired keys. You will obtain some lines like this:
$ acpi_listen
sony/hotkey SPIC 00000001 00000021
sony/hotkey SPIC 00000001 0000000b
Modify or create the file related to the event you want to handle. These files are usually located in /etc/acpi/events. The content of these files should be:
event=sony/hotkey SPIC 00000001 000000XX
action=/etc/acpi/myevent_handler.sh
Create the handler script (myevent_handler.sh) and place it where you like, but generally they are located in the /etc/acpi directory.
Make sure to give execution permissions to both files.
Restart acpi daemon and try.
$ sudo /etc/init.d/acpid restart
Modify or create the acpi file:
$ sudo vim /etc/acpi/events/sony-brightness-up
event=sony/hotkey SPIC 00000001 00000011
action=/etc/acpi/sony_brightness_up.sh
Create the script:
$ sudo vim /etc/acpi/sony_brightness_up.sh
#!/bin/bash
VIDEO=`lspci | grep -c nVidia`
if [ "$VIDEO" = 1 ]; then
/usr/bin/nvclock -S +10
else
BRIGHT=`spicctrl --getbrightness`
BRIGHTNEW=$(($BRIGHT+32))
spicctrl --setbrightness=$BRIGHTNEW
fi
The VIDEO variable is used to determine whether the nVidia or the Intel video card is used.
This is the /etc/acpi/events/sony-brightness-down file:
event=sony/hotkey SPIC 00000001 00000010
action=/etc/acpi/sony_brightness_down.sh
And this is the handler 'sonybrightnessdown.sh':
#!/bin/bash
VIDEO=`lspci | grep -c nVidia`
if [ "$VIDEO" = 1 ]; then
/usr/bin/nvclock -S -10
else
BRIGHT=`spicctrl --getbrightness`
BRIGHTNEW=$(($BRIGHT-32))
spicctrl --setbrightness=`echo $BRIGHTNEW`
fi
To change sound volume I use the amixer command.
$ sudo vim /etc/acpi/sony-volume-up
event=sony/hotkey SPIC 00000001 0000000f
action=/etc/acpi/volupbtn.sh
$ su vim /etc/acpi/volupbtn.sh
#!/bin/sh
amixer sset Master playback 5%+ unmute
Do the analog to decrease volume.
$ sudo vim /etc/acpi/events/sony-mute
event=sony/hotkey SPIC 00000001 0000000d
action=/etc/acpi/mutebtn.sh
$ sudo vim /etc/acpi/mutebtn.sh
#!/bin/sh
amixer set Master toggle
If you haven't got any predefined key for turning on/off the bluetooth led you can choose any one you like. To do this you can use spicctrl utility:
$sudo vim /etc/acpi/events/sony-bluetooth
event=sony/hotkey SPIC 00000001 00000015
action=/etc/acpi/sony_bluetooth.sh
$ sudo vim /etc/acpi/sony_bluetooth.sh
Last modified date: Wed May 5 21:44:58 CEST 2010