Subversion Repositories oBacklight

Compare Revisions

Ignore whitespace Rev 1 → Rev 2

/tags/oBacklight 0.3.0/src/oBacklight.sh
0,0 → 1,78
#!/bin/bash
 
#####################################################
# Simple script to catch the changes to backlight #
# events on sony laptops in combination with #
# nvidia_bl. #
# #
# Tested with a Sony Vaio VPCCW1S1E Laptop. #
# #
# This has been tested on openSUSE 11.2 but #
# should work on any distributions. #
# #
# Released under the BSDL Licens #
# #
# Author: Marcus Udenhed #
# Version: 0.3 #
# Last Modified 2010-05-01 14:30 #
# #
#####################################################
 
### BEGIN INIT INFO
# Provides: Sony Backlight
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: Provides connector for nvidia_bl
# Description: Provides a connector between the
# standard Sony backlight interface and nvidia_bl
# interface. Captures all backlight events from
# /sys/class/backlight/sony.
### END INIT INFO
 
start() {
 
/etc/init.d/oBacklight.sh run &
 
}
 
stop() {
 
killall -r oBacklight
 
}
 
run() {
 
DVAR=$(cat /sys/class/backlight/sony/brightness)
 
while [ exit != 130 ]
do
 
sleep 1
 
GVAR=$(cat /sys/class/backlight/sony/brightness)
 
if [ "$GVAR" != "$DVAR" ]
then
echo $GVAR > /sys/class/backlight/nvidia_backlight/brightness
DVAR=$(cat /sys/class/backlight/sony/brightness)
fi
 
done
 
}
 
case $1 in
start)
start
;;
stop)
stop
;;
run)
run
;;
*)
echo "start|stop|run"
;;
esac