podsleuth r61 - in trunk: . src/PodSleuth.Hal/Hal



Author: gburt
Date: Wed Sep  3 14:38:54 2008
New Revision: 61
URL: http://svn.gnome.org/viewvc/podsleuth?rev=61&view=rev

Log:
2008-09-02  Gabriel Burt  <gburt novell com>

	* src/PodSleuth.Hal/Hal/Device.cs: When a device is plugged in during
	bootup and the HAL callout is called, the HAL DBus service isn't yet
	available.  Sleep in 1s increments up to 10s for the service to be
	available before failing (BGO #488209).



Modified:
   trunk/ChangeLog
   trunk/src/PodSleuth.Hal/Hal/Device.cs

Modified: trunk/src/PodSleuth.Hal/Hal/Device.cs
==============================================================================
--- trunk/src/PodSleuth.Hal/Hal/Device.cs	(original)
+++ trunk/src/PodSleuth.Hal/Hal/Device.cs	Wed Sep  3 14:38:54 2008
@@ -276,6 +276,14 @@
         
         public T CastDevice<T>()
         {
+            // Sleep for up to 10 seconds waiting for the DBus service to start
+            // Fixes a bug where the HAL callout would call into this code on bootup with
+            // a device plugged in, but the DBus service isn't yet available.
+            int tries = 0;
+            while(!Bus.System.NameHasOwner("org.freedesktop.Hal") && tries++ < 10) {
+                System.Threading.Thread.Sleep (1000);
+            }
+
             if(!Bus.System.NameHasOwner("org.freedesktop.Hal")) {
                 throw new ApplicationException("Could not find org.freedesktop.Hal");
             }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]