]>
Commit | Line | Data |
---|---|---|
6af9fa45 | 1 | #!/bin/sh |
2 | # /etc/acpid/actions/battery.sh | |
3 | # based on work by Frank Dietrich <ablesoft@gmx.de> | |
4 | # | |
5 | # Detect AC connector plugged in or unplugged and take appropriate actions. | |
6 | ||
7 | if [ $# != 1 ]; then | |
8 | exit 1 | |
9 | fi | |
10 | set $* | |
11 | ||
12 | # get the AC connector state from /proc filesystem. | |
13 | STATE=`sed -n 's/^.*\(off\|on\)-line.*/\1/p' /proc/acpi/ac_adapter/AC/state` | |
14 | ||
15 | case "$STATE" in | |
16 | on) | |
17 | # AC connector plugged in | |
18 | logger "acpid: AC connector plugged in." | |
19 | # deactivate standby (spindown) timeout for the drive | |
20 | #hdparm -q -S 0 /dev/hda | |
36f3d875 | 21 | # handle processor |
6af9fa45 | 22 | #echo 0 > /proc/acpi/processor/CPU0/throttling |
23 | #echo 0 > /proc/acpi/processor/CPU0/performance | |
24 | ;; | |
25 | off) | |
26 | # AC connector unplugged | |
27 | logger "acpid: AC connector unplugged." | |
28 | # activate standby (spindown) timeout for the drive | |
29 | # timeout 5 minutes (man hdparm, for more informations) | |
30 | #hdparm -q -S 60 /dev/hda | |
31 | # handle processor | |
32 | #echo 4 > /proc/acpi/processor/CPU0/throttling | |
33 | #echo 3 > /proc/acpi/processor/CPU0/performance | |
34 | ;; | |
35 | *) | |
36 | # AC connector in undetermined state | |
37 | logger "acpid: Could not determine new AC connector state." | |
38 | ;; | |
39 | esac |