1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
|
Index: tools/hal-system-lcd-get-brightness
===================================================================
RCS file: /cvs/hal/hal/tools/hal-system-lcd-get-brightness,v
retrieving revision 1.7
diff -u -r1.7 hal-system-lcd-get-brightness
--- hal-0.5.7/tools/hal-system-lcd-get-brightness 18 Feb 2006 23:11:23 -0000 1.7
+++ hal-0.5.7/tools/hal-system-lcd-get-brightness 19 Feb 2006 22:44:22 -0000
@@ -8,13 +8,13 @@
# (at your option) any later version.
# Check for environment variables
-if [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "" ]; then
+if [ -z "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" ]; then
echo "Missing or empty environment variable(s)." >&2
echo "This script should be started by hald." >&2
exit 1
fi
-if [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "pmu" ]; then
+if [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "pmu" ]; then
value="`hal-system-power-pmu getlcd`"
if [ $? -ne 0 ]; then
echo "org.freedesktop.Hal.Device.LaptopPanel.NotSupported" >&2
@@ -24,37 +24,37 @@
fi
# Check for file existance and that it's readable
-if [ ! -r $HAL_PROP_LINUX_ACPI_PATH ]; then
+if [ ! -r "$HAL_PROP_LINUX_ACPI_PATH" ]; then
echo "org.freedesktop.Hal.Device.LaptopPanel.NotSupported" >&2
echo "$1 not readable!" >&2
exit 1
fi
-if [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "toshiba" ]; then
+if [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "toshiba" ]; then
# cat /proc/acpi/toshiba/lcd
# brightness: 5
# brightness_levels: 8
value="`cat $HAL_PROP_LINUX_ACPI_PATH | grep brightness: | awk '{print $2;}'`"
-elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "asus" ]; then
+elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "asus" ]; then
# cat /proc/acpi/asus/brn
# 5
value="`cat $HAL_PROP_LINUX_ACPI_PATH`"
-elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "panasonic" ]; then
+elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "panasonic" ]; then
# cat /proc/acpi/pcc/brightness
# 5
value="`cat $HAL_PROP_LINUX_ACPI_PATH`"
-elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "ibm" ]; then
+elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "ibm" ]; then
# cat /proc/acpi/ibm/brightness
# level: 5
# commands: up, down
# commands: level <level> (<level> is 0-7)
value="`cat $HAL_PROP_LINUX_ACPI_PATH | grep level: | awk '{print $2;}'`"
-elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "sony" ]; then
+elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "sony" ]; then
# cat /proc/acpi/sony/brightness
# 5
value="`cat $HAL_PROP_LINUX_ACPI_PATH`"
let "value = ${value} - 1"
-elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "omnibook" ]; then
+elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "omnibook" ]; then
# cat /proc/omnibook/lcd
# LCD brightness: 7
value="`cat $HAL_PROP_LINUX_ACPI_PATH | awk '{print $3;}'`"
Index: tools/hal-system-lcd-set-brightness
===================================================================
RCS file: /cvs/hal/hal/tools/hal-system-lcd-set-brightness,v
retrieving revision 1.7
diff -u -r1.7 hal-system-lcd-set-brightness
--- hal-0.5.7/tools/hal-system-lcd-set-brightness 18 Feb 2006 23:11:23 -0000 1.7
+++ hal-0.5.7/tools/hal-system-lcd-set-brightness 19 Feb 2006 22:44:23 -0000
@@ -8,8 +8,8 @@
# (at your option) any later version.
# Check for environment variables
-if [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "" ] ||
- [ "$HAL_PROP_LAPTOP_PANEL_NUM_LEVELS" == "" ] ; then
+if [ -z "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" ] ||
+ [ -z "$HAL_PROP_LAPTOP_PANEL_NUM_LEVELS" ] ; then
echo "Missing or empty environment variable(s)." >&2
echo "This script should be started by hald." >&2
exit 1
@@ -18,7 +18,14 @@
# read value for set brightness
read value
-if [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "pmu" ]; then
+# Check for values outside range
+if [ ${value} -lt 0 ] || [ ${value} -gt $HAL_PROP_LAPTOP_PANEL_NUM_LEVELS ]; then
+ echo "org.freedesktop.Hal.Device.LaptopPanel.Invalid" >&2
+ echo "Brightness has to be between 0 and $HAL_PROP_LAPTOP_PANEL_NUM_LEVELS!" >&2
+ exit 1
+fi
+
+if [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "pmu" ]; then
hal-system-power-pmu setlcd $value
if [ $? -ne 0 ]; then
echo "org.freedesktop.Hal.Device.LaptopPanel.NotSupported" >&2
@@ -28,39 +35,33 @@
fi
# Check for file existance and that it's writable
-if [ ! -w $HAL_PROP_LINUX_ACPI_PATH ]; then
+if [ ! -w "$HAL_PROP_LINUX_ACPI_PATH" ]; then
echo "org.freedesktop.Hal.Device.LaptopPanel.NotSupported" >&2
echo "$1 not writable!" >&2
exit 1
fi
-# Check for values outside range
-if [ ${value} -lt 0 ] || [ ${value} -gt $HAL_PROP_LAPTOP_PANEL_NUM_LEVELS ]; then
- echo "org.freedesktop.Hal.Device.LaptopPanel.Invalid" >&2
- echo "Brightness has to be between 0 and $HAL_PROP_LAPTOP_PANEL_NUM_LEVELS!" >&2
- exit 1
-fi
-if [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "toshiba" ]; then
+if [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "toshiba" ]; then
# echo "brightness: {0..x}" >/proc/acpi/toshiba/lcd
echo "brightness: $value" > $HAL_PROP_LINUX_ACPI_PATH
-elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "asus" ]; then
+elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "asus" ]; then
# echo {0..15} > /proc/acpi/asus/brn
# http://www.taupro.com/wiki/ChemBook/LCDdisplayPowerConfiguration
echo "$value" > $HAL_PROP_LINUX_ACPI_PATH
-elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "panasonic" ]; then
+elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "panasonic" ]; then
# echo {0..15} > /proc/acpi/pcc/brightness
# http://readlist.com/lists/vger.kernel.org/linux-kernel/7/36405.html
echo "$value" > $HAL_PROP_LINUX_ACPI_PATH
-elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "ibm" ]; then
+elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "ibm" ]; then
# echo "level {0..7}" > /proc/acpi/ibm/brightness
# http://ibm-acpi.sourceforge.net/README
echo "level $value" > $HAL_PROP_LINUX_ACPI_PATH
-elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "sony" ]; then
+elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "sony" ]; then
# echo "{1..8}" > /proc/acpi/sony/brightness
# http://popies.net/sonypi/2.6-sony_acpi4.patch
echo "$value" > $HAL_PROP_LINUX_ACPI_PATH
-elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "omnibook" ]; then
+elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "omnibook" ]; then
# echo "{0..7}" > /proc/omnibook/lcd
# http://bugzilla.gnome.org/show_bug.cgi?id=331458
echo "$value" > $HAL_PROP_LINUX_ACPI_PATH
Index: tools/hal-system-power-hibernate
===================================================================
RCS file: /cvs/hal/hal/tools/hal-system-power-hibernate,v
retrieving revision 1.6
diff -u -r1.6 hal-system-power-hibernate
--- hal-0.5.7/tools/hal-system-power-hibernate 16 Jan 2006 12:47:40 -0000 1.6
+++ hal-0.5.7/tools/hal-system-power-hibernate 19 Feb 2006 22:44:23 -0000
@@ -43,8 +43,9 @@
# Suspend2 tools installed
/usr/sbin/hibernate --force
RET=$?
- elif [ -w "/sys/power/state" ] ; then
- # Use the raw kernel sysfs interface
+ elif [ -w "/sys/power/state" ] &&
+ [ "$HAL_PROP_POWER_MANAGEMENT_TYPE" != pmu ] ; then
+ # Use the raw kernel sysfs interface if possible (not on pmu yet)
echo "disk" > /sys/power/state
RET=$?
else
Index: tools/hal-system-power-suspend
===================================================================
RCS file: /cvs/hal/hal/tools/hal-system-power-suspend,v
retrieving revision 1.6
diff -u -r1.6 hal-system-power-suspend
--- hal-0.5.7/tools/hal-system-power-suspend 18 Feb 2006 23:00:55 -0000 1.6
+++ hal-0.5.7/tools/hal-system-power-suspend 19 Feb 2006 22:44:23 -0000
@@ -18,15 +18,6 @@
read seconds_to_sleep
-#PMU systems cannot use /sys/power/state yet, so use a helper to issue an ioctl
-if [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" == "pmu" ]; then
- hal-system-power-pmu sleep
- if [ $? -ne 0 ]; then
- echo "org.freedesktop.Hal.Device.SystemPowerManagement.NotSupported" >&2
- exit 1
- fi
- exit 0
-fi
#SuSE and ALTLinux only support powersave
if [ -f "/etc/altlinux-release" ] || [ -f "/etc/SuSE-release" ] ; then
@@ -62,6 +53,10 @@
elif [ -x "/usr/sbin/pmi" ] ; then
/usr/sbin/pmi action suspend force
RET=$?
+ elif [ "$HAL_PROP_POWER_MANAGEMENT_TYPE" = "pmu" ]; then
+ #PMU systems cannot use /sys/power/state yet, so use a helper to issue an ioctl
+ hal-system-power-pmu sleep
+ RET=$?
elif [ -w "/sys/power/state" ] ; then
# Use the raw kernel sysfs interface
echo "mem" > /sys/power/state
@@ -72,4 +67,8 @@
fi
fi
+if [ $RET -ne 0 ]; then
+ echo "org.freedesktop.Hal.Device.SystemPowerManagement.NotSupported" >&2
+ exit 1
+fi
exit $RET
|