Package: pm-utils
Version: 1.4.1-6
Severity: wishlist
Could you please consider prepending timed info in logs, to be able to
more quickly identify cycles and thus find where it could went wrong ?
I am attaching a working patch using your log function but moved from
pm-functions to functions.
With output (shortened to prevent word-wrap) like hereafter
[2011-02-21 19:48:37] =======================================
[2011-02-21 19:48:37] ### Finished.
[2011-02-21 19:48:37] =======================================
[2011-02-21 22:19:45] ### Initial commandline parameters:
[2011-02-21 22:19:45] ---------------------------------------
[2011-02-21 22:19:45] ### Running hooks for suspend.
[2011-02-21 22:19:45]
[2011-02-21 22:19:45] Running hook [...]kernel-change suspend suspend:
[2011-02-21 22:19:45] [...]kernel-change suspend suspend: success.
[2011-02-21 22:19:45]
[2011-02-21 22:19:45] ...
[2011-02-21 22:19:48] =======================================
[2011-02-21 22:19:48] ### performing suspend
[2011-02-21 22:19:48] .......................................
[2011-02-21 22:53:20] ### Awake.
[2011-02-21 22:53:20] ---------------------------------------
[2011-02-21 22:53:20] ### Running hooks for resume
[2011-02-21 22:53:20]
[2011-02-21 22:53:20] Running hook [...]/99video resume suspend:
[2011-02-21 22:53:21] [...]/99video resume suspend: success.
[2011-02-21 22:53:21]
[2011-02-23 13:25:43] ...
[2011-02-21 22:53:21] =======================================
[2011-02-21 22:53:21] ### Finished.
I remain at your disposal for any test/other upstream bugreporting
thanks - cheers
-- System Information:
Debian Release: wheezy/sid
APT prefers unstable
APT policy: (993, 'unstable'), (988, 'testing'), (986, 'testing'), (984,
'stable'), (982, 'stable'), (98, 'unstable'), (96, 'experimental')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.37-1-amd64 (SMP w/8 CPU cores)
Locale: LANG=fr_FR.utf8, LC_CTYPE=fr_FR.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages pm-utils depends on:
ii kbd 1.15.2-2 Linux console font and keytable ut
ii powermgmt-base 1.31 Common utils and configs for power
Versions of packages pm-utils recommends:
ii hdparm 9.32-1 tune hard disk parameters for high
ii procps 1:3.2.8-10 /proc file system utilities
ii vbetool 1.1-2 run real-mode video BIOS code to a
Versions of packages pm-utils suggests:
ii cpufrequtils 007-1 utilities to deal with the cpufreq
ii ethtool 1:2.6.34-3 display or change Ethernet device
pn radeontool <none> (no description available)
ii wireless-tools 30~pre9-5 Tools for manipulating Linux Wirel
-- no debconf information
diff -uNr pm-utils_1.4.1-6_all//bin/pm-action pm-utils_1.4.1-6+r2rien1_all//bin/pm-action
--- pm-utils_1.4.1-6_all//bin/pm-action 2011-02-06 14:23:08.000000000 +0100
+++ pm-utils_1.4.1-6+r2rien1_all//bin/pm-action 2011-02-20 03:50:39.000000000 +0100
@@ -90,26 +90,31 @@
esac
init_logfile "${PM_LOGFILE}"
-log "Initial commandline parameters: $PM_CMDLINE"
+log "### Initial commandline parameters: $PM_CMDLINE"
+log "--------------------------------------------------------------"
load_hook_blacklist
load_hook_parameters
# run the sleep hooks
-log "$(date): Running hooks for $ACTION."
+log "### Running hooks for $ACTION."
if run_hooks sleep "$ACTION $METHOD"; then
- # Sleep only if we know how and if a hook did not inhibit us.
- log "$(date): performing $METHOD"
+ # Sleep only if we know how and if a hook did not inhibit us.
+ log "### performing $METHOD"
+ log ".............................................................."
sync
"do_$METHOD" || r=128
- log "$(date): Awake."
+ log "### Awake."
+ log "--------------------------------------------------------------"
else
- log "$(date): Inhibit found, will not perform $METHOD"
+ log "### Inhibit found, will not perform $METHOD"
+ log "--------------------------------------------------------------"
fi
-log "$(date): Running hooks for $REVERSE"
+log "### Running hooks for $REVERSE"
# run the sleep hooks in reverse with the wakeup action
if run_hooks sleep "$REVERSE $METHOD" reverse; then
- log "$(date): Finished."
+ log "### Finished."
+ log "=============================================================="
else
- exit $((r+1))
+ exit $((r+1))
fi
exit $r
diff -uNr pm-utils_1.4.1-6_all//functions pm-utils_1.4.1-6+r2rien1_all//functions
--- pm-utils_1.4.1-6_all//functions 2011-02-06 14:22:58.000000000 +0100
+++ pm-utils_1.4.1-6+r2rien1_all//functions 2011-02-19 19:23:39.000000000 +0100
@@ -3,6 +3,19 @@
# Common functionality for the hooks.
+# Simple little logging function.
+# We do it this way because 'echo -n' is not posix.
+# '-a' for appending after a previous '-n'
+log()
+{
+ is_set "$LOGGING" || return 0;
+ ldate=$(date +%F\ %X)
+ local fmt='%s\n'
+ [ "$1" = "-n" ] && { fmt='%s'; shift; }
+ [ "$1" = "-a" ] && { ldate=""; shift; } || ldate="[$ldate]"
+ printf "$fmt" "$ldate $*"
+}
+
# If a variable is set to true, yes, 1, or is simply set with no value,
# return 0, otherwise return 1.
is_set()
diff -uNr pm-utils_1.4.1-6_all//pm-functions pm-utils_1.4.1-6+r2rien1_all//pm-functions
--- pm-utils_1.4.1-6_all//pm-functions 2011-02-06 14:22:58.000000000 +0100
+++ pm-utils_1.4.1-6+r2rien1_all//pm-functions 2011-02-20 03:36:38.000000000 +0100
@@ -85,16 +85,6 @@
. "${PM_FUNCTIONS}"
-# Simple little logging function.
-# We do it this way because 'echo -n' is not posix.
-log()
-{
- is_set "$LOGGING" || return 0;
- local fmt='%s\n'
- [ "$1" = "-n" ] && { fmt='%s'; shift; }
- printf "$fmt" "$*"
-}
-
profiling() { [ "$PM_PROFILE" = "true" ]; }
if profiling; then
@@ -172,11 +162,11 @@
hook_exit_status(){
case $1 in
- 0) log "success." ;;
- $NA) log "not applicable." ;;
- $NX) log "not executable." ;;
- $DX) log "disabled." ;;
- *) log "Returned exit code $1."; return 1 ;;
+ 0) log -a "success." ;;
+ $NA) log -a "not applicable." ;;
+ $NX) log -a "not executable." ;;
+ $DX) log -a "disabled." ;;
+ *) log -a "Returned exit code $1."; return 1 ;;
esac
}
@@ -195,9 +185,9 @@
_run_hook() {
# $1 = hook to run
# rest of args passed to hook unchanged.
+ log ""
log "Running hook $*:"
hook_ok "$1" && "$@"
- log ""
log -n "$*: "
hook_exit_status $? && LAST_HOOK="${1##*/}" || inhibit
}
@@ -248,6 +238,8 @@
done
IFS="${oifs}"
# return value is 1 if something was inhibited, 0 otherwise.
+ log ""
+ log "=============================================================="
inhibited && return 1 || return 0
}
diff -uNr pm-utils_1.4.1-6_all//power.d/disable_wol pm-utils_1.4.1-6+r2rien1_all//power.d/disable_wol
--- pm-utils_1.4.1-6_all//power.d/disable_wol 2011-02-06 14:22:58.000000000 +0100
+++ pm-utils_1.4.1-6+r2rien1_all//power.d/disable_wol 2011-02-19 21:51:34.000000000 +0100
@@ -8,12 +8,12 @@
for d in "/sys/class/net/"*; do
[ -e "$d/wireless" ] && continue
[ -h "$d/device/driver" ] || continue
- printf "Setting Wake On Lan for %s to %s..." "${d##*/}" "$1"
+ msg=$(printf "Setting Wake On Lan for %s to %s" "${d##*/}" "$1")
case $1 in
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.
+ [ "$?" -eq 0 ] && log "$msg...Done." || log "$msg...Failed."
done
}
diff -uNr pm-utils_1.4.1-6_all//power.d/hal-cd-polling pm-utils_1.4.1-6+r2rien1_all//power.d/hal-cd-polling
--- pm-utils_1.4.1-6_all//power.d/hal-cd-polling 2011-02-06 14:22:58.000000000 +0100
+++ pm-utils_1.4.1-6+r2rien1_all//power.d/hal-cd-polling 2011-02-19 18:45:34.000000000 +0100
@@ -30,18 +30,18 @@
[ "$disks" ] || exit $NA
savestate hal_polling_disks "$disks"
for c in $disks; do
- printf "Disabling HAL polling of %s..." "$c"
+ msg=$(printf "Disabling HAL polling of %s" "$c")
hal-disable-polling --device "$c" >/dev/null 2>&1 \
- && echo Done. || echo Failed.
+ && log "$msg...Done." || log "$msg...Failed."
done
}
restart_polling() {
state_exists hal_polling_disks || exit $NA
for disk in $(restorestate hal_polling_disks); do
- printf "Reenabling HAL polling of %s..." "$disk"
- hal-disable-polling --enable-polling --device "$disk" && echo Done || \
- echo Failed.
+ msg=$(printf "Reenabling HAL polling of %s..." "$disk")
+ hal-disable-polling --enable-polling --device "$disk" \
+ && log "$msg...Done." || log "$msg...Failed."
done
}
diff -uNr pm-utils_1.4.1-6_all//power.d/intel-audio-powersave pm-utils_1.4.1-6+r2rien1_all//power.d/intel-audio-powersave
--- pm-utils_1.4.1-6_all//power.d/intel-audio-powersave 2011-02-06 14:22:58.000000000 +0100
+++ pm-utils_1.4.1-6+r2rien1_all//power.d/intel-audio-powersave 2011-02-19 18:54:06.000000000 +0100
@@ -4,6 +4,8 @@
# once the driver has been inactive for a second.
# This hook should work with at least the ac97 and hda codecs.
+. "${PM_FUNCTIONS}"
+
INTEL_AUDIO_POWERSAVE=${INTEL_AUDIO_POWERSAVE:-true}
help() {
@@ -22,8 +24,9 @@
[ "$INTEL_AUDIO_POWERSAVE" = "true" ] || exit $NA
for dev in /sys/module/snd_*; do
[ -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.
+ msg=$(printf "Setting power savings for %s to %d" "${dev##*/}" "$1")
+ echo $1 > "$dev/parameters/power_save" \
+ && log "$msg...Done." || log "$msg...Failed."
done
}
diff -uNr pm-utils_1.4.1-6_all//power.d/journal-commit pm-utils_1.4.1-6+r2rien1_all//power.d/journal-commit
--- pm-utils_1.4.1-6_all//power.d/journal-commit 2011-02-06 14:22:58.000000000 +0100
+++ pm-utils_1.4.1-6+r2rien1_all//power.d/journal-commit 2011-02-19 21:51:57.000000000 +0100
@@ -43,9 +43,9 @@
while read DEV MOUNT FSTYPE REST;
do
command_exists "handle_${FSTYPE}" || continue
- printf "Setting journal commit time for %s to %d..." \
- "$MOUNT" "$1"
- "handle_${FSTYPE}" $MOUNT $1 && echo Done. || echo Failed.
+ msg=$(printf "Setting journal commit time for %s to %d..." "$MOUNT" "$1")
+ "handle_${FSTYPE}" $MOUNT $1 \
+ && log "$msg...Done." || log "$msg...Failed."
done < /proc/mounts
}
diff -uNr pm-utils_1.4.1-6_all//power.d/laptop-mode pm-utils_1.4.1-6+r2rien1_all//power.d/laptop-mode
--- pm-utils_1.4.1-6_all//power.d/laptop-mode 2011-02-06 14:22:58.000000000 +0100
+++ pm-utils_1.4.1-6+r2rien1_all//power.d/laptop-mode 2011-02-19 21:52:07.000000000 +0100
@@ -68,7 +68,7 @@
else
write_values 0 10 5 500
fi
- echo "Laptop mode disabled."
+ log "Laptop mode disabled."
}
laptop_mode_battery() {
@@ -78,7 +78,7 @@
read_values | savestate laptop_mode_default
write_values "$LAPTOP_MODE" "$LAPTOP_DIRTY_RATIO" \
"$LAPTOP_DIRTY_BG_RATIO" "$LAPTOP_DIRTY_WRITEBACK"
- echo "Laptop mode enabled."
+ log "Laptop mode enabled."
}
case $1 in
diff -uNr pm-utils_1.4.1-6_all//power.d/readahead pm-utils_1.4.1-6+r2rien1_all//power.d/readahead
--- pm-utils_1.4.1-6_all//power.d/readahead 2011-02-06 14:22:58.000000000 +0100
+++ pm-utils_1.4.1-6+r2rien1_all//power.d/readahead 2011-02-19 21:52:15.000000000 +0100
@@ -5,6 +5,8 @@
# more readahead = (hopefully) less hard drive activity.
# less readahead = less trashing the page cache.
+. "${PM_FUNCTIONS}"
+
DRIVE_READAHEAD_AC=${DRIVE_READAHEAD_AC:-256}
DRIVE_READAHEAD_BAT=${DRIVE_READAHEAD_BAT:-3072}
@@ -32,8 +34,9 @@
# 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
- printf "Setting readahead for %s to %d..." "$dev" "$1"
- /sbin/blockdev --setfra $1 "$dev" && echo Done. || echo Failed.
+ msg=$(printf "Setting readahead for %s to %d" "$dev" "$1")
+ /sbin/blockdev --setfra $1 "$dev" \
+ && log "$msg...Done." || log "$msg...Failed."
done
}
diff -uNr pm-utils_1.4.1-6_all//power.d/sata_alpm pm-utils_1.4.1-6+r2rien1_all//power.d/sata_alpm
--- pm-utils_1.4.1-6_all//power.d/sata_alpm 2011-02-06 14:22:58.000000000 +0100
+++ pm-utils_1.4.1-6+r2rien1_all//power.d/sata_alpm 2011-02-19 21:52:23.000000000 +0100
@@ -28,9 +28,9 @@
[ "${kv%-*}" \< "2.6.33" ] && exit $NA # avoid fs corruption
for f in /sys/class/scsi_host/host*; do
[ -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.
+ msg=$(printf "Setting SATA APLM on %s to %s" "${f##*/}" "$1")
+ echo "$1" > "$f/link_power_management_policy" \
+ && log "$msg...Done." || log "$msg...Failed."
done
}
diff -uNr pm-utils_1.4.1-6_all//power.d/sched-powersave pm-utils_1.4.1-6+r2rien1_all//power.d/sched-powersave
--- pm-utils_1.4.1-6_all//power.d/sched-powersave 2011-02-06 14:22:58.000000000 +0100
+++ pm-utils_1.4.1-6+r2rien1_all//power.d/sched-powersave 2011-02-19 18:36:32.000000000 +0100
@@ -6,6 +6,8 @@
# scheduler will minimize the physical packages/cpu cores carrying the
# load and thus conserving power
+. "${PM_FUNCTIONS}"
+
sched_powersave() {
for pool in mc smp smt; do
dev="/sys/devices/system/cpu/sched_${pool}_power_savings"
@@ -16,11 +18,11 @@
case "$1" in
true)
- echo "**sched policy powersave ON"
+ log "**sched policy powersave ON"
sched_powersave 1
;;
false)
- echo "**sched policy powersave OFF"
+ log "**sched policy powersave OFF"
sched_powersave 0
;;
esac
diff -uNr pm-utils_1.4.1-6_all//power.d/wireless pm-utils_1.4.1-6+r2rien1_all//power.d/wireless
--- pm-utils_1.4.1-6_all//power.d/wireless 2011-02-06 14:22:58.000000000 +0100
+++ pm-utils_1.4.1-6+r2rien1_all//power.d/wireless 2011-02-19 21:52:47.000000000 +0100
@@ -56,7 +56,7 @@
for dev in /sys/class/net/*; do
get_wireless_params "${dev##*/}" "$1" || continue
ret=0
- printf "Turning powersave for %s %s..." "${dev##*/}" "$1"
+ msg=$(printf "Turning powersave for %s %s" "${dev##*/}" "$1")
if [ "$have_iwconfig" = true -a "$iwconfig" ]; then
iwconfig "${dev##*/}" $iwconfig || ret=1
fi
@@ -66,7 +66,7 @@
if [ "$iwlevel" ]; then
echo "$iwlevel" > "$dev/device/power_level" || ret=1
fi
- [ "$ret" -eq 0 ] && echo Done. || echo Failed.
+ [ "$ret" -eq 0 ] && log "$msg...Done." || log "$msg...Failed."
done
}
diff -uNr pm-utils_1.4.1-6_all//sleep.d/55NetworkManager pm-utils_1.4.1-6+r2rien1_all//sleep.d/55NetworkManager
--- pm-utils_1.4.1-6_all//sleep.d/55NetworkManager 2011-02-06 14:22:58.000000000 +0100
+++ pm-utils_1.4.1-6+r2rien1_all//sleep.d/55NetworkManager 2011-02-20 02:56:18.000000000 +0100
@@ -11,23 +11,23 @@
suspend_nm()
{
# Tell NetworkManager to shut down networking
- printf "Having NetworkManager put all interaces to sleep..."
+ msg=$(printf "Having NetworkManager put all interaces to sleep")
dbus_send --print-reply --system \
--dest=org.freedesktop.NetworkManager \
/org/freedesktop/NetworkManager \
org.freedesktop.NetworkManager.sleep && \
- echo Done. || echo Failed.
+ log "$msg...Done." || log "$msg...Failed."
}
resume_nm()
{
# Wake up NetworkManager and make it do a new connection
- printf "Having NetworkManager wake interfaces back up..."
+ msg=$(printf "Having NetworkManager wake interfaces back up")
dbus_send --print-reply --system \
--dest=org.freedesktop.NetworkManager \
/org/freedesktop/NetworkManager \
org.freedesktop.NetworkManager.wake && \
- echo Done. || echo Failed.
+ log "$msg...Done." || log "$msg...Failed."
}
case "$1" in
diff -uNr pm-utils_1.4.1-6_all//sleep.d/75modules pm-utils_1.4.1-6+r2rien1_all//sleep.d/75modules
--- pm-utils_1.4.1-6_all//sleep.d/75modules 2011-02-06 14:22:58.000000000 +0100
+++ pm-utils_1.4.1-6+r2rien1_all//sleep.d/75modules 2011-02-20 02:57:17.000000000 +0100
@@ -7,8 +7,8 @@
{
[ -z "$SUSPEND_MODULES" ] && return $NA
for x in $SUSPEND_MODULES ; do
- printf "Unloading kernel module %s..." "$x"
- modunload $x && echo Done. || echo Failed.
+ msg=$(printf "Unloading kernel module %s..." "$x")
+ modunload $x && log "$msg...Done." || log "$msg...Failed."
done
return 0
}
@@ -16,7 +16,7 @@
resume_modules()
{
modreload
- echo "Reloaded unloaded modules."
+ log "Reloaded unloaded modules."
}
case "$1" in
diff -uNr pm-utils_1.4.1-6_all//sleep.d/98video-quirk-db-handler pm-utils_1.4.1-6+r2rien1_all//sleep.d/98video-quirk-db-handler
--- pm-utils_1.4.1-6_all//sleep.d/98video-quirk-db-handler 2011-02-06 14:22:58.000000000 +0100
+++ pm-utils_1.4.1-6+r2rien1_all//sleep.d/98video-quirk-db-handler 2011-02-20 02:59:31.000000000 +0100
@@ -188,7 +188,7 @@
RES=""
local p
if ! p=$(canonicalize_dmivar $1); then
- echo "Unable to obtain DMI information for $1" >&2
+ log "Unable to obtain DMI information for $1" >&2
exit 1
fi
RES="${!p}"
@@ -354,45 +354,45 @@
# Use them without the usual filtering. This may cause the system
# to blow up, but they explicitly asked for it.
remove_parameters --quirk-test
- echo "Quirk testing mode enabled."
+ log "Quirk testing mode enabled."
elif using_kms; then
# Using kernel modesetting? No quirks, and do not change vts.
remove_parameters $possible_video_quirks
add_parameters --quirk-no-chvt
- echo "Kernel modesetting video driver detected, not using quirks."
+ log "Kernel modesetting video driver detected, not using quirks."
elif using_nvidia; then
# Ditto for nVidia binary drivers
remove_parameters $possible_video_quirks
- echo "nVidia binary video drive detected, not using quirks."
+ log "nVidia binary video drive detected, not using quirks."
elif using_fglrx; then
# fglrx may or may not have to change vts, reports one
# way or the other welcome.
remove_parameters $possible_video_quirks
add_parameters --quirk-none
- echo "ATI Catalyst driver detected, not using quirks."
+ log "ATI Catalyst driver detected, not using quirks."
elif have_nvidia_g80; then
# nVidia G80 GPUs require special handling when not using nvidia
# binary drivers. I do not know if noveau requires help or not.
remove_parameters $possible_video_quirks
add_parameters --quirk-vbe-post
- echo "nVidia g80 series card detected."
+ log "nVidia g80 series card detected."
else
# Go ahead and get our quirks.
if has_video_parameters; then
# Parameters from the command line take precedence
# over the database, so do not query it.
- echo "Using quirks passed as parameters."
+ log "Using quirks passed as parameters."
elif [[ $PM_QUIRKS ]]; then
# If we have $PM_QUIRKS. use it instead of the quirk database
add_parameters $PM_QUIRKS
- echo "Using PM_QUIRKS environment variable for quirks."
+ log "Using PM_QUIRKS environment variable for quirks."
# If we were not passed any quirks on the command line,
# get them from the database.
elif QUIRKS=$(find_native "$PM_LKW_QUIRKS"); then
# Known working quirks from our last run are still valid.
# Use them.
add_parameters $QUIRKS
- echo "Using last known working set of quirks."
+ log "Using last known working set of quirks."
else
# Our known working quirks from the last run are either
# nonexistent or invalid. Either way, start over.
@@ -406,9 +406,9 @@
QUIRKS="--quirk-vbe-post --quirk-dpms-on
--quirk-dpms-suspend --quirk-vbestate-restore
--quirk-vbemode-restore --quirk-vga-mode-3"
- echo "No quirk database entry for this system, using default."
+ log "No quirk database entry for this system, using default."
else
- echo "Using quirks for this system from quirk database."
+ log "Using quirks for this system from quirk database."
fi
add_parameters $QUIRKS
savestate video_quirks "$QUIRKS"
@@ -428,7 +428,7 @@
--quirk-radeon-off \
--quirk-no-fb \
--quirk-save-pci
- echo "Cleaning up quirks not needed by Intel video cards."
+ log "Cleaning up quirks not needed by Intel video cards."
fi
fi
;;
@@ -436,7 +436,7 @@
if state_exists video_quirks; then
QUIRKS=$(restorestate video_quirks);
write_last_known_working
- echo "Saving last known working quirks: $QUIRKS"
+ log "Saving last known working quirks: $QUIRKS"
elif has_parameter --store-quirks-as-lkw; then
for x in $(get_parameters); do
for y in $possible_video_quirks; do
@@ -444,7 +444,7 @@
done
done
write_last_known_working
- echo "Saving last known working quirks: $QUIRKS"
+ log "Saving last known working quirks: $QUIRKS"
fi
;;
esac