Controlling the Backlight

From Joggler
Jump to: navigation, search

The code for enabling the backlight can be compiled as a module, from:Kernel Patches

Hint: So you don't have to recompile the entire kernel (as root):

cd into the linux source.
patch -p1 < ../path/to/patch
make clean SUBDIRS=drivers/video/backlight
make SUBDIRS=drivers/video/backlight
cp drivers/video/backlight/openframe_bl.ko /path/to/lib/modules/kernel/drivers/video/backlight/openframe_bl.ko

Once this module has loaded, this opens up a new set of controls within


To turn the backlight on:

echo 0 > /sys/class/backlight/openframe-bl/bl_power

To turn the backlight off:

echo 1 > /sys/class/backlight/openframe-bl/bl_power

To vary the brightness, echo a value from 0 (darkest/off) to 32 (brightest)

echo <num> > /sys/class/backlight/openframe-bl/brightness

The following udev rules change the permissions on the above, so that a user in group <group> can do this.

KERNEL=="openframe-bl", RUN+="/bin/chmod 664 /sys/class/backlight/openframe-bl/bl_power /sys/class/backlight/openframe-bl/brightness"
KERNEL=="openframe-bl", RUN+="/bin/chgrp <group> /sys/class/backlight/openframe-bl/bl_power /sys/class/backlight/openframe-bl/brightness"

I have them in /etc/udev/rules.d/99_openframe.rules