Created 2011-09-11.
As of 2013-06-13, I'm shure current updates of Ubuntu 12.04 LTS work well with the chipset mentioned below.
New version at 2012-04-23, options of sbrinst changed, several bugfixes.
I can only guess what the cause of this problem with current linux kernels might be. I assume that the system sets the brightness to 0xFF (if the inital brightnes was set to full brightness, 0x00) while booting the OS, resuming, a game is started an so on. Apparently, the brightness settings of the GMA 4500M chipsets are different. According to https://lists.linux-foundation.org/pipermail/bugme-new/2011-May/027252.html, 0xFF means the brightest setting with a Toshiba Satellite T130 whereas it means darkness with mine.
After seeing the grub menu, manually dim the brightness of the backlight. For example with <Fn>+<left cursor key>.
Usually that works perfectly, you can even play games like tuxracer.
.
Note: This workaround allows you manually to change the brightness of the screen. You'll also need to add the kernel parameter 'acpi_backlight=vendor
./sbrinst modemode can be one of 'install' or 'uninstall' (without quotes)
sbrinst copies one of setbrightness00 (the value 0 means brightest backlight of the screen) or setbrightnessFF (the value FF means brightest backlight of the screen) to /bin/setbrightness. Therefore, every user can use this script by simply calling setbrightness from a terminal. Options are
#!/bin/bash
#This script is intended to give control over the brightness of the backlight of your laptop's monitor.
#Only tested on a laptop with an Intel(TM) GMA 4500M chipset.
#
#Author: Markus Walther
#Email: service@markuswalther.com
# flags: [-s (save) | -r (restore) | -u (brighten up) | -d (dim)]
# -s: save the current brightness or the default brightness
# -r: retrieves the brightness from $STORING_FILE
# -u: increases the brightness
# -d: decreases the brightness
# set XX: sets the brightness to the desired value XX
# which should be a 2 digit hex value, capital letters, like 8F.
# Take care with this option because there is no checking and your screen may turn black.
#IMPORTANT NOTE: If FF means the brightest setting, use DIRECTION=1, otherwise DIRECTION=0
DIRECTION=0
#OpenSUSE puts setpci into /sbin
PATH=$PATH:/sbin
#NOTE: All numeric values are intended to be hexadecimal
if [ $DIRECTION = '0' ]
then
DEFAULT_BRIGHTNESS=30
MIN_BRIGHTNESS=E0
MAX_BRIGHTNESS=0
else
DEFAULT_BRIGHTNESS=D0
MIN_BRIGHTNESS=20
MAX_BRIGHTNESS=FF
fi
#stepping
STEP=10
#change the command line option if your device differs from this one (->lspci)
DEVICE='00:02.0 F4.B'
SETSPICMD="sudo setpci -s $DEVICE"
#Every user should be able to write files here.
#This file should have a fixed path, NOT something like $HOME/...
STORING_FILE="/tmp/brightness"
#Usually you don't need to change anything below this line
RESTOREFLAG='-r'
SAVEFLAG='-s'
UPFLAG='-u'
DOWNFLAG='-d'
SETFLAG='set'
#echo $SETSPICMD
SPI_BRIGHTNESS=$($SETSPICMD)
#set BRIGHTNESS to the value from the device (hex)
#for use with bc you need to get upper case characters
BRIGHTNESS=$(echo $SPI_BRIGHTNESS | tr a-f A-F)
echo current brightness: $BRIGHTNESS
GETFROMFILECMD="cat $STORING_FILE"
#Option
FLAG=$1
#reset the brightness to the default if it is beyond $MIN_BRIGHTNESS
# NOTE: 'a0' seems not to be a valid hexadecimal number with bc.
# You'll need to use 'A0' instead.
# NOTE: ibase=16, so obase=10 means the same base (16 dec)!!!
if [ $DIRECTION = '0' ]
then
NEW_BRIGHTNESS=$(echo "ibase=16; obase=10; res=$BRIGHTNESS; if(res>$MIN_BRIGHTNESS) res=$DEFAULT_BRIGHTNESS; print res;" | bc);
else
NEW_BRIGHTNESS=$(echo "ibase=16; obase=10; res=$BRIGHTNESS; if(res<$MIN_BRIGHTNESS) res=$DEFAULT_BRIGHTNESS; print res;" | bc);
fi
if [ $NEW_BRIGHTNESS != $BRIGHTNESS ]
then
BRIGHTNESS=$NEW_BRIGHTNESS
echo "Brighness is set to $BRIGHTNESS";
fi
#no flag set? Try to restore or set to default
if [ -z $1 ]
then
FLAG=$RESTOREFLAG
fi
#save the current brightness or save the default
if [ $FLAG = $SAVEFLAG ]
then
echo $BRIGHTNESS > $STORING_FILE;
echo "Stored $BRIGHTNESS to $STORING_FILE"
fi
#try to restore the brightness from the file
if [ $FLAG = $RESTOREFLAG ]
then
if [ -f $STORING_FILE ]
then
BRIGHTNESS=$($GETFROMFILECMD);
echo "Stored brightness is $BRIGHTNESS";
#maybe, the stored setting is invalid
if [ $DIRECTION = '0' ]
then
NEW_BRIGHTNESS=$(echo "ibase=16; obase=10; res=$BRIGHTNESS; if(res>$MIN_BRIGHTNESS) res=$DEFAULT_BRIGHTNESS; print res;" | bc);
else
NEW_BRIGHTNESS=$(echo "ibase=16; obase=10; res=$BRIGHTNESS; if(res<$MIN_BRIGHTNESS) res=$DEFAULT_BRIGHTNESS; print res;" | bc);
fi
if [ $NEW_BRIGHTNESS != $BRIGHTNESS ]
then
BRIGHTNESS=$NEW_BRIGHTNESS;
#save the default
echo $BRIGHTNESS > $STORING_FILE;
echo "Brighness is set to $BRIGHTNESS";
fi
else
#No file is present, create it.
echo $BRIGHTNESS > $STORING_FILE;
echo "Created new $STORING_FILE!";
fi
fi
#increase brightness
if [ $FLAG = $UPFLAG ]
then
if [ $DIRECTION = '0' ]
then
BRIGHTNESS=$(echo "ibase=16; obase=10; res=$BRIGHTNESS-$STEP; if(res<$MAX_BRIGHTNESS) res=$MAX_BRIGHTNESS; print res;" | bc);
else
BRIGHTNESS=$(echo "ibase=16; obase=10; res=$BRIGHTNESS+$STEP; if(res>$MAX_BRIGHTNESS) res=$MAX_BRIGHTNESS; print res;" | bc);
fi
echo "New brightness is $BRIGHTNESS";
fi
#decrease brightness
if [ $FLAG = $DOWNFLAG ]
then
if [ $DIRECTION = '0' ]
then
BRIGHTNESS=$(echo "ibase=16; obase=10; res=$BRIGHTNESS+$STEP; if(res>$MIN_BRIGHTNESS) res=$MIN_BRIGHTNESS; print res;" | bc);
else
BRIGHTNESS=$(echo "ibase=16; obase=10; res=$BRIGHTNESS-$STEP; if(res<$MIN_BRIGHTNESS) res=$MIN_BRIGHTNESS; print res;" | bc);
fi
echo "New brightness is $BRIGHTNESS";
fi
#set a desired value, be careful!
if [ $FLAG = $SETFLAG ]
then
if [ $# = 2 ]
then
BRIGHTNESS=$2
echo "New brightness is $BRIGHTNESS";
fi
fi
#2012-04-15 make $STORING_FILE writable for all users
chmod --silent a+w $STORING_FILE
#write the new value to the device
CMD="$SETSPICMD=$BRIGHTNESS"
$CMD
In order to play games, or recover brightness after the screen went down for power saving purposes, you'll need to add the "acpi_backlight=vendor" kernel parameter option. With this eMachines 725 laptop, I'm no longer with OpenSUSE. But, I assume, you can easily add a new kernel parameter with Yast.
First of all, you'll need to edit the '/etc/default/grub/' file.
After doing this, you'll be able to increase the brightness of your screen with <Fn>+<left cursor key> (working reversely).
If you want to use your own keyboard shortcuts, then simply install xbacklight (from Software Center or via 'sudo apt-get install xbacklight'). After doing that, you'll be able to assign your personal shortcuts to 'xbacklight -dec 10' for increasing brightness and 'xbacklight -inc 10' for decreasing brightness.
There are different ways to assign keyboard shortcuts to various commands.
A very simple method is to use 'System Settings -> Keyboard Shortcuts' (Ubuntu)
or 'systemsettings -> Input Actions' (OpenSUSE)
You may want to assign the these commands to keyboard shortcuts:
setbrightness -r After the power management turned off the screen, you'll need this one in order to see anything again. It is recommended to turn off screen locking. Otherwise you'll have to enter your password on a dark screen (Ubuntu).setbrightness -u, setbrightness -dsetbrightness -s Store the current brightness setting for next booting.