summaryrefslogtreecommitdiff
blob: 5a8e21ff3603270a488522b36bc8f7b4a3744196 (plain)
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
diff -Nur acpid-1.0.6.orig/examples/ac acpid-1.0.6/examples/ac
--- acpid-1.0.6.orig/examples/ac	1970-01-01 01:00:00.000000000 +0100
+++ acpid-1.0.6/examples/ac	2007-07-16 19:37:35.000000000 +0200
@@ -0,0 +1,11 @@
+# /etc/acpid/events/ac
+# This detects changes to AC power status, and passes them to
+# /etc/acpi/ac.sh for further processing.
+
+# Optionally you can specify the placeholder %e. It will pass
+# through the whole kernel event message to the program you've
+# specified.
+
+event=ac_adapter
+action=/etc/acpi/ac.sh
+
diff -Nur acpid-1.0.6.orig/examples/ac.sh acpid-1.0.6/examples/ac.sh
--- acpid-1.0.6.orig/examples/ac.sh	1970-01-01 01:00:00.000000000 +0100
+++ acpid-1.0.6/examples/ac.sh	2007-07-16 19:37:35.000000000 +0200
@@ -0,0 +1,39 @@
+#!/bin/sh
+# /etc/acpid/ac.sh
+# Detect loss of AC power and regaining of AC power, and take action
+# appropriatly.
+
+# On my laptop anyway, this script doesn't not get different parameters for
+# loss of power and regained power. So, I have to use a separate program to
+# tell what the adapter status is.
+
+# This uses the spicctrl program for probing the sonypi device.
+BACKLIGHT=$(spicctrl -B)
+
+if on_ac_power; then
+        # Now on AC power.
+
+        # Tell longrun to go crazy.
+        longrun -f performance
+        longrun -s 0 100
+
+        # Turn up the backlight unless it's up far enough.
+        if [ "$BACKLIGHT" -lt 108 ]; then
+                spicctrl -b 108
+        fi
+else
+        # Now off AC power.
+
+        # Tell longrun to be a miser.
+        longrun -f economy
+        longrun -s 0 50 # adjust to suite..
+
+        # Don't allow the screen to be too bright, but don't turn the
+        # backlight _up_ on removal, and don't turn it all the way down, as
+        # that is unusable on my laptop in most conditions. Adjust to
+        # taste.
+        if [ "$BACKLIGHT" -gt 68 ]; then
+                spicctrl -b 68
+        fi
+fi
+
diff -Nur acpid-1.0.6.orig/examples/default acpid-1.0.6/examples/default
--- acpid-1.0.6.orig/examples/default	1970-01-01 01:00:00.000000000 +0100
+++ acpid-1.0.6/examples/default	2007-07-16 19:37:35.000000000 +0200
@@ -0,0 +1,18 @@
+# This is the ACPID default configuration, it takes all
+# events and passes them to /etc/acpi/default.sh for further
+# processing.
+
+# event keeps a regular expression matching the event. To get
+# power events only, just use something like "event=button power.*"
+# to catch it.
+# action keeps the command to be executed after an event occurs
+# In case of the power event above, your entry may look this way:
+#event=button power.*
+#action=/sbin/init 0
+
+# Optionally you can specify the placeholder %e. It will pass
+# through the whole kernel event message to the program you've
+# specified.
+
+event=.*
+action=/etc/acpi/default.sh %e
diff -Nur acpid-1.0.6.orig/examples/default.sh acpid-1.0.6/examples/default.sh
--- acpid-1.0.6.orig/examples/default.sh	1970-01-01 01:00:00.000000000 +0100
+++ acpid-1.0.6/examples/default.sh	2007-07-16 19:37:35.000000000 +0200
@@ -0,0 +1,32 @@
+#!/bin/sh
+# Default acpi script that takes an entry for all actions
+
+set $*
+
+# Take care about the way events are reported
+ev_type=`echo "$1" | cut -d/ -f1`
+if [ "$ev_type" = "$1" ]; then
+	event="$2";
+else
+	event=`echo "$1" | cut -d/ -f2`
+fi
+
+
+case "$ev_type" in
+    button)
+        case "$event" in
+            power)
+                logger "acpid: received a shutdown request"
+                /sbin/init 0
+		break
+                ;;
+             *)
+                logger "acpid: action $2 is not defined"
+                ;;
+        esac
+    ;;
+
+    *)
+        logger "ACPI group $1 / action $2 is not defined"
+        ;;
+esac