Package: powermgmt-base
Version: 1.30
Followup-For: Bug #473629

Attached is a patch which makes /sbin/on_ac_power check
/sys/class/power_supply/AC/online in addition to /proc/apci.

I only tested it on one computer but there it works with
kernel 2.6.24-1-686 and 2.6.25-2-686.

-- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.25-2-686 (SMP w/2 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages powermgmt-base depends on:
ii  libc6                         2.7-10     GNU C Library: Shared libraries
ii  makedev                       2.3.1-88   creates device files in /dev
ii  module-init-tools             3.4-1      tools for managing Linux kernel mo
ii  udev                          0.114-2    /dev/ and hotplug management daemo

powermgmt-base recommends no packages.

-- no debconf information
--- /sbin/on_ac_power.old       2008-06-22 15:17:16.000000000 +0200
+++ /sbin/on_ac_power   2008-06-22 15:22:52.000000000 +0200
@@ -14,6 +14,12 @@
 set -e
 
 # ACPI
+# Use the new kernel /sys interface if available.
+if [ -f /sys/class/power_supply/AC/online ]; then
+    grep --quiet '^0$' /sys/class/power_supply/AC/online && exit 1
+    grep --quiet '^1$' /sys/class/power_supply/AC/online && exit 0
+fi
+
 #
 # This algorithm is complicated by the possibility of multiple AC
 # adapters.  We scan the ac_adapter directory looking for adapters

Reply via email to