Back light keys on IBM/Lenovo Thinkpad X60t
I just got back light keys to work on my Thinkpad X60t. This is actually pretty easy. If I just had read the documentation for thinkpad_acpi before I would have known.
Anyways lets get to it.
First we need to modprobe thinkpad_acpi with some arguments, otherwise the back light Fn-key combo will not show up as acpi events, and then we will not be able to control the back light.
modprobe thinkpad_acpi brightness_enable=1 hotkey=enable,0xffffff
You probably want to do that on every boot, in gentoo you do that by adding the following to /etc/conf.d/modules:
modules_2_6="${modules_2_6} thinkpad_acpi"
module_thinkpad_acpi_args_2_6="brightness_enable=1 hotkey=enable,0xffffff"
When that is done we can start grabbing some events with acpi_listen, mine looks like this:
tomasz@arcadia ~ $ acpi_listen
ibm/hotkey HKEY 00000080 00001011
ibm/hotkey HKEY 00000080 00001010
First one is for down second for up.
Now we know this we can make some files for acpid to react on when we push the Fn-key combo for either back light up or down.
/etc/acpi/events/backlight-up:
# called when brightness up key combo is pressed
event=ibm/hotkey HKEY 00000080 00001010
action=/etc/acpi/actions/backlight-up
/etc/acpi/events/backlight-down:
# called when brightness down key combo is pressed
event=ibm/hotkey HKEY 00000080 00001011
action=/etc/acpi/actions/backlight-down
Now we need some actions. I made a couple of simple bash scripts that looks at the current state of the back light level and subtracts or adds 1 to the level. You can control the level either in /sys/class/backlight/thinkpad_screen/brightness or in /proc/acpi/ibm/brightness the latter is as far as I know deprecated, so I am not going to use that.
So here are the scripts:
/etc/acpi/actions/backlight-down:
#! /bin/bash
# A little simple script to control backlight on a Thinkpad X60 Tablet
# Check current state
typeset -i state=`cat /sys/class/backlight/thinkpad_screen/brightness`
# Subtract one from the current state and echo it to the file
down=$((state-=1))
echo "$down" > /sys/class/backlight/thinkpad_screen/brightness
/etc/acpi/actions/backlight-up:
#! /bin/bash
# A little script to control backlight on a Thinkpad X60 Tablet
# Check current state
typeset -i state=`cat /sys/class/backlight/thinkpad_screen/brightness`
# Add one to the current state and echo it to the file
state+=1
echo "$state" > /sys/class/backlight/thinkpad_screen/brightness
Reload acpid and see if it works.
/etc/init.d/acpid restart
This should be it!