summaryrefslogtreecommitdiff
path: root/pm/power.d
diff options
context:
space:
mode:
authorVictor Lowther <victor.lowther@gmail.com>2010-06-04 09:38:31 -0500
committerVictor Lowther <victor.lowther@gmail.com>2010-06-05 13:42:46 -0500
commita69b163aa760013e5a72327e43f8ef0f21226012 (patch)
tree870075b55067efcfc8d4bfe49d69359bc7cb7473 /pm/power.d
parent21558e0ceb21620ac78f5ef81f937a404fa1abb1 (diff)
Add wakeonlan and pcie aspm powersave hooks.
Diffstat (limited to 'pm/power.d')
-rw-r--r--pm/power.d/disable_wol24
-rw-r--r--pm/power.d/pcie_aspm13
2 files changed, 37 insertions, 0 deletions
diff --git a/pm/power.d/disable_wol b/pm/power.d/disable_wol
new file mode 100644
index 0000000..4c720fb
--- /dev/null
+++ b/pm/power.d/disable_wol
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+. "${PM_FUNCTIONS}"
+
+command_exists ethtool || exit $NA
+
+set_wol_status() {
+ for d in "/sys/class/net/"*; do
+ [ -f "$d/wireless" ] && continue
+ [ -h "$d/device/driver" ] || continue
+ case $1 in
+ disable) ethtool -s "${d##*/}" wol d;;
+ enable) ethtool -s "${d##*/}" wol g;;
+ esac
+ done
+}
+
+case $1 in
+ true) set_wol_status disable;;
+ false) set_wol_status enable;;
+ *) exit $NA;;
+esac
+
+exit 0 \ No newline at end of file
diff --git a/pm/power.d/pcie_aspm b/pm/power.d/pcie_aspm
new file mode 100644
index 0000000..340a2b1
--- /dev/null
+++ b/pm/power.d/pcie_aspm
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+aspm="/sys/module/pcie_aspm/parameters/policy"
+
+[ -w "$aspm" ] || exit $NA
+
+case $1 in
+ true) echo powersave > "$aspm";;
+ false) echo default > "$aspm";;
+ *) exit $NA;;
+esac
+
+exit 0 \ No newline at end of file