hal/hald/linux block_class_device.c, 1.47, 1.48 scsi_device_class_device.c, 1.8, 1.9 scsi_host_class_device.c, 1.8, 1.9

David Zeuthen david at freedesktop.org
Sun Aug 1 12:56:45 PDT 2004


Update of /cvs/hal/hal/hald/linux
In directory pdx:/tmp/cvs-serv18146/hald/linux

Modified Files:
	block_class_device.c scsi_device_class_device.c 
	scsi_host_class_device.c 
Log Message:
2004-08-01  David Zeuthen  <david at fubar.dk>

	* hald/linux/block_class_device.c (block_class_compute_udi):
	If model and serial numbers are not available (for USB or IEEE1394
	devices), use the UDI for storage.physical_device and append the
	SCSI LUN and prepend block_ to attain uniqueness.
	
	* hald/linux/scsi_device_class_device.c:
	(scsi_device_class_pre_process): Add capability 'scsi_device'
	
	* hald/linux/scsi_host_class_device.c:
	(scsi_host_class_pre_process): Add capability 'scsi_host'



Index: block_class_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/block_class_device.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- block_class_device.c	1 Aug 2004 19:13:56 -0000	1.47
+++ block_class_device.c	1 Aug 2004 19:56:43 -0000	1.48
@@ -1592,6 +1592,44 @@
 
 		if (model != NULL && serial != NULL && serial[0] != '\0') {
 			snprintf (id, 255, "%s-%s", model, serial);
+		} else {
+			const char *phys_device;
+			int lun = -1;
+			const char *i;
+
+			/* use UDI from storage.physical_device and append
+			 * the LUN */
+
+			phys_device = hal_device_property_get_string (
+				d, "storage.physical_device");
+			if (phys_device != NULL) {
+
+				/* go up the chain and to find the LUN */
+				
+				i = hal_device_property_get_string (d, "info.parent");
+				while (i != NULL) {
+					HalDevice *idev;
+
+					idev = hal_device_store_find (hald_get_gdl (), i);
+					if (idev == NULL)
+						break;
+
+					if (hal_device_has_capability (idev, "scsi_device")) {
+						lun = hal_device_property_get_int (idev, "scsi_device.lun");
+						break;
+					}
+
+
+					i = hal_device_property_get_string (idev, "info.parent");
+				}
+
+				if (lun != -1 ) {
+					snprintf (id, 255, 
+						  "%s-lun%d", 
+						  get_last_element (phys_device),
+						  lun);
+				}
+			}
 		}
 	}
 	id[255] = '\0';

Index: scsi_device_class_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/scsi_device_class_device.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- scsi_device_class_device.c	5 Jul 2004 18:21:07 -0000	1.8
+++ scsi_device_class_device.c	1 Aug 2004 19:56:43 -0000	1.9
@@ -75,6 +75,8 @@
 
 	/* this is a virtual device */
 	hal_device_property_set_bool (d, "info.virtual", TRUE);
+
+	hal_device_add_capability (d, "scsi_device");
 }
 
 static char *

Index: scsi_host_class_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/scsi_host_class_device.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- scsi_host_class_device.c	5 Jul 2004 18:21:07 -0000	1.8
+++ scsi_host_class_device.c	1 Aug 2004 19:56:43 -0000	1.9
@@ -70,6 +70,8 @@
 
 	/* this is a virtual device */
 	hal_device_property_set_bool (d, "info.virtual", TRUE);
+
+	hal_device_add_capability (d, "scsi_host");
 }
 
 static char *




More information about the hal-commit mailing list