hal/hald/linux2 blockdev.c,1.29,1.30 physdev.c,1.23,1.24
Kay Sievers
kay at freedesktop.org
Fri Jan 20 07:40:05 PST 2006
Update of /cvs/hal/hal/hald/linux2
In directory gabe:/tmp/cvs-serv815/hald/linux2
Modified Files:
blockdev.c physdev.c
Log Message:
2006-01-20 Kay Sievers <kay.sievers at vrfy.org>
* hald/device_info.c: (resolve_udiprop_path), (handle_match):
* hald/linux2/blockdev.c: (hotplug_event_begin_add_blockdev):
* hald/linux2/physdev.c: (scsi_add): Add scsi.type, scsi.vendor,
scsi.model for the scsi device and merge these properties to the
storage device instead of using the "device" link in sysfs.
Index: blockdev.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/blockdev.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- blockdev.c 6 Jan 2006 18:41:23 -0000 1.29
+++ blockdev.c 20 Jan 2006 15:40:03 -0000 1.30
@@ -795,33 +795,14 @@
}
} else if (strcmp (parent_bus, "scsi") == 0) {
- gint type;
-
- if (hal_util_set_string_from_file (d, "storage.vendor", sysfs_path, "device/vendor"))
- hal_device_copy_property (d, "storage.vendor", d, "info.vendor");
- if (hal_util_set_string_from_file (d, "storage.model", sysfs_path, "device/model"))
- hal_device_copy_property (d, "storage.model", d, "info.product");
-
- if (!hal_util_get_int_from_file (sysfs_path, "device/type", &type, 0))
+ if (strcmp (hal_device_property_get_string (parent, "scsi.type"), "unknown") == 0)
goto error;
+ hal_device_copy_property (parent, "scsi.type", d, "storage.drive_type");
+ hal_device_copy_property (parent, "scsi.vendor", d, "storage.vendor");
+ hal_device_copy_property (parent, "scsi.model", d, "storage.model");
- /* These magic values are documented in the kernel source */
- switch (type) {
- case 0: /* Disk */
- case 14: /* TYPE_RBC (Reduced Block Commands) from kernel >= 2.6.14
- * Simple Direct Access Device, set it to disk (this should be
- * Firewire Disks), for more see kernel code and comments
- */
- hal_device_property_set_string (d, "storage.drive_type", "disk");
- break;
-
- case 5: /* CD-ROM */
- hal_device_property_set_string (d, "storage.drive_type", "cdrom");
- break;
-
- default:
- goto error;
- }
+ hal_device_copy_property (d, "storage.vendor", d, "info.vendor");
+ hal_device_copy_property (d, "storage.model", d, "info.product");
/* Check for USB floppy drive by looking at USB Mass Storage interface class
* instead of Protocol: Uniform Floppy Interface (UFI) in /proc as we did before.
@@ -857,7 +838,6 @@
requires_eject = TRUE;
}
-
if (strcmp (hal_device_property_get_string (d, "storage.drive_type"), "floppy") == 0) {
no_partitions_hint = TRUE;
}
Index: physdev.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/physdev.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- physdev.c 2 Nov 2005 15:38:14 -0000 1.23
+++ physdev.c 20 Jan 2006 15:40:03 -0000 1.24
@@ -681,6 +681,7 @@
HalDevice *d;
const gchar *bus_id;
gint host_num, bus_num, target_num, lun_num;
+ int type;
if (parent == NULL) {
d = NULL;
@@ -702,9 +703,35 @@
hal_util_set_driver (d, "info.linux.driver", sysfs_path);
- /* guestimate product name */
hal_device_property_set_string (d, "info.product", "SCSI Device");
+ hal_util_set_string_from_file (d, "scsi.model", sysfs_path, "model");
+ hal_util_set_string_from_file (d, "scsi.vendor", sysfs_path, "vendor");
+ hal_util_get_int_from_file (sysfs_path, "type", &type, 0);
+ switch (type) {
+ case 0:
+ /* Disk */
+ case 14:
+ /* TYPE_RBC (Reduced Block Commands)
+ * Simple Direct Access Device, set it to disk
+ * (some Firewire Disks use it)
+ */
+ hal_device_property_set_string (d, "scsi.type", "disk");
+ break;
+ case 1:
+ /* Tape */
+ hal_device_property_set_string (d, "scsi.type", "tape");
+ break;
+ case 4:
+ /* WORM */
+ case 5:
+ /* CD-ROM */
+ hal_device_property_set_string (d, "scsi.type", "cdrom");
+ break;
+ default:
+ hal_device_property_set_string (d, "scsi.type", "unknown");
+ }
+
out:
return d;
}
More information about the hal-commit
mailing list