Merge lp:~hzliu123/ubuntu/precise/pm-utils/fix-for-1172692 into lp:ubuntu/precise/pm-utils

Proposed by Hao-Ran Liu
Status: Merged
Merge reported by: Martin Pitt
Merged at revision: not available
Proposed branch: lp:~hzliu123/ubuntu/precise/pm-utils/fix-for-1172692
Merge into: lp:ubuntu/precise/pm-utils
Diff against target: 100 lines (+66/-0)
4 files modified
debian/changelog (+6/-0)
debian/patches/28-suspend-hybrid.patch (+39/-0)
debian/patches/series (+1/-0)
pm/pm-functions.in (+20/-0)
To merge this branch: bzr merge lp:~hzliu123/ubuntu/precise/pm-utils/fix-for-1172692
Reviewer Review Type Date Requested Status
Martin Pitt Approve
Review via email: mp+193738@code.launchpad.net

Description of the change

In-kernel suspend to both ram and disk has been supported since kernel 3.6.
This patch add the support and has been verified and works correctly on
Ubuntu trusty and precise with 3.11 kernel.

In order to support hybrid suspend in 12.04.4, Canonical OEM projects would
like this patch upstreamed.

To post a comment you must log in.
Revision history for this message
Martin Pitt (pitti) wrote :

Thanks! I cannot formally merge that as the precise-proposed branch doesn't exist yet. But I uploaded the package to the SRU review queue, thus closing manually.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2012-01-16 15:55:45 +0000
3+++ debian/changelog 2013-11-04 08:32:10 +0000
4@@ -1,3 +1,9 @@
5+pm-utils (1.4.1-9ubuntu1) precise; urgency=low
6+
7+ * Add support for in-kernel suspend to both (LP: #1172692)
8+
9+ -- Hao-Ran Liu (Joseph Liu) <hao-ran.liu@canonical.com> Mon, 04 Nov 2013 15:39:45 +0800
10+
11 pm-utils (1.4.1-9) unstable; urgency=low
12
13 * Add 26-inhibit-on-right-status.patch: Do not use the exit status of log
14
15=== added file 'debian/patches/28-suspend-hybrid.patch'
16--- debian/patches/28-suspend-hybrid.patch 1970-01-01 00:00:00 +0000
17+++ debian/patches/28-suspend-hybrid.patch 2013-11-04 08:32:10 +0000
18@@ -0,0 +1,39 @@
19+Description: Add support for in-kernel suspend to both
20+Author: Bojan Smojver <bojan@rexursive.com>
21+Author: Jaroslav Škarvada <jskarvad@redhat.com>
22+Bug: https://bugs.freedesktop.org/show_bug.cgi?id=52572
23+Bug-Ubuntu: https://launchpad.net/bugs/1172692
24+
25+Index: pm-utils/pm/pm-functions.in
26+===================================================================
27+--- pm-utils.orig/pm/pm-functions.in 2013-11-01 17:03:17.371325000 +0800
28++++ pm-utils/pm/pm-functions.in 2013-11-01 17:59:36.803067865 +0800
29+@@ -336,8 +336,28 @@
30+ {
31+ [ -n "${HIBERNATE_MODE}" ] && \
32+ grep -qw "${HIBERNATE_MODE}" /sys/power/disk && \
33++ HIBERNATE_MODE_SAVE=$(cat /sys/power/disk) && \
34++ HIBERNATE_MODE_SAVE="${HIBERNATE_MODE_SAVE##*[}" && \
35++ HIBERNATE_MODE_SAVE="${HIBERNATE_MODE_SAVE%%]*}" && \
36+ echo -n "${HIBERNATE_MODE}" > /sys/power/disk
37+ echo -n "disk" > /sys/power/state
38++ RET=$?
39++ echo -n "$HIBERNATE_MODE_SAVE" > /sys/power/disk
40++ return "$RET"
41++ }
42++fi
43++
44++# for kernels that support suspend to both (i.e. hybrid suspend)
45++# since kernel 3.6
46++if [ -z "$SUSPEND_HYBRID_MODULE" ] && \
47++ [ -f /sys/power/disk ] && \
48++ grep -q disk /sys/power/state && \
49++ grep -q suspend /sys/power/disk; then
50++ SUSPEND_HYBRID_MODULE="kernel"
51++ do_suspend_hybrid()
52++ {
53++ HIBERNATE_MODE="suspend"
54++ do_hibernate
55+ }
56+ fi
57+
58
59=== modified file 'debian/patches/series'
60--- debian/patches/series 2012-01-16 15:55:45 +0000
61+++ debian/patches/series 2013-11-04 08:32:10 +0000
62@@ -9,5 +9,6 @@
63 14-disable-sata-alpm.patch
64 25-pmu.patch
65 26-inhibit-on-right-status.patch
66+28-suspend-hybrid.patch
67 80-service.patch
68 90-nm-proper-wakeup.patch
69
70=== modified file 'pm/pm-functions.in'
71--- pm/pm-functions.in 2011-07-08 15:02:58 +0000
72+++ pm/pm-functions.in 2013-11-04 08:32:10 +0000
73@@ -336,8 +336,28 @@
74 {
75 [ -n "${HIBERNATE_MODE}" ] && \
76 grep -qw "${HIBERNATE_MODE}" /sys/power/disk && \
77+ HIBERNATE_MODE_SAVE=$(cat /sys/power/disk) && \
78+ HIBERNATE_MODE_SAVE="${HIBERNATE_MODE_SAVE##*[}" && \
79+ HIBERNATE_MODE_SAVE="${HIBERNATE_MODE_SAVE%%]*}" && \
80 echo -n "${HIBERNATE_MODE}" > /sys/power/disk
81 echo -n "disk" > /sys/power/state
82+ RET=$?
83+ echo -n "$HIBERNATE_MODE_SAVE" > /sys/power/disk
84+ return "$RET"
85+ }
86+fi
87+
88+# for kernels that support suspend to both (i.e. hybrid suspend)
89+# since kernel 3.6
90+if [ -z "$SUSPEND_HYBRID_MODULE" ] && \
91+ [ -f /sys/power/disk ] && \
92+ grep -q disk /sys/power/state && \
93+ grep -q suspend /sys/power/disk; then
94+ SUSPEND_HYBRID_MODULE="kernel"
95+ do_suspend_hybrid()
96+ {
97+ HIBERNATE_MODE="suspend"
98+ do_hibernate
99 }
100 fi
101

Subscribers

People subscribed via source and target branches

to all changes: