From 20b4076b12c47a79a5a8c8dc39f43116d376bc88 Mon Sep 17 00:00:00 2001 From: Michal Gorny Date: Sat, 27 Mar 2010 08:53:04 +0000 Subject: Support sysfs. Fixes #214 --- scripts/on_ac_power | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'scripts/on_ac_power') diff --git a/scripts/on_ac_power b/scripts/on_ac_power index 08049525..9ef1df49 100755 --- a/scripts/on_ac_power +++ b/scripts/on_ac_power @@ -9,6 +9,10 @@ if [ -f /proc/acpi/ac_adapter/AC*/state ]; then "state:"*"off-line") return 128;; esac done +elif [ -f /sys/class/power_supply/AC*/online ]; then + cat /sys/class/power_supply/AC*/online | while read line; do + [ "${line}" = 0 ] && return 128 + done elif [ -f /proc/pmu/info ]; then cat /proc/pmu/info | while read line; do case "$line" in -- cgit v1.2.3