summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanny Kukawka <danny.kukawka@web.de>2010-03-15 18:55:15 +0100
committerDanny Kukawka <danny.kukawka@web.de>2010-08-23 15:49:31 +0200
commit0cf33d20324cce5d4f4b1aa274e7ddac76b13d83 (patch)
treec19e9a2929fd4c50afaec52959a586470d1bf6fa
parentd5950c97d62b019f1e7e141f55e401cd60478ca8 (diff)
fix storage.bus handling for SCSI
Fixed storage.bus handling for SCSI. Prevent fall through to PCI as storage bus. Current HAL marked SCSI storage devices which are not usb or ieee1394 get marked with storage.bus=pci and not as scsi.
-rw-r--r--hald/linux/blockdev.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/hald/linux/blockdev.c b/hald/linux/blockdev.c
index 208127ad..69132feb 100644
--- a/hald/linux/blockdev.c
+++ b/hald/linux/blockdev.c
@@ -1079,12 +1079,14 @@ hotplug_event_begin_add_blockdev (const gchar *sysfs_path, const gchar *device_f
if (!is_partition && !is_device_mapper && !is_fakevolume) {
const char *udi_it;
const char *physdev_udi;
+ const char *scsidev_udi;
HalDevice *scsidev;
HalDevice *physdev;
gboolean is_hotpluggable;
gboolean is_removable;
gboolean requires_eject;
gboolean no_partitions_hint;
+ gboolean was_scsi;
const gchar *bus;
const gchar *parent_bus;
@@ -1093,6 +1095,7 @@ hotplug_event_begin_add_blockdev (const gchar *sysfs_path, const gchar *device_f
*******************************/
scsidev = NULL;
+ scsidev_udi = NULL;
physdev = NULL;
physdev_udi = NULL;
@@ -1100,6 +1103,7 @@ hotplug_event_begin_add_blockdev (const gchar *sysfs_path, const gchar *device_f
is_hotpluggable = FALSE;
requires_eject = FALSE;
no_partitions_hint = FALSE;
+ was_scsi = FALSE;
/* defaults */
hal_device_property_set_string (d, "storage.bus", "unknown");
@@ -1120,6 +1124,7 @@ hotplug_event_begin_add_blockdev (const gchar *sysfs_path, const gchar *device_f
* start with our parent. On the way, optionally pick up
* the scsi if it exists */
udi_it = hal_device_get_udi (parent);
+
while (udi_it != NULL) {
HalDevice *d_it;
@@ -1197,14 +1202,14 @@ hotplug_event_begin_add_blockdev (const gchar *sysfs_path, const gchar *device_f
scsidev = d_it;
physdev = d_it;
physdev_udi = udi_it;
+ scsidev_udi = udi_it;
hal_device_property_set_string (d, "storage.bus", "scsi");
hal_device_copy_property (scsidev, "scsi.lun", d, "storage.lun");
is_hotpluggable = hal_device_property_get_bool(scsidev, "scsi.hotpluggable");
+ was_scsi = TRUE;
/* want to continue here, because it may be USB or IEEE1394 */
- }
-
- if (strcmp (bus, "usb") == 0) {
+ } else if (strcmp (bus, "usb") == 0) {
physdev = d_it;
physdev_udi = udi_it;
is_hotpluggable = TRUE;
@@ -1248,10 +1253,20 @@ hotplug_event_begin_add_blockdev (const gchar *sysfs_path, const gchar *device_f
physdev = d_it;
physdev_udi = udi_it;
hal_device_property_set_string (d, "storage.bus", "vio");
+ break;
} else if (strcmp (bus, "pci") == 0) {
- physdev = d_it;
- physdev_udi = udi_it;
- hal_device_property_set_string (d, "storage.bus", "pci");
+ if (was_scsi) {
+ /* lets assume we are SCSI but not usb or ieee1394 */
+ physdev = scsidev;
+ physdev_udi = scsidev_udi;
+ hal_device_property_set_string (d, "storage.bus", "scsi");
+ break;
+ } else {
+ physdev = d_it;
+ physdev_udi = udi_it;
+ hal_device_property_set_string (d, "storage.bus", "pci");
+ break;
+ }
}
}
@@ -1357,6 +1372,7 @@ hotplug_event_begin_add_blockdev (const gchar *sysfs_path, const gchar *device_f
HAL_WARNING (("scsi.type is unknown"));
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");
@@ -1427,7 +1443,7 @@ hotplug_event_begin_add_blockdev (const gchar *sysfs_path, const gchar *device_f
hal_device_property_set_string (d, "storage.drive_type", "disk");
}
}
- }
+ }
hal_device_property_set_string (d, "info.category", "storage");
hal_device_add_capability (d, "storage");