aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Gorny <gentoo@mgorny.alt.pl>2010-03-27 08:53:04 +0000
committerRoy Marples <roy@marples.name>2010-03-27 08:53:04 +0000
commit20b4076b12c47a79a5a8c8dc39f43116d376bc88 (patch)
tree861ab70f15c81f862351532d18a22bda53b8d0de
parent4d86d346354543f27058923587dd25f8c460363c (diff)
Support sysfs.
Fixes #214
-rwxr-xr-xscripts/on_ac_power4
1 files changed, 4 insertions, 0 deletions
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