On Mo, 28 Dez 2009, Josselin Mouette wrote:
> > - suspending with lid-close goes into infinite loop
> > - suspending with "click-power-icon", select "suspend" *works*
> 
> Is uswsusp installed? If so, does removing it help?

Removing uswsusp did help indeed.


BTW, I was exploring also some other options and found attached
patch in the suse packages. It seems to deal with very similar
things as clearing duplicate suspend events. Since it is for
2.28.0 I am not sure if it is necessary, but you might take a look
at it. Before removing uswsusp I built a package of g-p-m with 
that patch added to the quilt queue and it helped a bit (only one
rogue suspend) but OTOH added something strange, namely that switching
to the console and back initiated a suspend ...  Anyway, the bug report is
https://bugzilla.novell.com/show_bug.cgi?id=540517
I have the same warnings 
devkit-power-gobject-DEBUG: DBUS timed out, but recovering


So I am not sure how uswsusp is playing into that piece, but at least
once it worked.

Best wishes

Norbert

------------------------------------------------------------------------
Norbert Preining            prein...@{jaist.ac.jp, logic.at, debian.org}
JAIST, Japan            TU Wien, Austria           Debian TeX Task Force
DSA: 0x09C5B094   fp: 14DF 2E6C 0307 BE6D AD76  A9C0 D2BF 4AA3 09C5 B094
------------------------------------------------------------------------
`Time is an illusion. Lunchtime doubly so.'
you should send that in to the
"Reader's Digest". They've got a page for people like you.'
                 --- Ford convincing Arthur to drink three pints in ten
                 --- minutes at lunchtime.
                 --- Douglas Adams, The Hitchhikers Guide to the Galaxy
Index: gnome-power-manager-2.28.0/src/egg-console-kit.c
===================================================================
--- gnome-power-manager-2.28.0.orig/src/egg-console-kit.c
+++ gnome-power-manager-2.28.0/src/egg-console-kit.c
@@ -50,6 +50,9 @@ struct EggConsoleKitPrivate
 	DBusGProxy		*proxy_manager;
 	DBusGProxy		*proxy_session;
 	gchar			*session_id;
+	guint			 emit_changed_id;
+	gboolean		 last_emitted_active;
+	gboolean		 last_changed_active;
 };
 
 enum {
@@ -231,13 +234,37 @@ out:
 }
 
 /**
+ * egg_console_kit_emit_active_changed_cb:
+ **/
+static gboolean
+egg_console_kit_emit_active_changed_cb (EggConsoleKit *console)
+{
+	egg_debug ("emitting active: %i", console->priv->last_changed_active);
+	g_signal_emit (console, signals [EGG_CONSOLE_KIT_ACTIVE_CHANGED], 0, console->priv->last_changed_active);
+	console->priv->last_emitted_active = console->priv->last_changed_active;
+	console->priv->emit_changed_id = 0;
+	return FALSE;
+}
+
+/**
  * egg_console_kit_active_changed_cb:
  **/
 static void
 egg_console_kit_active_changed_cb (DBusGProxy *proxy, gboolean active, EggConsoleKit *console)
 {
-	egg_debug ("emitting active: %i", active);
-	g_signal_emit (console, signals [EGG_CONSOLE_KIT_ACTIVE_CHANGED], 0, active);
+	if (console->priv->emit_changed_id != 0) {
+		g_source_remove (console->priv->emit_changed_id);
+		console->priv->emit_changed_id = 0;
+	}
+
+	if (console->priv->last_emitted_active == active) {
+		egg_debug ("ignoring active (same value as last emitted): %i", active);
+		return;
+	}
+
+	egg_debug ("queuing active: %i", active);
+	console->priv->last_changed_active = active;
+	console->priv->emit_changed_id = g_idle_add ((GSourceFunc) egg_console_kit_emit_active_changed_cb, console);
 }
 
 /**
@@ -271,6 +298,8 @@ egg_console_kit_init (EggConsoleKit *con
 	console->priv = EGG_CONSOLE_KIT_GET_PRIVATE (console);
 	console->priv->proxy_manager = NULL;
 	console->priv->session_id = NULL;
+	console->priv->emit_changed_id = 0;
+	console->priv->last_changed_active = FALSE;
 
 	/* connect to D-Bus */
 	console->priv->connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
@@ -315,6 +344,8 @@ egg_console_kit_init (EggConsoleKit *con
 	dbus_g_proxy_connect_signal (console->priv->proxy_session, "ActiveChanged",
 				     G_CALLBACK (egg_console_kit_active_changed_cb), console, NULL);
 
+	console->priv->last_emitted_active = egg_console_kit_is_active (console);
+
 out:
 	return;
 }
@@ -338,6 +369,8 @@ egg_console_kit_finalize (GObject *objec
 	if (console->priv->proxy_session != NULL)
 		g_object_unref (console->priv->proxy_session);
 	g_free (console->priv->session_id);
+	if (console->priv->emit_changed_id != 0)
+		g_source_remove (console->priv->emit_changed_id);
 
 	G_OBJECT_CLASS (egg_console_kit_parent_class)->finalize (object);
 }

Reply via email to