Hi all,

FYI, this is the patch I applied to Ubuntu's pm-utils to get back
suspend on powerpc.

NB that it is not 100% correct, since the mere existance of /dev/pmu
does not theoretically *guarantee* that the machine can suspend. For
that we'd need to port the PMU_IOC_CAN_SLEEP ioctl [1].

But IMHO this is a much smaller evil than the current situation.

Martin

[1] 
http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=10;filename=pmi.pbb;att=1;bug=452367


-- 
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)
diff -u pm-utils-0.99.2/debian/patches/70-remove-pm-pmu.patch 
pm-utils-0.99.2/debian/patches/70-remove-pm-pmu.patch
--- pm-utils-0.99.2/debian/patches/70-remove-pm-pmu.patch
+++ pm-utils-0.99.2/debian/patches/70-remove-pm-pmu.patch
@@ -1,11 +1,12 @@
---- pm/functions       2007-03-26 21:54:19.000000000 +0200
-+++ pm/functions       2007-03-26 21:56:34.000000000 +0200
-@@ -145,7 +145,7 @@
-       if [ -x /usr/sbin/s2ram ]; then
-               /usr/sbin/s2ram $S2RAM_OPTS
+diff -Nur -x '*.orig' -x '*~' pm-utils-0.99.2/pm/functions 
pm-utils-0.99.2.new/pm/functions
+--- pm-utils-0.99.2/pm/functions       2008-03-27 14:49:58.000000000 +0100
++++ pm-utils-0.99.2.new/pm/functions   2008-03-27 14:50:49.000000000 +0100
+@@ -154,7 +154,7 @@
+                       echo "This machine is unkown, please try to find out 
how to suspend this machine. See s2ram(8)."
+               fi
        else
 -              pm-pmu --suspend || echo -n "mem" > /sys/power/state
-+              echo -n "mem" > /sys/power/state
++              /usr/lib/hal/hal-system-power-pmu sleep || echo -n "mem" > 
/sys/power/state
        fi
  }
  
diff -u pm-utils-0.99.2/debian/changelog pm-utils-0.99.2/debian/changelog
--- pm-utils-0.99.2/debian/changelog
+++ pm-utils-0.99.2/debian/changelog
@@ -1,3 +1,13 @@
+pm-utils (0.99.2-3ubuntu6) hardy; urgency=low
+
+  * Add debian/patches/97_fix_ppc_suspend_test.patch: Fix suspend test on
+    PowerPC, thanks to Matthew Garrett (see patch header for details).
+  * debian/patches/70-remove-pm-pmu.patch: Change the patch to not entirely
+    drop pm-pmu, but use hal-system-power-pmu instead. This brings back
+    suspend to PowerPC. (LP: #189851)
+
+ -- Martin Pitt <[EMAIL PROTECTED]>  Thu, 27 Mar 2008 14:51:05 +0100
+
 pm-utils (0.99.2-3ubuntu5) hardy; urgency=low
 
   * Fix typo in 95-fix-config-file-parsing.patch which made loading
only in patch2:
unchanged:
--- pm-utils-0.99.2.orig/debian/patches/97_fix_ppc_suspend_test.patch
+++ pm-utils-0.99.2/debian/patches/97_fix_ppc_suspend_test.patch
@@ -0,0 +1,16 @@
+# Description: on PPC (with PMU), /sys/power/state does not contain
+#   'mem', suspend to ram needs an ioctl. Thus, do not claim that
+#   suspend is not supported.
+# Ubuntu: https://launchpad.net/bugs/189851
+# Debian: http://bugs.debian.org/452367
+--- pm-utils-0.99.2/src/pm-is-supported        2008-03-27 12:42:26.000000000 
+0000
++++ pm-utils-0.99.2.new/src/pm-is-supported    2008-03-27 12:42:45.000000000 
+0000
+@@ -29,7 +29,7 @@
+ 
+ case "$ARG" in
+       suspend)
+-              grep -q mem /sys/power/state || exit 1
++              grep -q mem /sys/power/state || [ -c /dev/pmu ] || exit 1
+               ;;
+       hibernate)
+               grep -q disk /sys/power/state || exit 1

Reply via email to