Subversion Repositories oBacklight

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 soulskater 1
#!/bin/bash
2
 
3
#####################################################
4
# Simple script to catch the changes to backlight   #
5
# events on sony laptops in combination with        #
6
# nvidia_bl.                                        #
7
#                                                   #
8
# Tested with a Sony Vaio VPCCW1S1E Laptop.         #
9
#                                                   #
10
# This has been tested on openSUSE 11.2 but         #
11
# should work on any distributions.                 #
12
#                                                   #
13
# Released under the BSDL Licens                    #
14
#                                                   #
15
# Author: Marcus Udenhed                            #
16
# Version: 0.3					    #
17
# Last Modified 2010-05-01 14:30                    #
18
#                                                   #
19
#####################################################
20
 
21
### BEGIN INIT INFO
22
# Provides:          Sony Backlight
23
# Default-Start:     3 5
24
# Default-Stop:      0 1 2 6
25
# Short-Description: Provides connector for nvidia_bl
26
# Description:       Provides a connector between the
27
#	standard Sony backlight interface and nvidia_bl
28
#	interface. Captures all backlight events from
29
#	/sys/class/backlight/sony.
30
### END INIT INFO
31
 
32
start() {
33
 
34
/etc/init.d/oBacklight.sh run &
35
 
36
}
37
 
38
stop() {
39
 
40
killall -r oBacklight
41
 
42
}
43
 
44
run() {
45
 
46
DVAR=$(cat /sys/class/backlight/sony/brightness)
47
 
48
while [ exit != 130 ]
49
do
50
 
51
sleep 1
52
 
53
GVAR=$(cat /sys/class/backlight/sony/brightness)
54
 
55
if [ "$GVAR" != "$DVAR" ]
56
 then
57
  echo $GVAR > /sys/class/backlight/nvidia_backlight/brightness
58
  DVAR=$(cat /sys/class/backlight/sony/brightness)
59
fi
60
 
61
done
62
 
63
}
64
 
65
case $1 in
66
start)
67
start
68
;;
69
stop)
70
stop
71
;;
72
run)
73
run
74
;;
75
*)
76
echo "start|stop|run"
77
;;
78
esac