tags 473629 + patch thanks Hi,
Attached is the diff for my powermgmt-base 1.30+nmu1 NMU. -- see shy jo
diff -Nru powermgmt-base-1.30/debian/changelog powermgmt-base-1.30+nmu1/debian/changelog
--- powermgmt-base-1.30/debian/changelog 2008-02-17 15:43:30.000000000 -0500
+++ powermgmt-base-1.30+nmu1/debian/changelog 2008-09-01 13:45:06.000000000 -0400
@@ -1,3 +1,12 @@
+powermgmt-base (1.30+nmu1) unstable; urgency=low
+
+ * NMU
+ * on_ac_power: Use /sys/class/power_supply on 2.6.25+ systems where
+ /proc/acpi/ac_adaptor is no longer present. Closes: #473629
+ (Patch by Vefa Bicakci.)
+
+ -- Joey Hess <[EMAIL PROTECTED]> Mon, 01 Sep 2008 13:27:22 -0400
+
powermgmt-base (1.30) unstable; urgency=low
* debian/control: bump standards-version (no changes).
diff -Nru powermgmt-base-1.30/src/on_ac_power powermgmt-base-1.30+nmu1/src/on_ac_power
--- powermgmt-base-1.30/src/on_ac_power 2007-08-23 22:07:25.000000000 -0400
+++ powermgmt-base-1.30+nmu1/src/on_ac_power 2008-09-01 13:42:08.000000000 -0400
@@ -16,23 +16,38 @@
# ACPI
#
# This algorithm is complicated by the possibility of multiple AC
-# adapters. We scan the ac_adapter directory looking for adapters
+# adapters. We scan the ac_adapter/power_supply directory looking for adapters
# that have known states. If any adapter is on-line, we return 0. If
# no adapters are on-line but one or more are off-line, we return 1.
#
-if /sbin/acpi_available && [ -d /proc/acpi/ac_adapter ]; then
+if /sbin/acpi_available; then
OFF_LINE_P=no
- for FN in /proc/acpi/ac_adapter/*; do
- if [ -d "${FN}" ]; then
- if [ -r "${FN}/state" ]; then
- grep --quiet on-line "${FN}/state" && exit 0
- grep --quiet off-line "${FN}/state" && OFF_LINE_P=yes
- elif [ -r "${FN}/status" ]; then
- grep --quiet on-line "${FN}/status" && exit 0
- grep --quiet off-line "${FN}/status" && OFF_LINE_P=yes
+ if [ -d /sys/class/power_supply/ ]; then
+ for FN in /sys/class/power_supply/*; do
+ if test -d "${FN}" && test -r "${FN}/type"; then
+ type="$(cat ${FN}/type)"
+ if test "x${type}" = "xMains"; then
+ if [ -r "${FN}/online" ]; then
+ online="$(cat ${FN}/online)"
+ [ "$online" = 1 ] && exit 0
+ [ "$online" = 0 ] && OFF_LINE_P=yes
+ fi
+ fi
fi
- fi
- done
+ done
+ elif [ -d /proc/acpi/ac_adapter ]; then
+ for FN in /proc/acpi/ac_adapter/*; do
+ if [ -d "${FN}" ]; then
+ if [ -r "${FN}/state" ]; then
+ grep --quiet on-line "${FN}/state" && exit 0
+ grep --quiet off-line "${FN}/state" && OFF_LINE_P=yes
+ elif [ -r "${FN}/status" ]; then
+ grep --quiet on-line "${FN}/status" && exit 0
+ grep --quiet off-line "${FN}/status" && OFF_LINE_P=yes
+ fi
+ fi
+ done
+ fi
[ "${OFF_LINE_P}" = "yes" ] && exit 1
fi
signature.asc
Description: Digital signature

