asus-ul30 team mailing list archive
-
asus-ul30 team
-
Mailing list archive
-
Message #00199
Function keys for to control LCD brightness
I recently realized that the LCD brightness used with the setpci command
isn't 0-99, but instead 0-FF.
Strangely for every time I hit the dim/bright key the
/etc/acpi/asus-brn-down/up.sh is called 3 times. Alas the proper step
(16) isn't divisible by 3. Instead of messing with floating point I
just made the value bounce off the upper/lower limits cleanly.
Is it expected that the up/down scripts would be called 3 times per
keypress of Fn-f5 and Fn-f6?
I'm using the 2.6.34 PPA kernel and
GRUB_CMDLINE_LINUX="acpi_backlight=vendor"
The new improved script should allow control over the full range of the
LCD and be rather close to the scale shown by the brightness dialog:
#!/bin/bash
export SEED=6
if [ ! -f ~/.brightness ]; then
echo 99 > ~/.brightness;
fi
export BRIGHTNESS=`cat ~/.brightness`
case "$1" in
"up")
export BRIGHTNESS=$[$BRIGHTNESS+$SEED];
;;
"down")
export BRIGHTNESS=$[$BRIGHTNESS-$SEED];
;;
*)
export BRIGHTNESS=1;
;;
esac
if [ "$BRIGHTNESS" -gt "255" ]; then
export BRIGHTNESS=255;
fi
if [ "$BRIGHTNESS" -lt "0" ]; then
export BRIGHTNESS=0;
fi
echo $BRIGHTNESS > ~/.brightness
export hexbright=`/usr/bin/printf "%X" $BRIGHTNESS`
sudo setpci -s 00:02.0 F4.B=$hexbright
Follow ups