2008/3/16, Victor Lowther <[EMAIL PROTECTED]>:
> On Sun, 2008-03-16 at 19:04 +0100, Michael Biebl wrote:
>  > Hi,
>  >
>  > I improved the pmu support a bit (for uswsusp/kernel)
>  >
>  > - If /dev/pmu is existent, assume we can suspend
>  > - Don't try to run pm-pmu for non-pmu machines. The majority of
>  > machines nowadays doesn't have a pmu, so always running pm-pmu for
>  > them is just wasting cpu cycles.
>
>
> Patch?

Argh, missed it. Attached now.

I haven't changed do_suspend for uswsusp, as my uswsusp patch will use
s2ram (which deals with pmu machines transparently).

Cheers,
Michael
-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?
From fe612997f9809777864ce859ad5ad47a02fb6dcb Mon Sep 17 00:00:00 2001
From: Michael Biebl <[EMAIL PROTECTED]>
Date: Sun, 16 Mar 2008 19:01:59 +0100
Subject: [PATCH] Better PMU support.

- If /dev/pmu is existent, assume we can suspend
- Don't try to run pm-pmu on machines without a PMU
---
 pm/module.d/kernel   |    9 +++++++--
 pm/module.d/tuxonice |    9 +++++++--
 pm/module.d/uswsusp  |    3 ++-
 3 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/pm/module.d/kernel b/pm/module.d/kernel
index 5b3b501..21a5046 100644
--- a/pm/module.d/kernel
+++ b/pm/module.d/kernel
@@ -1,11 +1,16 @@
 check_suspend()
 {
-	grep -q mem /sys/power/state
+	[ -e /dev/pmu ] && return 0
+	grep -q mem /sys/power/state && return 0
 }
 
 do_suspend()
 {
-	pm-pmu --suspend || echo -n "mem" > /sys/power/state
+	if [ -e /dev/pmu ]; then
+		pm-pmu --suspend
+	else
+		echo -n "mem" > /sys/power/state
+	fi
 }
 
 check_hibernate()
diff --git a/pm/module.d/tuxonice b/pm/module.d/tuxonice
index 79c50ac..d150126 100644
--- a/pm/module.d/tuxonice
+++ b/pm/module.d/tuxonice
@@ -11,12 +11,17 @@ done
 
 check_suspend()
 {
-	grep -q mem /sys/power/state
+	[ -e /dev/pmu ] && return 0
+	grep -q mem /sys/power/state && return 0
 }
 
 do_suspend()
 {
-	echo "mem" >/sys/power/state
+	if [ -e /dev/pmu ]; then
+		pm-pmu --suspend
+	else
+		echo -n "mem" > /sys/power/state
+	fi
 }
 
 check_hibernate()
diff --git a/pm/module.d/uswsusp b/pm/module.d/uswsusp
index c7f8e70..c16cf1b 100644
--- a/pm/module.d/uswsusp
+++ b/pm/module.d/uswsusp
@@ -6,7 +6,8 @@ before_hooks()
 
 check_suspend()
 {
-	grep -q mem /sys/power/state
+	[ -e /dev/pmu ] && return 0
+	grep -q mem /sys/power/state && return 0
 }
 
 do_suspend()
-- 
1.5.4.4

_______________________________________________
Pm-utils mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/pm-utils

Reply via email to