Hey all, brand new to the forum but came here looking for a way to fix the brightness issues on my Samsung N150 Plus.
The bash script posted by voRia wasn't working for me 'out of the box' so to speak. I have modified it slightly, my first time messing with bash scripts.
Code: Select all
#!/bin/sh
# adjust backlight via setpci and dpms via vbetool
# Check if root called this script
USER=`whoami`
if [ $USER != "root" ]; then
echo "Need to be root to run this script."
exit 1
fi
# Get old value
OLD2=`setpci -s 00:02.0 F4.B`
OLD=0x$OLD2
case "$1" in
inc)
# Check if value given for increase
if [ -z "$2" ]; then
echo "Usage: $0 $1 <value>"
exit 1
fi
# Take second argument as value to increment
NEW=$(( $OLD + $2 ))
# Set new value
$0 set $NEW
;;
dec)
# Check if value given for decrease
if [ -z "$2" ]; then
echo "Usage: $0 $1 <value>"
exit 1
fi
# Take second argument as value to decrement
NEW=$(( $OLD - $2 ))
# Set new value
$0 set $NEW
;;
set)
# Check if value given
if [ -z "$2" ]; then
echo "Usage: $0 $1 <value>"
exit 1
fi
# Take second argument as value to set
NEW=$2
# Check if value less than 0
if [ "$NEW" -lt "0" ]; then
NEW=0
fi
# Check if value greater than 255
if [ "$NEW" -gt "255" ]; then
NEW=255
fi
# Set new value
setpci -s 00:02.0 F4.B=`echo "obase=16; ibase=10; $NEW" | bc`
;;
toggle)
# Path to logfile
LOG=/tmp/backlight.log
# Check if logfile does not exist
if [ ! -f $LOG ]; then
vbetool dpms off
touch $LOG
else
vbetool dpms on
rm -rf $LOG
fi
;;
*)
echo "Usage: $0 (inc <value>|dec <value>|set <value>|toggle)"
echo "Current Value: $OLD2"
exit 1
;;
esac
exit 0
Usage is for me:
I've added a line to the script to echo the current set value if you don't give parameters.
And:
Code: Select all
gksudo ./myscript.sh set XX
gksudo ./myscript.sh inc XX
gksudo ./myscript.sh dec XX
set value must be decimal from 0-255
inc value must be decimal from 0-255 (increase)
dec value must be decimal from 0-255 (decrease)
Be careful setting the value to 0 or decreasing the value to 0, as it turns off the display backlight completely.
I know I've kicked up something pretty old on this forum but I needed a fix, maybe other do to
Let me know if there are any issues/questions
and thanks to voRia for most of the hard work
-SometimesRomano
2.6.35-25-generic
Ubutnu 10.10
Samsung N150 Plus
250GB HD
1GB RAM