on_ac_power never returns 255, so simplify our test functions.
diff -U 0 -rNX diffignore pm-utils.updates/pm/functions working/pm/functions
--- pm-utils.updates/pm/functions	2008-01-27 12:34:28.000000000 -0600
+++ working/pm/functions	2008-01-27 11:26:51.000000000 -0600
@@ -141,15 +136 @@
-	RETVAL=0
-	on_ac_power
-	case "$?" in
-		"0")
-			echo "ac"
-			;;
-		"1")
-			echo "battery"
-			;;
-		"255")
-			echo "error"
-			RETVAL=1
-			;;
-	esac
-	return $RETVAL
+	on_ac_power && echo "ac" || echo "battery"
diff -U 0 -rNX diffignore pm-utils.updates/src/on_ac_power working/src/on_ac_power
--- pm-utils.updates/src/on_ac_power	2008-01-27 11:58:02.000000000 -0600
+++ working/src/on_ac_power	2008-01-17 20:56:18.000000000 -0600
@@ -42,2 +42,2 @@
-	present=$(hal-get-property --udi $device --key ac_adapter.present)
-	[ "$present" == "true" ] && exit 0
+	present=$(hal-get-property --udi "$device" --key ac_adapter.present)
+	[ "x$present" = "xtrue" ] && exit 0
_______________________________________________
Pm-utils mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/pm-utils

Reply via email to