Package: acpi-support Version: 0.109-5 Severity: normal Tags: patch Newer kernels have disabled the /proc interface to power management, leaving only the /sys. However, the /etc/acpi/power.sh script makes a decision about running the scripts in battery.d by looking for ac adapters in /proc (this also affects the running of scripts in ac.d).
The patch below fixes it for me (but this is the first time I have ever done anything with the /sys power interface, so I don't know how correct the method for finding ac adapters is). -- System Information: Debian Release: lenny/sid APT prefers unstable APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental') Architecture: i386 (i686) Kernel: Linux 2.6.25-2-686 (SMP w/2 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages acpi-support depends on: ii acpi-support-base 0.109-5 scripts for handling base ACPI eve ii acpid 1.0.6-10 Utilities for using ACPI power man ii dmidecode 2.9-1 Dump Desktop Management Interface ii finger 0.17-12 user information lookup program ii hdparm 8.9-1 tune hard disk parameters for high ii laptop-detect 0.13.6 attempt to detect a laptop ii libc6 2.7-12 GNU C Library: Shared libraries ii lsb-base 3.2-15 Linux Standard Base 3.2 init scrip ii powermgmt-base 1.30 Common utils and configs for power ii vbetool 1.0-3 run real-mode video BIOS code to a ii x11-xserver-utils 7.3+3 X server utilities Versions of packages acpi-support recommends: pn dbus <none> (no description available) pn hal <none> (no description available) ii nvclock 0.8b3-1 Allows you to overclock your nVidi ii pm-utils 1.1.2.3-1 utilities and scripts for power ma ii radeontool 1.5-5 utility to control ATI Radeon back ii toshset 1.73-2 Access much of the Toshiba laptop Versions of packages acpi-support suggests: pn laptop-mode-tools <none> (no description available) -- no debconf information
diff --git a/power.sh b/power.sh index f14f7b4..ceba154 100755 --- a/power.sh +++ b/power.sh @@ -9,22 +9,27 @@ getState; checkStateChanged; -for x in /proc/acpi/ac_adapter/*; do - if [ -d "$x" ] ; then - grep -q off-line $x/state +ac_adapters() { + for x in /sys/class/power_supply/*; do + read type <$x/type + test "$type" = "Mains" && echo $x + done +} - if [ $? = 0 ] && [ x$1 != xstop ]; then - for SCRIPT in /etc/acpi/battery.d/*.sh; do - if [ -f $SCRIPT ] ; then - . $SCRIPT - fi - done - else - for SCRIPT in /etc/acpi/ac.d/*.sh; do - if [ -f $SCRIPT ] ; then - . $SCRIPT - fi - done +for x in $(ac_adapters); do + grep -q 0 $x/online + + if [ $? = 0 ] && [ x$1 != xstop ]; then + for SCRIPT in /etc/acpi/battery.d/*.sh; do + if [ -f $SCRIPT ] ; then + . $SCRIPT + fi + done + else + for SCRIPT in /etc/acpi/ac.d/*.sh; do + if [ -f $SCRIPT ] ; then + . $SCRIPT fi + done fi done