hal/hald/linux2 classdev.c,1.37,1.38

Kay Sievers kay at freedesktop.org
Fri Jan 6 07:39:00 PST 2006


Update of /cvs/hal/hal/hald/linux2
In directory gabe:/tmp/cvs-serv14960/hald/linux2

Modified Files:
	classdev.c 
Log Message:
2006-01-05  Kay Sievers  <kay.sievers at vrfy.org>

        Add scsi_generic devices.

        * hald/linux2/classdev.c: (scsi_generic_add),
        (scsi_generic_compute_udi):


Index: classdev.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/classdev.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- classdev.c	9 Dec 2005 18:08:20 -0000	1.37
+++ classdev.c	6 Jan 2006 15:38:58 -0000	1.38
@@ -314,6 +314,43 @@
 /*--------------------------------------------------------------------------------------------------------------*/
 
 static HalDevice *
+scsi_generic_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *physdev, const gchar *sysfs_path_in_devices)
+{
+	HalDevice *d;
+
+	d = NULL;
+
+	if (physdev == NULL || sysfs_path_in_devices == NULL)
+		goto out;
+
+	d = hal_device_new ();
+	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
+	hal_device_property_set_string (d, "info.parent", physdev->udi);
+	hal_device_property_set_string (d, "info.category", "scsi_generic");
+	hal_device_add_capability (d, "scsi_generic");
+	hal_device_property_set_string (d, "info.product", "SCSI Generic Interface");
+	hal_device_property_set_string (d, "scsi_generic.device", device_file);
+
+out:
+	return d;
+}
+
+static gboolean
+scsi_generic_compute_udi (HalDevice *d)
+{
+	gchar udi[256];
+
+	hal_util_compute_udi (hald_get_gdl (), udi, sizeof (udi),
+			      "%s_scsi_generic",
+			      hal_device_property_get_string (d, "info.parent"));
+	hal_device_set_udi (d, udi);
+	hal_device_property_set_string (d, "info.udi", udi);
+	return TRUE;
+}
+
+/*--------------------------------------------------------------------------------------------------------------*/
+
+static HalDevice *
 scsi_host_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *physdev, const gchar *sysfs_path_in_devices)
 {
 	HalDevice *d;
@@ -946,6 +983,16 @@
 	.remove       = classdev_remove
 };
 
+static ClassDevHandler classdev_handler_scsi_generic =
+{ 
+	.subsystem    = "scsi_generic",
+	.add          = scsi_generic_add,
+	.get_prober   = NULL,
+	.post_probing = NULL,
+	.compute_udi  = scsi_generic_compute_udi,
+	.remove       = classdev_remove
+};
+
 static ClassDevHandler classdev_handler_scsi_host = 
 { 
 	.subsystem    = "scsi_host",
@@ -1020,6 +1067,7 @@
 	&classdev_handler_input,
 	&classdev_handler_bluetooth,
 	&classdev_handler_net,
+	&classdev_handler_scsi_generic,
 	&classdev_handler_scsi_host,
 	&classdev_handler_usbclass,
 	&classdev_handler_sound,




More information about the hal-commit mailing list