Backlight brightness

From NetBSD Wiki

Jump to: navigation, search

Some laptops provide means to control the backlight brightness of the screen directly via ACPI. A good example is sony(4). But many laptops either do not expose this functionality for the operating system or lack a suitable driver on NetBSD. If this is the case, a good "hack" can be achieved with the help of the all-powerful powerd(8) daemon and the new X utility called x11/xbacklight.

Two examples for /etc/powerd/scripts/acadapter. When the AC adapter is plugged, we want full brightness:

       # Set backlight to maximum. 
       # 
       if [ -x /usr/pkg/bin/xbacklight ]; then
               export DISPLAY="localhost:0.0"
               /usr/bin/su USER -c "/usr/pkg/bin/xbacklight -set 100"
       fi

When running on battery, we reduce the backlight brightness to one-fourth of the maximum:

       # Set backlight to 25 %.
       #
       if [ -x /usr/pkg/bin/xbacklight ]; then
               export DISPLAY="localhost:0.0"
               /usr/bin/su USER -c "/usr/pkg/bin/xbacklight -set 25"
       fi

This requires that the X server is listening for connections, which is the default on NetBSD.

Personal tools