[ltp] Re: news about Thinkpad brightness keys situation

Sebastian Geiger linux-thinkpad@linux-thinkpad.org
Tue, 06 May 2008 13:47:14 +0200


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
A friend wrote me a script to catch the brightness buttons acpi events:<br>
Place it into /etc/acpi/thinkpad-brightness-down.sh<br>
<br>
#!/bin/bash<br>
levels=(20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 100)<br>
(( count = ${#levels[@]} -1 ))<br>
current=$(cat /proc/acpi/video/VID1/LCD0/brightness | grep current |
awk '{print $2}')<br>
if [ "$current" -ne "${levels[0]}" ]<br>
    then<br>
        i=-1<br>
        for n in ${levels[@]} <br>
        do<br>
            if [ "$current" -eq "$n" ] <br>
            then<br>
                echo ${levels[$i]} &gt;
/proc/acpi/video/VID1/LCD0/brightness<br>
            fi<br>
            (( i += 1 ))<br>
        done<br>
    current=$(cat /proc/acpi/video/VID1/LCD0/brightness | grep current
| awk '{print $2}')<br>
#    dcop khotkeys kmilod displayProgress "Brightness" $current<br>
fi<br>
<br>
AND<br>
thinkpad-brightness-up.sh:#!/bin/bash<br>
levels=(20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 100)<br>
(( count = ${#levels[@]} -1 ))<br>
current=$(cat /proc/acpi/video/VID1/LCD0/brightness | grep current |
awk '{print $2}')<br>
if [ "$current" -ne "${levels[$count]}" ]<br>
then<br>
    i=1<br>
    for n in ${levels[@]} <br>
    do<br>
        if [ "$current" -eq "$n" ] <br>
        then<br>
            echo ${levels[$i]} &gt;
/proc/acpi/video/VID1/LCD0/brightness<br>
        fi<br>
        (( i += 1 ))<br>
    done<br>
fi<br>
current=$(cat /proc/acpi/video/VID1/LCD0/brightness | grep current |
awk '{print $2}')<br>
#dcop khotkeys kmilod displayProgress "Brightness" $current<br>
<br>
and in /etc/acpi/events/thinkpad-brightness-up:<br>
#Fn-Home<br>
event=video LCD0 00000086 00000000<br>
action=/etc/acpi/thinkpad-brightness-up.sh<br>
<br>
<br>
AND thinkpad-brightness-down:<br>
#Fn-end<br>
event=video LCD0 00000087 00000000<br>
action=/etc/acpi/thinkpad-brightness-down.sh<br>
<br>
Hope this helps.<br>
Best Regrads<br>
Sebastian<br>
<br>
<br>
Jesse Barnes wrote:
<blockquote cite="mid:200805050937.29906.jbarnes@virtuousgeek.org"
 type="cite">
  <pre wrap="">On Wednesday, April 30, 2008 1:52 am Yves-Alexis Perez wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">Hi,

I wanted to ask if there was any progress on the understanding of the
situation?

I have a Thinkpad T61 (8897 with intel G965), running Linux 2.6.25
(vanilla+thinkpad-acpi 0.19-20080321, but I can test with debian 2.6.25)
and xserver-xorg-video-intel 2.3.0-1 (experimental).

Brightness keys sure don't work out of the box (nor in console nor in
Xorg).

acpid, powersaved and hald are running. I can stop them for testing if
needed.

The driver by default uses the BACKLIGHT_CONTROL "kernel".

xbacklight works fine.

I have a /sys/class/backlight/acpi_video0 and 1. acpi_video0 does nothing,
but using acpi_video1 and echo'ing 0-15 to brightness works. But in that
case, xbacklight is lost.

xbacklight =100
# brightness is at full level
cat /sys/class/backlight/acpi_video1/actual_brightness
15 # acpi_video1 agree
echo 0 &gt; /sys/class/backlight/acpi_video1/brightness
# brightness is at minimum level (but is not off, while it has worked at
one # time)
cat /sys/class/backlight/acpi_video1/actual_brightness
0 # acpi_video1 agree
xbacklight
100 # xbacklight disagree.
    </pre>
  </blockquote>
  <pre wrap=""><!---->
This is an X server &amp; driver problem.  I fixed it recently, so if you build 
the Intel X driver against new server bits (or just wait until 1.5), 
xbacklight should fetch the current value.

  </pre>
  <blockquote type="cite">
    <pre wrap="">That's even without trying brightness keys.

Pressing brightness keys generates here acpi events video LCD0 87/86 (with
some delay, but I guess this one is a kernel problem). Nobody seems to
catch it, nor hal, nor powersaved, nor X driver.
    </pre>
  </blockquote>
  <pre wrap=""><!---->
I think in some kernel versions it'll send a keyboard event that you can make 
a desktop applet catch?

Jesse
  </pre>
</blockquote>
</body>
</html>