hal/tools/linux hal_hotplug.c,1.17,1.18

David Zeuthen david at freedesktop.org
Sat Aug 28 09:22:07 PDT 2004


Update of /cvs/hal/hal/tools/linux
In directory gabe:/tmp/cvs-serv31034/tools/linux

Modified Files:
	hal_hotplug.c 
Log Message:
2004-08-28  David Zeuthen  <david at fubar.dk>

	* tools/linux/hal_hotplug.c: Add some more files to wait for
	(wait_for_sysfs_info): Only wait 10 secs (should be enough; we're
	waiting for the kernel)



Index: hal_hotplug.c
===================================================================
RCS file: /cvs/hal/hal/tools/linux/hal_hotplug.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- hal_hotplug.c	22 Aug 2004 19:27:23 -0000	1.17
+++ hal_hotplug.c	28 Aug 2004 16:22:05 -0000	1.18
@@ -112,11 +112,16 @@
 	NULL
 };
 
-static const char *file_list_scsi_device[] = { NULL };
+static const char *file_list_scsi[] = { "vendor",
+					"model",
+					"type",
+					NULL };
 
-static const char *file_list_scsi_generic[] = { NULL };
+static const char *file_list_scsi_generic[] = { "device", 
+						NULL };
 
-static const char *file_list_scsi_host[] = { NULL };
+static const char *file_list_scsi_host[] = { "device",
+					     NULL };
 
 static const char *file_list_block[] = {
 	"dev",
@@ -170,8 +175,8 @@
 			file_list = file_list_usbif;
 		} else
 			file_list = file_list_usb;
-	} else if (strcmp (hotplug_type, "scsi_device") == 0) {
-		file_list = file_list_scsi_device;
+	} else if (strcmp (hotplug_type, "scsi") == 0) {
+		file_list = file_list_scsi;
 	} else if (strcmp (hotplug_type, "scsi_generic") == 0) {
 		file_list = file_list_scsi_generic;
 	} else if (strcmp (hotplug_type, "scsi_host") == 0) {
@@ -188,16 +193,16 @@
 
 try_again:
 	if (num_tries > 0) {
-		usleep (100 * 1000);
+		usleep (100 * 1000); /* 100 ms */
 	}
+	num_tries += 100;
 
-	if (num_tries == 20 * 10) {
-		syslog (LOG_NOTICE, "timed out for %s (waited %d ms)",
+	if (num_tries >= 10 * 1000*1000) { /* 10 secs */
+		syslog (LOG_NOTICE, "timout waiting for %s (waited %d ms)",
 			devpath, num_tries * 100);
 		return -1;
 	}
 
-	num_tries++;
 
 	/* first, check directory */
 	strncpy (path, sysfs_mnt_path, PATH_MAX);
@@ -298,16 +303,8 @@
 	seqnum = atoi (seqnum_str);
 
 	if (is_add) {
-		int rc;
-
 		/* wait for information to be published in sysfs */
-		rc = wait_for_sysfs_info (devpath, subsystem);
-		if (rc != 0) {
-			/* Don't know how to wait, just sleep one econd */
-			/*syslog (LOG_WARNING, "Dont know how to wait for %s at %s; "
-			  "sleeping 1000 ms", subsystem, devpath);*/
-			usleep (1000 * 1000);
-		}
+		wait_for_sysfs_info (devpath, subsystem);
 	}
 
 	memset (&saddr, 0x00, sizeof(struct sockaddr_un));




More information about the hal-commit mailing list