summaryrefslogtreecommitdiff
path: root/src/pm-powersave
diff options
context:
space:
mode:
authorPhil Knirsch <pknirsch@redhat.com>2006-02-24 12:29:29 +0000
committerPhil Knirsch <pknirsch@redhat.com>2006-02-24 12:29:29 +0000
commita748ded06075250f343553f7cde50843d00bc0f6 (patch)
tree1b8573bf056ccca958ab91576ba4cd67c75c2fe3 /src/pm-powersave
parent3758340f1b05ff9ffadff01f85c6e915c1c6b2d9 (diff)
- Added missing pciutils-devel BuildRequires (#182566)
- Fixed missing vbestata save/restore calls for video suspend/resume (#182167, #169494) - Renamed hook scripts to allow local pre and post inserts (#179421) - Added support for blinking led lights on Thinkpad Laptops during suspend (#179420) - Added pm-powersave script for powersaving via HAL (#169054) - Added symlinks for pm-shutdown and pm-restart (#165953)
Diffstat (limited to 'src/pm-powersave')
-rwxr-xr-xsrc/pm-powersave55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/pm-powersave b/src/pm-powersave
new file mode 100755
index 0000000..ff15d82
--- /dev/null
+++ b/src/pm-powersave
@@ -0,0 +1,55 @@
+#!/bin/sh
+
+# Simple low-power-mode script
+# Based on work from:
+# Bill Nottingham <notting@redhat.com>
+# Peter Jones <pjones@redhat.com>
+# David Zeuthen <davidz@redhat.com>
+# Richard Hughes <richard@hughsie.com>
+#
+# Values are taken from the laptop-tools package
+# Bart Samwel <bart@samwel.tk>
+
+if [ "$1" == "true" ] ; then
+ echo "SetLowPower ON"
+ DISK_IDLE_SECS=2
+ DIRTY_WRITEBACK=30
+ DIRTY_EXPIRE=30
+ DIRTY_RATIO=60
+ DIRTY_BACKGROUND_RATIO=1
+elif [ "$1" == "false" ] ; then
+ echo "SetLowPower OFF"
+ DISK_IDLE_SECS=0
+ DIRTY_WRITEBACK=500
+ DIRTY_EXPIRE=3000
+ DIRTY_RATIO=40
+ DIRTY_BACKGROUND_RATIO=10
+else
+ echo "Argument needs to be true or false"
+ exit 1
+fi
+
+if [ ! -w "/proc/sys/vm/" ] ; then
+ # Use the raw kernel sysfs interface
+ echo "You do not have write access to /proc/sys/vm/"
+ exit 1
+fi
+
+# Seconds laptop mode has to to wait after the disk
+# goes idle before doing a sync.
+echo $DISK_IDLE_SECS > /proc/sys/vm/laptop_mode
+
+# Set dirty page values
+echo $DIRTY_WRITEBACK > /proc/sys/vm/dirty_writeback_centisecs
+echo $DIRTY_EXPIRE > /proc/sys/vm/dirty_expire_centisecs
+
+# Dirty synchronous ratio. At this percentage of dirty
+# pages the process which calls write() does its own writeback.
+echo $DIRTY_RATIO > /proc/sys/vm/dirty_ratio
+
+# Allowed dirty background ratio, in percent.
+# Once DIRTY_RATIO has been exceeded, the kernel will wake pdflush
+# which will then reduce the amount of dirty memory to
+# dirty_background_ratio. Set this nice and low, so once some
+# writeout has commenced, we do a lot of it.
+echo $DIRTY_BACKGROUND_RATIO > /proc/sys/vm/dirty_background_ratio