]> git.pld-linux.org Git - packages/acpid.git/blob - acpid.battery.sh
- typo
[packages/acpid.git] / acpid.battery.sh
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
21                 # handle processor
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
This page took 0.100355 seconds and 3 git commands to generate.