LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Laptop and Netbook (http://www.linuxquestions.org/questions/linux-laptop-and-netbook-25/)
-   -   Special buttons and brightness on Lenovo 3000 N100 (http://www.linuxquestions.org/questions/linux-laptop-and-netbook-25/special-buttons-and-brightness-on-lenovo-3000-n100-752947/)

OMGitsUGOD 09-05-2009 03:48 PM

Special buttons and brightness on Lenovo 3000 N100
 
Hi!
I have a Lenovo 3000 N100 with the Intel Mobile 945GM chipset and with my previous installation (Ubuntu 9.04), adjusting brightness with Fn-F10 and Fn -F11 worked out-of-the-box. Now I have switched to Arch Linux and I have problems with adjusting the brightness and the Fn-[FX] combinations in general.

I was looking for ways of adjusting brightness from the command line, but none of the methods I could find works. For example;

xbacklight

returns "No outputs have backlight property" when running KMS (kernel mode settings), and if I remove KMS it returns "nan".

At various places it was suggested that

xrandr --output LVDS --set BACKLIGHT_CONTROL legacy

would do the trick. This trick does something good as now I'm able to use xbacklight -get and xbacklight -set Y (not running KMS), without getting any error messages. Nothing happens to the screen though.

I also checked my Fn-[FX] buttons with keycode and xev, and as it turns out all Fn-[Fx] combinations (which should do something) are detected except for Fn-F11 which is supposed to increase the brightness level?

What's wrong here, and how is Ubuntu able to get all this working out-of-the box?

business_kid 09-07-2009 03:18 AM

I know nothing about arch linux and what acpi scripts they provide.

in /etc/acpi, there is an 'events' directory. It is instructive to open a terminal and type 'acpi_listen' in it and you will first see if your video buttons are recognized. Try them with the terminal open, likewise the lid button and the AC supply. You should get an output like this
bash-3.1$ acpi_listen
button/lid C1F0 00000080 00000003
video C163 00000087 00000000 # video brightness down
video C163 00000086 00000000 # video brightness up
ac_adapter C1EB 00000080 00000000
thermal_zone TZ1 00000081 00000000
battery C1ED 00000080 00000001
battery C1ED 00000080 00000001
battery C1ED 00000080 00000001
battery C1ED 00000080 00000001
ac_adapter C1EB 00000080 00000001
thermal_zone TZ1 00000081 00000000

OK, these events are seen. The gibberish after that is model specific. The entry in events is a script in /etc/acpi which tells acpi what to do when it sees this event.

bash-3.1$ cat video_brightnessup
# /etc/acpi/events/video_brightnessup
event=video.* 00000086
action=/etc/acpi/video_brightnessup.sh

If you only have one or two scripts, download the debian acpi scripts (most comprehensive I have seen) or fedora (also good). I had slamd (1 script for me to build)

OMGitsUGOD 09-08-2009 09:00 AM

Thanks for the help, it helped me with some of my problems. I couldn't really find the debian script you were referring to. I found one here
http://packages.debian.org/en/lenny/acpi-support,
but I couldn't figure out how it works. This is video_brightnessup.sh for example
Code:

#!/bin/sh
[ -f /usr/share/acpi-support/key-constants ] || exit 0

. /usr/share/acpi-support/key-constants
acpi_fakekey $KEY_BRIGHTNESSUP

Well googling FOR video_brightnessup.sh I found this http://www.ubuntugeek.com/fix-your-l...-in-hardy.html
and the scripts provided there lead me to a solution that sort of works.

I post my modified bash script here if someone has a similar issue, this is eg video_brightnessup.sh
Code:

#!/bin/bash

CURRENT=$(grep "current:" /proc/acpi/video/GFX0/LCD/brightness |awk '{print $2}')
LEVELS=$(grep "levels:" /proc/acpi/video/GFX0/LCD/brightness | sed 's/levels://')

for level in $LEVELS
do
        if [ "$level" -gt "$CURRENT" ]
        then
                echo -n $level > /proc/acpi/video/GFX0/LCD/brightness
                exit 0       
        fi
done
exit -1

This works fine and I'm able to adjust brightness from the command line. The thing is once I've changed the brightness from being 100 the Fn-[FX] combinations work again, but they don't really step the brightness but just either put it to 100 or to 0 without any intermediate steps. Once the brightness is back to 100 I can't control it anymore with these buttons. Adding the scripts as acpi events does help me from being stuck at 100 but it still steps through from 100 to 0 without intermediate steps. It is as though something else is also listening to the Fn-[FX] events apart from acpi?

I know these got kind of confusing, and I'm sort of ready to give up and see if this is fixed when the new kernel comes out. But if you have anymore ideas let me know!

business_kid 09-09-2009 03:33 AM

Quote:

Originally Posted by OMGitsUGOD (Post 3674305)
Thanks for the help, it helped me with some of my problems. I couldn't really find the debian script you were referring to. I found one here
http://packages.debian.org/en/lenny/acpi-support,
but I couldn't figure out how it works. This is video_brightnessup.sh for example
Code:

#!/bin/sh
[ -f /usr/share/acpi-support/key-constants ] || exit 0

. /usr/share/acpi-support/key-constants
acpi_fakekey $KEY_BRIGHTNESSUP


Yeah, I have one of those as well. I do not have /usr/share/acpi-support at all, but the thing works. I did spot this(below), but don't have the manpage. I gather it's some system call that does the magic.
http://www.digipedia.pl/man/acpi_fakekey.1.html

There is another way to do suspend. Try this
cat /sys/power/state
Mine says 'mem disk' Then you suspend/hibernate with
sync; echo -n mem > /sys/power/state, (or disk)

OMGitsUGOD 09-09-2009 01:46 PM

So you are not really using the acpi script at all then? First line says that if /usr/share/acpi-support/key-support doesn't exist then exit, right?

business_kid 09-10-2009 03:27 AM

Quote:

Originally Posted by OMGitsUGOD (Post 3676253)
So you are not really using the acpi script at all then? First line says that if /usr/share/acpi-support/key-support doesn't exist then exit, right?

/Looks
You're right. It's all being done behind my back :-o


All times are GMT -5. The time now is 02:12 PM.