August 29, 2012

Setting max laptop backlight brightness

Make sure you have rc.local. If so, add the following to it:
path_backligth_base="/sys/class/backlight/"
file_current="brightness"
file_max="max_brightness"

path_acer_wmi=$path_backligth_base"acer-wmi/"
path_max_acer_wmi=$path_acer_wmi$file_max

if [[ -f $path_max_acer_wmi ]]; then
        cat $path_max_acer_wmi > $path_acer_wmi$file_current
else                                           
                                               
        path_acpi=$path_backligth_base"acpi_video0/"
        path_max_acpi=$path_acpi$file_max

        if [[ -f $path_max_acpi ]]; then
                cat $path_max_acpi > $path_acpi$file_current
        fi                                     
fi
As you can see the 1st if-statement is Acer-laptops specific and the 2nd is for general case. You may need to change "acer_wmi" to something else. Just look through the "backlight" directory to find your answer. It's possible you do not need the 1st check at all. It's just distributive-dependent trick.