rpms/ohm/OLPC-2 ohm-suspend-with-sysfs.patch, NONE, 1.1 ohm.spec, 1.5, 1.6

Daniel Williams (dcbw) fedora-extras-commits at redhat.com
Mon Jul 16 02:31:55 UTC 2007


Author: dcbw

Update of /cvs/extras/rpms/ohm/OLPC-2
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv8502

Modified Files:
	ohm.spec 
Added Files:
	ohm-suspend-with-sysfs.patch 
Log Message:
* Sun Jul 15 2007 Dan Williams <dcbw at redhat.com> - 0.1.1-5.2.20070713git.olpc2
- Hack: suspend directly with sysfs, don't call out to totally OLPC-inappropriate
  suspend scripts



ohm-suspend-with-sysfs.patch:

--- NEW FILE ohm-suspend-with-sysfs.patch ---
diff --git a/plugins/policy/suspend/ohm-plugin-suspend.c b/plugins/policy/suspend/ohm-plugin-suspend.c
index 1e08298..8441a34 100644
--- a/plugins/policy/suspend/ohm-plugin-suspend.c
+++ b/plugins/policy/suspend/ohm-plugin-suspend.c
@@ -18,8 +18,11 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include <stdio.h>
 #include <gmodule.h>
 #include <glib.h>
+#include <glib/gstdio.h>
+#include <glib/gprintf.h>
 #include <ohm-plugin.h>
 #include <dbus/dbus-glib.h>
 
@@ -38,33 +41,19 @@ enum {
 static gboolean
 system_suspend (OhmPlugin *plugin)
 {
-	DBusGConnection *connection;
-	DBusGProxy *proxy;
-	GError *error;
-	gboolean ret;
-	gint retval;
-
-	connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, NULL);
-
-	/* reuse the connection from HAL */
-	proxy = dbus_g_proxy_new_for_name (connection,
-					   HAL_DBUS_SERVICE,
-					   HAL_ROOT_COMPUTER,
-					   HAL_DBUS_INTERFACE_POWER);
-
-	/* get the brightness from HAL */
-	error = NULL;
-	ret = dbus_g_proxy_call (proxy, "Suspend", &error,
-				 G_TYPE_INT, 0,
-				 G_TYPE_INVALID,
-				 G_TYPE_UINT, &retval,
-				 G_TYPE_INVALID);
-	if (error != NULL) {
-		g_printerr ("Error: %s\n", error->message);
-		g_error_free (error);
-	}
-	g_object_unref (proxy);
-	return ret;
+	FILE *fp;
+
+	fp = g_fopen("/sys/power/state", "w");
+	if (!fp) {
+		g_warning ("Couldn't open /sys/power/state.");
+		return FALSE;
+	}
+
+	if (g_fprintf(fp, "mem\n") < 0)
+		g_warning ("Couldn't write to /sys/power/state.");
+	
+	fclose(fp);
+	return TRUE; 
 }
 
 /**


Index: ohm.spec
===================================================================
RCS file: /cvs/extras/rpms/ohm/OLPC-2/ohm.spec,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ohm.spec	16 Jul 2007 02:08:44 -0000	1.5
+++ ohm.spec	16 Jul 2007 02:31:23 -0000	1.6
@@ -7,10 +7,12 @@
 Summary: Open Hardware Manager
 Name: ohm
 Version: 0.1.1
-Release: 5.1.%{alphatag}%{?dist}
+Release: 5.2.%{alphatag}%{?dist}
 URL: http://www.freedesktop.org/Software/ohm
 Source0: http://people.freedesktop.org/~hughsient/temp/%{name}-%{version}-1.%alphatag.tar.gz
 Patch0: ohm-0.1.1-disable-idle-module.patch
+# Hack; fix HAL suspend scripts instead of doing this
+Patch1: ohm-suspend-with-sysfs.patch
 
 License: LGPL
 Group: System Environment/Libraries
@@ -53,6 +55,7 @@
 %prep
 %setup -q
 %patch0 -p1 -b .disable-idle
+%patch1 -p1 -b .suspend-with-sysfs
 
 %build
 
@@ -122,6 +125,10 @@
 %{_includedir}/*
 
 %changelog
+* Sun Jul 15 2007 Dan Williams <dcbw at redhat.com> - 0.1.1-5.2.20070713git.olpc2
+- Hack: suspend directly with sysfs, don't call out to totally OLPC-inappropriate
+  suspend scripts
+
 * Sun Jul 15 2007 Dan Williams <dcbw at redhat.com> - 0.1.1-5.1.20070713git.olpc2
 - Disable 'idle' extension for now
 




More information about the scm-commits mailing list