[Pommed-commits] r527 - in trunk: . pommed

jblache at alioth.debian.org jblache at alioth.debian.org
Thu Dec 11 14:56:35 UTC 2008


Author: jblache
Date: 2008-12-11 14:56:35 +0000 (Thu, 11 Dec 2008)
New Revision: 527

Modified:
   trunk/ChangeLog
   trunk/pommed.init
   trunk/pommed/dbus.c
Log:
Try to reconnect to DBus if it's not available at startup, instead of dropping it.


Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2008-12-11 14:39:59 UTC (rev 526)
+++ trunk/ChangeLog	2008-12-11 14:56:35 UTC (rev 527)
@@ -6,6 +6,8 @@
 	- pommed: default to sysfs backlight driver for nVidia machines,
 	with the mbp_nvidia_bl kernel driver; fall back to native
 	nv8600mgt if not supported.
+	- pommed: try to reconnect to DBus if DBus is not available at
+	startup. Previously we would just drop it and live without DBus.
 
 version 1.22:
 	- pommed: do not probe for LMU controller on pmac machines that do

Modified: trunk/pommed/dbus.c
===================================================================
--- trunk/pommed/dbus.c	2008-12-11 14:39:59 UTC (rev 526)
+++ trunk/pommed/dbus.c	2008-12-11 14:56:35 UTC (rev 527)
@@ -1075,7 +1075,7 @@
 
       conn = NULL;
 
-      return -1;
+      goto init_reconnect;
     }
 
   dbus_connection_set_exit_on_disconnect(conn, FALSE);
@@ -1088,7 +1088,7 @@
 
       mbpdbus_cleanup();
 
-      return -1;
+      goto init_reconnect;
     }
 
   if (ret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER)
@@ -1097,7 +1097,7 @@
 
       mbpdbus_cleanup();
 
-      return -1;
+      goto init_reconnect;
     }
 
   ret = dbus_connection_set_watch_functions(conn, mbpdbus_add_watch, mbpdbus_remove_watch,
@@ -1106,12 +1106,26 @@
     {
       mbpdbus_cleanup();
 
-      return -1;
+      goto init_reconnect;
     }
 
   dbus_connection_add_filter(conn, mbpdbus_process_requests, NULL, NULL);
 
   return 0;
+
+ init_reconnect:
+  if (dbus_timer > 0) /* Trying to reconnect already, called from mbpdbus_reconnect() */
+      return -1;
+
+  dbus_timer = evloop_add_timer(DBUS_TIMEOUT, mbpdbus_reconnect);
+  if (dbus_timer < 0)
+    {
+      logmsg(LOG_ERR, "Could not set up timer for DBus reconnection");
+
+      return -1;
+    }
+
+  return 0;
 }
 
 void

Modified: trunk/pommed.init
===================================================================
--- trunk/pommed.init	2008-12-11 14:39:59 UTC (rev 526)
+++ trunk/pommed.init	2008-12-11 14:56:35 UTC (rev 527)
@@ -6,7 +6,7 @@
 # Provides:          pommed
 # Required-Start:    $syslog $local_fs
 # Required-Stop:     $syslog $local_fs
-# Should-Start:      
+# Should-Start:      dbus
 # Should-Stop:       
 # Default-Start:     2 3 4 5
 # Default-Stop:      0 1 6




More information about the Pommed-commits mailing list