← Back to team overview

asus-ul30 team mailing list archive

Re: Asus UL30A - Ubuntu 10.04 - Function Keys

 

Muhammad Khairullah pointed out a solution to function keys for volume:
  http://iruellife.blogspot.com/2010/05/brightness-key-asus-ul30vt.html

With some tweaking I managed to get it working pretty well. Not sure what kernel or grub he used. If the dialog for the screen brightness worked, or which GPUs and drivers he was using.

But at least in my case with some minor tweaking of his script I got things working pretty close to perfect with the GRUB_CMDLINE_LINUX tweak, a new PPA kernel, and using the intel GPU.

To keep the script from failing with a new user that didn't have ~/.brightness:
if [ ! -f ~/.brightness ]; then
	echo 99 > ~/.brightness;
fi

To avoid illegally high numbers which caused strange behavior for users. Mainly that hitting the dim button wouldn't dim the screen:
if [ "$BRIGHTNESS" -gt "99" ]; then
	export BRIGHTNESS=99;
fi

Of course I had to fix the obvious HTML encoding mistake and change:
echo $BRIGHTNESS gt; ~/.brightness

To:
echo $BRIGHTNESS > ~/.brightness

Oh and to get the dialog and actual screen brightness to align more closely I changed SEED=7 to SEED=2.

Here's the entire script for anyone interested:

#!/bin/bash
export SEED=2
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 "99" ]; then
	export BRIGHTNESS=99;
fi
if [ "$BRIGHTNESS" -gt "0" ]; then
        echo $BRIGHTNESS > ~/.brightness
        sudo setpci -s 00:02.0 F4.B=$BRIGHTNESS
fi
if [ "$BRIGHTNESS" -lt "0" ]; then
        echo "This makes your screen off";
fi



References