Package: acpi-support
Version: 0.142-6
Severity: normal
Tags: patch

Hi,

this issue is similar to #767947. On my Macbook Air (2013), however, the
power supply status is found in

    /sys/class/power_supply/ADP1/online

I have attached a patch against git master with a possible solution.

Regards,
Christian
>From 1395ae1dde0a1d30510093e1b6750120100d4303 Mon Sep 17 00:00:00 2001
From: Christian Kastner <[email protected]>
Date: Sun, 28 Dec 2014 22:20:00 +0100
Subject: [PATCH] Adjust power.sh for even more AC adapter names

---
 debian/addons/scripts/power.sh | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/debian/addons/scripts/power.sh b/debian/addons/scripts/power.sh
index ff00736..68cc109 100755
--- a/debian/addons/scripts/power.sh
+++ b/debian/addons/scripts/power.sh
@@ -9,7 +9,15 @@ if { CheckPolicy || CheckUPowerPolicy; }; then
     exit
 fi
 
-if `cat /sys/class/power_supply/AC*/online | grep -q 1`; then
+if ls /sys/class/power_supply/AC* > /dev/null 2>&1; then
+	devpath=/sys/class/power_supply/AC*/online
+elif ls /sys/class/power_supply/ADP* > /dev/null 2>&1; then
+	devpath=/sys/class/power_supply/ADP*/online
+else
+	exit
+fi
+
+if `cat $devpath | grep -q 1`; then
 	pm-powersave false
 else
 	pm-powersave true
-- 
2.1.4

Reply via email to