Keyboard backlight on VPCS11E7E with Ubuntu 14.04

As you may know some Sony Vaio models offer the possibility to manage the keyboard backlight settings using the two interfaces

kbd_backlight

kbd_backlight_timout

in /sys/devices/platform/sony-laptop.

After setting them manually for years, I finally decided to quickly create a simple script to save me the trouble. I conveniently associated this script to the function keys Fn+F9 and Fn+F10 (those with the magnifying glass) and I added a visual notification with libnotify.

libnotify-img

Requirements

Install

Log in as root, download and extract the package in /etc/acpi:

sudo -s
cd /etc/acpi
wget https://storage.shibotto.tk/blog_uploads/keyboard_backlight-en.tar.gz
tar -xvf keyboard_backlight-en.tar.gz
rm keyboard_backlight-en.tar.gz
service acpid reload

You'll end up with 3 new files:

By default it moves back and forth between the options, just like the sound and backlight keys, following this order:

Off → 10 seconds → 30 seconds → 60 seconds → Always on

If you like it this way, you can stop reading now. Otherwise I added some other combinations you might be more comfortable with.

Configuration

The script kbd_backlight.sh has the following options:

Usage: ./kbd-backlight.sh toggle|timeout|cycle|previous|next

You can try them anytime launching it as root. If you want to change the key associations I set for a certain key, all you have to do is change the option in the last line of the correct event file in /etc/acpi/events.

$ cat /etc/acpi/events/sony-fn-f10
# Fn + F10

event=sony/hotkey SNY5001:00 00000001 00000015
action=/etc/acpi/kbd-backlight.sh next

After every change you must reload acpid with sudo service acpid reload, or you won't be able to use your association until next reboot! Some possible combination you should take into account are:

Move back and forth between the options (default)

That's how I like it to, because it's the same behavior of sound and backlight. The options are:

One key on/off & one key timeout

Could be convenient if you habitually set a long timeout (60 seconds/always on) and you often turn the light on/off. This is especially useful because you don't have to move between all the options to toggle the light, and when you turn it back on the last timeout you set will be restored. The options are:

One key to cycle all the options

This will cycle through all the available options. It might not be as convenient as the other combinations, but it might be your only options if you only have one key left (ex. the other key is already assigned). The option is:

Of course it can still be combined with one of the other options.