[PATCH 2/2] UBUNTU: suspend-resume -- update test-susped to version 3
Andy Whitcroft
apw at canonical.com
Mon Jan 19 14:46:53 UTC 2009
It turns out that pms has been deprecated in Jaunty, and only appears on
systems which have been upgraded, so switch to directly sending the
suspend dbus trigger in the same manner as sent by fast-user-switcher.
Also take more care when updating the real time clock. Using
--isadirect prevents it from working on some hardware and also may lead
to corrupt or stalled clocks.
Fix a minor typo in unused code.
Changelog:
- fix typo in fallback acpi interface
- when recording the RTC clock do not go direct
- pmi is now deprecated suspend using dbus
Signed-off-by: Andy Whitcroft <apw at canonical.com>
---
scripts/test-suspend | 22 ++++++++++++++++++----
1 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/scripts/test-suspend b/scripts/test-suspend
index 7e138c0..e897002 100755
--- a/scripts/test-suspend
+++ b/scripts/test-suspend
@@ -28,6 +28,11 @@
#
# Changelog:
#
+# V3:
+# - fix typo in fallback acpi interface
+# - when recording the RTC clock do not go direct
+# - pmi is now deprecated suspend using dbus
+#
# V2:
# - support newer rtc sysfs wakealarm interface
# - move to using pmi action suspend
@@ -72,7 +77,7 @@ setup_wakeup_timer ()
echo "$time" >"$ctl"
return 0
fi
- ctl='/proc/acpu/alarm'
+ ctl='/proc/acpi/alarm'
if [ -f "$ctl" ]; then
echo `date '+%F %H:%M:%S' -d '+ '$timeout' seconds'` >"$ctl"
return 0
@@ -85,12 +90,21 @@ setup_wakeup_timer ()
suspend_system ()
{
- hwclock --directisa --localtime --systohc
-
+ # Ensure the clock is safely recorded.
+ hwclock --systohc
setup_wakeup_timer "$timer_sleep"
- pmi action suspend >/dev/null
+ # Send a dbus message to initiate Suspend.
+ dbus-send --session --type=method_call \
+ --dest=org.freedesktop.PowerManagement \
+ /org/freedesktop/PowerManagement \
+ org.freedesktop.PowerManagement.Suspend || \
+ {
+ ECHO "unable to suspend the system"
+ exit 1
+ }
+
#
# wait for $timer_delay seconds after system resume from S3
--
1.6.1.258.g7ff14
More information about the kernel-team
mailing list