hal/hald/linux osspec.c,1.50,1.51

David Zeuthen david at freedesktop.org
Mon Oct 25 08:35:51 PDT 2004


Update of /cvs/hal/hal/hald/linux
In directory gabe:/tmp/cvs-serv20297/hald/linux

Modified Files:
	osspec.c 
Log Message:
2004-10-25  David Zeuthen  <david at fubar.dk>

	* hald/linux/osspec.c (hotplug_timeout_handler): Fixup timeout handling
	to rebasing to lowest seqnum in queue instead of just taking the
	next one



Index: osspec.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/osspec.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -d -r1.50 -r1.51
--- osspec.c	19 Oct 2004 22:58:03 -0000	1.50
+++ osspec.c	25 Oct 2004 15:35:49 -0000	1.51
@@ -1468,6 +1468,8 @@
 hotplug_timeout_handler (void)
 {
 	time_t now;
+	GList *i;
+	struct hald_helper_msg *msg;
 
 	now = time (NULL);
 
@@ -1477,12 +1479,27 @@
 		if (now - last_hotplug_time_stamp > HOTPLUG_TIMEOUT) {
 			/* And if anything is actually waiting to be processed */
 			if (hotplug_queue != NULL) {
-				/* also log this to syslog */
-				syslog (LOG_ERR, "Timed out waiting for hotplug event %lld", last_hotplug_seqnum + 1);
-				HAL_ERROR (("Timed out waiting for hotplug event %lld", last_hotplug_seqnum + 1));
-				
-				/* Go to next seqnum and try again */
-				last_hotplug_seqnum++;
+				unsigned long long new_min_seqnum;
+
+				/* Select the lowest seqnum in the queue and reset last_hotplug_time_stamp to 0 */
+				new_min_seqnum = G_MAXUINT64;
+				for (i = hotplug_queue; i != NULL; i = g_list_next (i)) {
+					/* this will run since hotplug_queue != NULL */
+					msg = i->data;
+					HAL_INFO (("Looking at %lld", msg->seqnum));
+					if (msg->seqnum < new_min_seqnum)
+						new_min_seqnum = msg->seqnum;
+				}
+				syslog (LOG_ERR, "Timed out waiting for hotplug event %lld. Rebasing to %lld", 
+					last_hotplug_seqnum + 1, new_min_seqnum);
+				HAL_ERROR (("Timed out waiting for hotplug event %lld. Rebasing to %lld", 
+					    last_hotplug_seqnum + 1, new_min_seqnum));
+				last_hotplug_seqnum = new_min_seqnum - 1;
+				last_hotplug_time_stamp = 0;
+
+
+
+				/* process that event now */
 				hald_helper_hotplug_process_queue ();
 			}
 		}




More information about the hal-commit mailing list