[PATCH] trigger pm-utils for hibernate, suspend and SetPowerSave on SUSE

Holger Macht hmacht at suse.de
Tue Jan 30 01:12:14 PST 2007


Powersaved doesn't provide sleep infrastructure anymore. Redesign
tool place to shift all actions to the common pm-utils project. So
remove execution of powersaved scripts for hibernate, suspend and
the SetPowerSave method and use pm-utils's counterparts instead.

I'll commit this tomorrow if nobody objects.

Signed-off-by: Holger Macht <holger at homac.de>
---

diff --git a/tools/linux/hal-system-power-hibernate-linux b/tools/linux/hal-system-power-hibernate-linux
index 91da280..632acb6 100755
--- a/tools/linux/hal-system-power-hibernate-linux
+++ b/tools/linux/hal-system-power-hibernate-linux
@@ -10,8 +10,8 @@ unsupported() {
 	exit 1
 }
 
-#SuSE and ALTLinux only support powersave
-if [ -f /etc/altlinux-release ] || [ -f "/etc/SuSE-release" ] ; then
+#ALTLinux only supports powersave
+if [ -f /etc/altlinux-release ] ; then
 	if [ -x /usr/bin/powersave ] ; then
 	        $POWERSAVED_SUSPEND2DISK
 		RET=$?
@@ -28,8 +28,9 @@ elif [ -f /etc/mandriva-release ] ; then
 	unsupported 
     fi 
 
-#RedHat/Fedora only support pm-utils
-elif [ -f /etc/redhat-release ] || [ -f /etc/fedora-release ] ; then
+#RedHat/Fedora and SUSE support support pm-utils
+elif [ -f /etc/redhat-release ] || [ -f /etc/fedora-release ] \
+		 || [ -f "/etc/SuSE-release" ] ; then
 	if [ -x /usr/sbin/pm-hibernate ] ; then
 		/usr/sbin/pm-hibernate
 		RET=$?
diff --git a/tools/linux/hal-system-power-set-power-save-linux b/tools/linux/hal-system-power-set-power-save-linux
index 6a29344..c0a78b9 100755
--- a/tools/linux/hal-system-power-set-power-save-linux
+++ b/tools/linux/hal-system-power-set-power-save-linux
@@ -8,8 +8,8 @@ unsupported() {
 	exit 1
 }
 
-#SuSE and ALTLinux only support powersave
-if [ -f /etc/altlinux-release ] || [ -f /etc/SuSE-release ] ; then
+#ALTLinux only supports powersave
+if [ -f /etc/altlinux-release ] ; then
 	if [ -x "/usr/bin/powersave" ] ; then
 		if [ $value = "true" ]; then
 			/usr/bin/powersave -e Powersave
@@ -22,8 +22,9 @@ if [ -f /etc/altlinux-release ] || [ -f
 		unsupported
 	fi
 
-#RedHat/Fedora only support pm-utils
-elif [ -f /etc/redhat-release ] || [ -f /etc/fedora-release ] ; then
+#RedHat/Fedora and SUSE support pm-utils
+elif [ -f /etc/redhat-release ] || [ -f /etc/fedora-release ] \
+		|| [ -f /etc/SuSE-release ] ; then
 	if [ -x "/usr/sbin/pm-powersave" ] ; then
 		if [ $value = "true" ]; then
 			/usr/sbin/pm-powersave true
diff --git a/tools/linux/hal-system-power-suspend-linux b/tools/linux/hal-system-power-suspend-linux
index 590e1c7..180d4a1 100755
--- a/tools/linux/hal-system-power-suspend-linux
+++ b/tools/linux/hal-system-power-suspend-linux
@@ -28,8 +28,8 @@ if [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METH
 	exit 0
 fi
 
-#SuSE and ALTLinux only support powersave
-if [ -f "/etc/altlinux-release" ] || [ -f "/etc/SuSE-release" ] ; then
+#ALTLinux only supports powersave
+if [ -f "/etc/altlinux-release" ]; then
 	if [ -x /usr/bin/powersave ] ; then
 	        $POWERSAVED_SUSPEND2RAM
 		RET=$?
@@ -53,8 +53,9 @@ elif [ -f "/etc/mandriva-release" ] ; th
 	unsupported 
     fi 
 
-#RedHat/Fedora only support pm-utils
-elif [ -f "/etc/redhat-release" ] || [ -f "/etc/fedora-release" ] ; then
+#RedHat/Fedora and SUSE support pm-utils
+elif [ -f "/etc/redhat-release" ] || [ -f "/etc/fedora-release" ] \
+		|| [ -f "/etc/SuSE-release" ] ; then
 	# TODO: fix pm-suspend to take a --wakeup-alarm argument
 	if [ $seconds_to_sleep != "0" ] ; then
 		alarm_not_supported


More information about the hal mailing list