blob: b9da7d15da5ebfdb0c43e3f51f469e65d9e827a9 (
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
|
#!/bin/sh
# Battery acpi script that set different speedfreq modes depending on AC adapter
# Can only handle one battery at the time, will add support for more when I get time
#
# To use this script add the following lines to /etc/acpi/events/default
# event=battery.*
# action=/etc/acpi/battery.sh %e
set $*
source /etc/conf.d/speedfreq
[ "${SPEEDFREQ_SPEED}" != "auto" ] && exit 0
case "$2" in
BAT1)
if [ $4 -eq 00000001 ] && [ -f /proc/acpi/battery/BAT1/state ] ; then
action="`cat /proc/acpi/battery/BAT1/state | grep charging | cut -c 26-`"
case $action in
charging) /usr/bin/speedfreq -p performance
logger "A/C adapter plugged in"
;;
discharging) /usr/bin/speedfreq -p powersave
logger "A/C adapter plugged out"
;;
esac
fi
;;
esac
|