summaryrefslogtreecommitdiff
path: root/pm
diff options
context:
space:
mode:
authorVictor Lowther <victor.lowther@gmail.com>2010-06-14 13:25:24 -0500
committerVictor Lowther <victor.lowther@gmail.com>2010-06-15 06:37:39 -0500
commitb9909dfe65f41eceaf771a7f0caa852fab2839e2 (patch)
treea726c13bcfb20b39cf87698041b23d637ebe5984 /pm
parent1afc0d335b5a55c770ebe12bfe8604a12ca24753 (diff)
Fix some thinkos introduced by the wireless hooks changes.
Among other things, we were not actually enabling power management for wireless adaptors. We are now.
Diffstat (limited to 'pm')
-rw-r--r--pm/power.d/wireless21
1 files changed, 16 insertions, 5 deletions
diff --git a/pm/power.d/wireless b/pm/power.d/wireless
index 0487dc1..b4be69c 100644
--- a/pm/power.d/wireless
+++ b/pm/power.d/wireless
@@ -1,5 +1,7 @@
#!/bin/sh
+. "${PM_FUNCTIONS}"
+
# See if we have the usual wireless tools.
# Do not just fail because not all cards require these.
which iwpriv >/dev/null 2>&1 && have_iwpriv="true"
@@ -18,7 +20,7 @@ get_wireless_params() {
# Skip if not a wireless card.
[ -d "/sys/class/net/$1/wireless" ] || return 1
# Also don't do anything if the device is disabled
- [ "$(cat /sys/class/net/$1/device/enabled)" = "1" ] || return 1
+ [ "$(cat /sys/class/net/$1/device/enable)" = "1" ] || return 1
driver="$(readlink "/sys/class/net/$1/device/driver")"
driver=${driver##*/}
case $driver in
@@ -52,10 +54,19 @@ get_wireless_params() {
wireless_powersave() {
for dev in /sys/class/net/*; do
- get_wireless_params "${dev##*/}" "$1"
- [ "$have_iwconfig" = true -a "$iwconfig" ] && iwconfig $iwconfig
- [ "$have_iwpriv" = true -a "$iwpriv" ] && iwpriv $iwpriv
- [ "$iwlevel" ] && echo "$iwlevel" > "$dev/device/power_level"
+ get_wireless_params "${dev##*/}" "$1" || continue
+ ret=0
+ printf "Turning powersave for %s %s..." "${dev##*/}" "$1"
+ if [ "$have_iwconfig" = true -a "$iwconfig" ]; then
+ iwconfig "${dev##*/}" $iwconfig || ret=1
+ fi
+ if [ "$have_iwpriv" = true -a "$iwpriv" ]; then
+ iwpriv "${dev##*/}" $iwpriv || ret=1
+ fi
+ if [ "$iwlevel" ]; then
+ echo "$iwlevel" > "$dev/device/power_level" || ret=1
+ fi
+ [ "$ret" -eq 0 ] && echo Done. || echo Failed.
done
}