diff options
author | Michal Gorny <gentoo@mgorny.alt.pl> | 2010-03-27 08:53:04 +0000 |
---|---|---|
committer | Roy Marples <roy@marples.name> | 2010-03-27 08:53:04 +0000 |
commit | 20b4076b12c47a79a5a8c8dc39f43116d376bc88 (patch) | |
tree | 861ab70f15c81f862351532d18a22bda53b8d0de | |
parent | 4d86d346354543f27058923587dd25f8c460363c (diff) |
Support sysfs.
Fixes #214
-rwxr-xr-x | scripts/on_ac_power | 4 |
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 |