hal/hald/linux2 osspec.c,1.36,1.37

Richard Hughes hughsient at freedesktop.org
Mon Dec 5 11:45:36 PST 2005


Update of /cvs/hal/hal/hald/linux2
In directory gabe:/tmp/cvs-serv11435/hald/linux2

Modified Files:
	osspec.c 
Log Message:
Detect "Software Suspend 2" and set power_management.can_hibernate if found.

Index: osspec.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/osspec.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- osspec.c	2 Dec 2005 17:06:53 -0000	1.36
+++ osspec.c	5 Dec 2005 19:45:34 -0000	1.37
@@ -672,6 +672,8 @@
 
 	can_suspend = FALSE;
 	can_hibernate = FALSE;
+
+	/* try to find 'mem' and 'disk' in /sys/power/state */
 	fp = fopen ("/sys/power/state", "r");
 	if (fp == NULL) {
 		HAL_WARNING (("Could not open /sys/power/state"));
@@ -690,6 +692,12 @@
 	if (strstr (poweroptions, "disk"))
 		can_hibernate = TRUE;
 	free (poweroptions);
+
+	/* check for the presence of suspend2 */
+	if (access ("/proc/software_suspend", F_OK) == 0)
+		can_hibernate = TRUE;
+	if (access ("/proc/suspend2", F_OK) == 0)
+		can_hibernate = TRUE;
 out:
 	hal_device_property_set_bool (d, "power_management.can_suspend_to_ram", can_suspend);
 	hal_device_property_set_bool (d, "power_management.can_suspend_to_disk", can_hibernate);




More information about the hal-commit mailing list