summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pm/power.d/Makefile.am4
-rw-r--r--pm/power.d/intel-audio-powersave15
-rw-r--r--pm/power.d/wireless24
3 files changed, 42 insertions, 1 deletions
diff --git a/pm/power.d/Makefile.am b/pm/power.d/Makefile.am
index 157e794..8d39ed9 100644
--- a/pm/power.d/Makefile.am
+++ b/pm/power.d/Makefile.am
@@ -5,7 +5,9 @@ power_SCRIPTS = \
harddrive \
laptop-mode \
xfs_buffer \
- readahead
+ readahead \
+ intel-audio-powersave \
+ wireless
EXTRA_DIST=$(power_SCRIPTS)
diff --git a/pm/power.d/intel-audio-powersave b/pm/power.d/intel-audio-powersave
new file mode 100644
index 0000000..f45b88b
--- /dev/null
+++ b/pm/power.d/intel-audio-powersave
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+audio_powersave() {
+ for dev in /sys/module/snd_*_codec/parameters/power_save; do
+ [ -w $dev ] && echo $1 > $dev
+ done
+}
+
+case $1 in
+ true) audio_powersave 1 ;;
+ false) audio_powersave 0 ;;
+ *) exit $NA
+esac
+
+exit 0 \ No newline at end of file
diff --git a/pm/power.d/wireless b/pm/power.d/wireless
new file mode 100644
index 0000000..7de6a03
--- /dev/null
+++ b/pm/power.d/wireless
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+[ -x /sbin/iwconfig ] || exit $NA
+
+wireless_powersave() {
+ case $1 in
+ on) iwparams="txpower auto power on" ;;
+ off) iwparams="txpower auto power off" ;;
+ *) exit $NA ;;
+ esac
+ cd /sys/class/net
+ for dev in *; do
+ [ -w "${dev}/wireless" ] || continue
+ /sbin/iwconfig $dev $iwparams
+ done
+}
+
+case $1 in
+ true) wireless_powersave on ;;
+ false) wireless_powersave off ;;
+ *) exit $NA ;;
+esac
+
+exit 0 \ No newline at end of file