Bug#452367: [PATCH] Fix pm-is-supported

2008-02-11 Thread Tim Dijkstra
On Mon, 11 Feb 2008 00:41:33 -0500
Matthew William Cox [EMAIL PROTECTED] wrote:

 Hello,
 
 Stumbled across this bug tonight while trying to fix my pbook's hal
 suspend. Pursuant to Michael Biebl's Message #73, I cooked up the
 attached patch (also pasted inline for review):
 
   case $ARG in
  suspend)
  -   grep -q mem /sys/power/state || exit 1
  +   grep -q mem /sys/power/state ||
  +   [ -c /dev/pmu -a -x /usr/sbin/s2ram ] || exit 1
  ;;
  hibernate)
  grep -q disk /sys/power/state || exit 1
 
 This checks that /dev/pmu exists and that we can run s2ram. Now, it
 doesn't check that the PMU actually is willing to suspend the machine,
 to do that, we need to tap the PMU_IOC_CAN_SLEEP ioctl on /dev/pmu. No
 way to do THAT from a shell script, 

 but as far as I know, any machine with a PMU can suspend.

That is not true.

We could use `s2ram --test', that does the PMU_IOC_CAN_SLEEP test.

 Gnome-power-manager is willing and able to suspend my machine now. Yay!

Very good. I hope that there will be an upload for pm-utils soonish...

grts Tim


signature.asc
Description: PGP signature


Bug#452367: [PATCH] Fix pm-is-supported

2008-02-10 Thread Matthew William Cox
Hello,

Stumbled across this bug tonight while trying to fix my pbook's hal
suspend. Pursuant to Michael Biebl's Message #73, I cooked up the
attached patch (also pasted inline for review):

  case $ARG in
   suspend)
 - grep -q mem /sys/power/state || exit 1
 + grep -q mem /sys/power/state ||
 + [ -c /dev/pmu -a -x /usr/sbin/s2ram ] || exit 1
   ;;
   hibernate)
   grep -q disk /sys/power/state || exit 1

This checks that /dev/pmu exists and that we can run s2ram. Now, it
doesn't check that the PMU actually is willing to suspend the machine,
to do that, we need to tap the PMU_IOC_CAN_SLEEP ioctl on /dev/pmu. No
way to do THAT from a shell script, but as far as I know, any machine
with a PMU can suspend.

Gnome-power-manager is willing and able to suspend my machine now. Yay!

Matthew Cox
--- pm-is-supported	2008-01-27 17:21:51.0 -0500
+++ /usr/bin/pm-is-supported	2008-02-11 00:30:06.0 -0500
@@ -29,7 +29,8 @@
 
 case $ARG in
 	suspend)
-		grep -q mem /sys/power/state || exit 1
+		grep -q mem /sys/power/state ||
+			[ -c /dev/pmu -a -x /usr/sbin/s2ram ] || exit 1
 		;;
 	hibernate)
 		grep -q disk /sys/power/state || exit 1


signature.asc
Description: Digital signature