domingo, 27 de marzo de 2011

Backlight workaround

I've found two solutions to this
the first one is in a terminal do this

sudo gedit /etc/default/grub
change bottom line to this
GRUB_CMDLINE_LINUX="nomodeset acpi_backlight=vendor (save the file)

sudo update-grub 
reboot



second one

1. Remove the 'nomodeset' hack from grub kernel loading parameter, now you cannot adjust backlight, for a while 

2. Restart system, open terminal and type this command:

~$ lspci | grep VGA

00:02.0 VGA compatible controller: Intel Corporation Mobile 4 Series Chipset Integrated Graphics Controller (rev 07)


This number "00:02.0" is what you want to modify in the following script.

3. Copy the lines between the "###" mark, and save it as a file named something like 'backlight_d.sh', before saving, modify the number after pciset -s ##:##.# as the one you got from step 2

~$ gedit ./backlight_d.sh

################################################## ######
#!/bin/bash

old_b=9;
declare -i curr_b=240;
declare -i target_b=240;

while : ; do
b=`cat /sys/class/backlight/acpi_video0/brightness`;
delay="0.5"

if [ $old_b != $b ]; then
old_b=$b
let "target_b=$b * 20 + 12"
#printf "Target: %10d\n" $target_b
fi

hex_b=".";

if [ "$curr_b" -lt "$target_b" ] ; then
let "curr_b=$curr_b + 2"
if [ "$curr_b" -gt "$target_b" ] ; then
let "curr_b=$target_b"
fi

hex_b="-"
elif [ "$curr_b" -gt "$target_b" ] ; then
let "curr_b=$curr_b - 2"
if [ "$curr_b" -lt "$target_b" ] ; then
let "curr_b=$target_b"
fi

hex_b="-"
fi

if [ $hex_b != "." ] ; then
hex_b=`printf "%02X" $curr_b`
delay="0.005"
setpci -s 00:02.0 F4.B=$hex_b
fi

sleep $delay
done
################################################## ######

4. Copy it to /etc (in root mode) and make executable
# sudo cp ./backlight_d.sh /etc/
# sudo chmod +x /etc/backlight_d.sh

5. Add it to rc.local
# sudo nano /etc/rc.local

Find the line 'exit 0', add BEFORE it:

################################################## ######

nohup /etc/backlight_d.sh &

################################################## ######


All done! Restart now and watch the backlight magically change

SAUCES:

No hay comentarios:

Publicar un comentario