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.000000000 -0500
+++ /usr/bin/pm-is-supported	2008-02-11 00:30:06.000000000 -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

Attachment: signature.asc
Description: Digital signature

Reply via email to