UPDATE: This works on Ubuntu 9.10 Karmic, 10.4 Lucid and 10.10 Maverick
Also works on other brands of laptops!
If you are like me, suffered for no KMS hack to make laptop backlight work, you can use the following method to bring KMS AND backlight adjusting together.
First, thanks for the post https://bugs.launchpad.net/ubuntu/+s...ux/+bug/397617 to give me the idea to create a daemon script which continously monitor system level backlight value change and propagate the value to the pci bus to get it REALLY changed.
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
# cp ./backlight_d.sh /etc/
# chmod +x /etc/backlight_d.sh
5. Add it to rc.local
# 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!
UPDATE: I've modified the first post to include the latest update of the script, which offers smooth transition of backlight level.
Bookmarks