Page 1 of 1

Thinkpad X21 & Debian - how to turn off LCD backlight?

Posted: Wed Sep 19, 2012 2:42 pm
by Ormu
I'm using a Thinkpad X21 with Debian Squeeze as a server (irc bouncer etc.). I'd like to turn the display backlight off to save power and the backlight CCFL tubes itself but I haven't found a way to do so.

The screen goes blank automatically after some time but the backlight still stays on.

DPMS via xset does not work because X is not installed.

Fn+F3 should turn the LCD off but it doesn't work. I think I saw some bug reports for thinkpad-acpi about this problem.

The commands:
setterm -powersave powerdown
and
setterm -powerdown 5 (note: 5 minute timeout)
...don't seem to work either.

Is there a way to do it at all? Or do I just have to keep it on, brightness at minimum? What should the BIOS setting "Screen Blanking" (enabled/disabled) do? I think changing it didn't have any effect.

Re: Thinkpad X21 & Debian - how to turn off LCD backlight?

Posted: Wed Sep 19, 2012 6:16 pm
by Neil
You are correct about Fn + F3 being the key combo to blank the LCD. But since it's an ACPI event it doesn't seem to work with newer kernels. At least it doesn't for me running Xubuntu 12.04 on a T43.

Re: Thinkpad X21 & Debian - how to turn off LCD backlight?

Posted: Fri Sep 21, 2012 8:01 am
by GomJabbar
Here is how I do it in Arch XFCE with xset...

Using xev, I saw that Fn+F3 is mapped to XF86Battery.

Code: Select all

KeyPress event, serial 41, synthetic NO, window 0x2e00001,
    root 0xb0, subw 0x0, time 382189, (797,429), root:(803,503),
    state 0x10, keycode 244 (keysym 0x1008ff93, XF86Battery), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 41, synthetic NO, window 0x2e00001,
    root 0xb0, subw 0x0, time 382189, (797,429), root:(803,503),
    state 0x10, keycode 244 (keysym 0x1008ff93, XF86Battery), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False
I created the following file /etc/acpi/actions/blank.sh as root and made it executable.

Code: Select all

#! /bin/sh

/usr/bin/xset dpms force off
I created a keyboard shortcut (an option in XFCE: Applications Menu > Settings > Keyboard > Application Shortcuts).
Command: /etc/acpi/actions/blank.sh
Shortcut: XF86Battery

Fn+F3 now turns off the backlight. Moving the trackpoint or pressing a keyboard key turns the backlight back on.

FWIW, for other Fn+F* keys that aren't already mapped and create only an acpi event, I have a corresponding file in /etc/acpi/events/

ACPI events can be seen by running acpi_listen from terminal.

Code: Select all

$ acpi_listen
button/f24 F24 00000080 00000000 K
button/fnf11 FF11 00000080 00000000 K
One example is how I turn on and off bluetooth with Fn+F9.
/etc/acpi/events/bluetoothconf

Code: Select all

event=button/f24.*
action=/etc/acpi/actions/bluetooth.sh
/etc/acpi/actions/bluetooth.sh

Code: Select all

#!/bin/bash

BT_RFKILL=$(rfkill list | grep tpacpi_bluetooth_sw | sed 's/\([0-9]\+\):.*/\1/')
BT_STATE=$(/usr/sbin/rfkill list $BT_RFKILL | grep "Soft blocked: yes")

if [ "x" == "x$BT_STATE" ]; then
	/usr/sbin/rfkill block $BT_RFKILL
else
	/usr/sbin/rfkill unblock $BT_RFKILL
fi

exit 0
Another example is how I connect and disconnect my home WiFi profile with Fn+F11.
/etc/acpi/events/netcfg_home-wirelessconf

Code: Select all

event=button/fnf11.*
action=/etc/acpi/actions/netcfg_home-wireless.sh
/etc/acpi/actions/netcfg_home-wireless.sh

Code: Select all

#!/bin/bash

WLAN_STATE=$(netcfg current)

if [ "x" == "x$WLAN_STATE" ]; then
	/usr/bin/netcfg home-wireless
else
	/usr/bin/netcfg -a
fi

exit 0

Re: Thinkpad X21 & Debian - how to turn off LCD backlight?

Posted: Fri Sep 21, 2012 8:11 am
by Neil
Some very useful info here, DKB! :thumbs-UP: