summaryrefslogtreecommitdiff
path: root/pm
diff options
context:
space:
mode:
authorVictor Lowther <victor.lowther@gmail.com>2010-06-14 15:10:52 -0500
committerVictor Lowther <victor.lowther@gmail.com>2010-06-15 06:37:39 -0500
commitcb0ad2d4e13972810ebbe2a979b5cb37d740149a (patch)
tree4a1ef3d2ce86b29da1b86522a7b00fbf06ba1b28 /pm
parentb540f8f5c4fffad793d0a4938feb80d6f1f04c18 (diff)
Make powersave hooks a little more verbose.
Diffstat (limited to 'pm')
-rw-r--r--pm/power.d/disable_wol6
-rwxr-xr-xpm/power.d/hal-cd-polling8
-rw-r--r--pm/power.d/harddrive8
-rw-r--r--pm/power.d/intel-audio-powersave5
-rw-r--r--pm/power.d/journal-commit4
-rw-r--r--pm/power.d/laptop-mode3
-rw-r--r--pm/power.d/readahead3
-rw-r--r--pm/power.d/sata_alpm6
8 files changed, 31 insertions, 12 deletions
diff --git a/pm/power.d/disable_wol b/pm/power.d/disable_wol
index 4c720fb..027eec5 100644
--- a/pm/power.d/disable_wol
+++ b/pm/power.d/disable_wol
@@ -8,10 +8,12 @@ set_wol_status() {
for d in "/sys/class/net/"*; do
[ -f "$d/wireless" ] && continue
[ -h "$d/device/driver" ] || continue
+ printf "Setting Wake On Lan for %s to %s..." "${d##*/}" "$1"
case $1 in
- disable) ethtool -s "${d##*/}" wol d;;
- enable) ethtool -s "${d##*/}" wol g;;
+ disable) ethtool -s "${d##*/}" wol d>/dev/null 2>&1;;
+ enable) ethtool -s "${d##*/}" wol g>/dev/null 2>&1;;
esac
+ [ "$?" -eq 0 ] && echo Done. || echo Failed.
done
}
diff --git a/pm/power.d/hal-cd-polling b/pm/power.d/hal-cd-polling
index 82eccd5..51d161d 100755
--- a/pm/power.d/hal-cd-polling
+++ b/pm/power.d/hal-cd-polling
@@ -30,14 +30,18 @@ stop_polling() {
[ "$disks" ] || exit $NA
savestate hal_polling_disks "$disks"
for c in $disks; do
- hal-disable-polling --device "$c"
+ printf "Disabling HAL polling of %s..." "$c"
+ hal-disable-polling --device "$c" >/dev/null 2>&1 \
+ && echo Done. || echo Failed.
done
}
restart_polling() {
state_exists hal_polling_disks || exit $NA
for disk in $(restorestate hal_polling_disks); do
- hal-disable-polling --enable-polling --device "$disk"
+ printf "Reenabling HAL polling of %s..." "$disk"
+ hal-disable-polling --enable-polling --device "$disk" && echo Done || \
+ echo Failed.
done
}
diff --git a/pm/power.d/harddrive b/pm/power.d/harddrive
index a454170..5b257cd 100644
--- a/pm/power.d/harddrive
+++ b/pm/power.d/harddrive
@@ -64,20 +64,24 @@ harddrive_ac () {
for dev in $DRIVE_LIST; do
# disable write caching, do not spin down the drive, disable APM
# and acoustic management, and sync everything to drive.
+ printf "Disabling hard drive power management for %s..." "$dev"
hdparm -W $DRIVE_WRITE_CACHE_AC \
-S $DRIVE_SPINDOWN_VALUE_AC \
-B $DRIVE_POWER_MGMT_AC \
- -M $DRIVE_ACOUSTIC_MGMT_AC $dev
+ -M $DRIVE_ACOUSTIC_MGMT_AC $dev >/dev/null 2>&1 \
+ && echo Done. || echo Failed.
done
}
harddrive_battery() {
for dev in $DRIVE_LIST; do
# disable write caching, enable acoustic management
+ printf "Enabling power management for %s..." "$dev"
hdparm -W $DRIVE_WRITE_CACHE_BAT \
-S $DRIVE_SPINDOWN_VALUE_BAT \
-B $DRIVE_POWER_MGMT_BAT \
- -M $DRIVE_ACOUSTIC_MGMT_BAT -F $dev
+ -M $DRIVE_ACOUSTIC_MGMT_BAT -F $dev >/dev/null 2>&1 \
+ && echo Done. || echo Failed.
done
}
diff --git a/pm/power.d/intel-audio-powersave b/pm/power.d/intel-audio-powersave
index 0e7eab7..36675a8 100644
--- a/pm/power.d/intel-audio-powersave
+++ b/pm/power.d/intel-audio-powersave
@@ -19,8 +19,11 @@ EOF
}
audio_powersave() {
+ [ "$INTEL_AUDIO_POWERSAVE" = "true" ] || exit $NA
for dev in /sys/module/snd_*/parameters/power_save; do
- [ -w $dev ] && [ "$INTEL_AUDIO_POWERSAVE" = "true" ] && echo $1 > $dev
+ [ -w "$dev/parameters/power_save" ] || continue
+ printf "Setting power savings for $s to %d..." "$dev##*/" "$1"
+ echo $1 > "$dev/parameters/power_save" && echo Done. || echo Failed.
done
}
diff --git a/pm/power.d/journal-commit b/pm/power.d/journal-commit
index ee8920c..5c0fc16 100644
--- a/pm/power.d/journal-commit
+++ b/pm/power.d/journal-commit
@@ -43,7 +43,9 @@ handle_filesystems()
while read DEV MOUNT FSTYPE REST;
do
command_exists "handle_${FSTYPE}" || continue
- "handle_${FSTYPE}" $MOUNT $1
+ printf "Setting journal commit time for %s to %d..." \
+ "$MOUNT" "$1"
+ "handle_${FSTYPE}" $MOUNT $1 && echo Done. || echo Failed.
done < /proc/mounts
}
diff --git a/pm/power.d/laptop-mode b/pm/power.d/laptop-mode
index 5f873db..601b260 100644
--- a/pm/power.d/laptop-mode
+++ b/pm/power.d/laptop-mode
@@ -43,7 +43,6 @@ wakeups of the pdflush daemons.
Defaults to 60000 (10 minutes), which menas that the kernel will flush dirty
memory every 10 minutes if dirty memory never hits 40% of system memory.
-
EOF
}
@@ -69,6 +68,7 @@ laptop_mode_ac() {
else
write_values 0 10 5 500
fi
+ echo "Laptop mode disabled."
}
laptop_mode_battery() {
@@ -78,6 +78,7 @@ laptop_mode_battery() {
read_values | savestate laptop_mode_default
write_values "$LAPTOP_MODE" "$LAPTOP_DIRTY_RATIO" \
"$LAPTOP_DIRTY_BG_RATIO" "$LAPTOP_DIRTY_WRITEBACK"
+ echo "Laptop mode enabled."
}
case $1 in
diff --git a/pm/power.d/readahead b/pm/power.d/readahead
index 2009c84..7b337bc 100644
--- a/pm/power.d/readahead
+++ b/pm/power.d/readahead
@@ -32,7 +32,8 @@ readahead() {
# More sophistication in figuring out what exactly is a local block device
# would be welcome.
for dev in $(awk '/^\/dev\// {print $1}'</etc/mtab); do
- /sbin/blockdev --setfra $1 "$dev"
+ printf "Setting readahead for %s to %d..." "$dev" "$1"
+ /sbin/blockdev --setfra $1 "$dev" && echo Done. || echo Failed.
done
}
diff --git a/pm/power.d/sata_alpm b/pm/power.d/sata_alpm
index 6391e09..dbe4117 100644
--- a/pm/power.d/sata_alpm
+++ b/pm/power.d/sata_alpm
@@ -27,8 +27,10 @@ set_sata_alpm() {
[ "$kv" ] || exit $NA #for paranoia's sake
[ "${kv%-*}" \< "2.6.33" ] && exit $NA # avoid fs corruption
for f in /sys/class/scsi_host/host*/link_power_management_policy; do
- [ -w "$f" ] || continue
- echo "$1" > "$f"
+ [ -w "$f/link_power_management_policy" ] || continue
+ printf "Setting SATA APLM on %s to %s..." "${f##*/}" "$1"
+ echo "$1" > "$f/link_power_management_policy" && echo Done. || \
+ echo Failed.
done
}