hal: Branch 'master'
Joe Marcus Clarke
marcus at kemper.freedesktop.org
Mon Feb 18 13:48:53 PST 2008
hald/freebsd/hf-scsi.c | 34 ++++++++++++++++++++++++++++------
1 file changed, 28 insertions(+), 6 deletions(-)
New commits:
commit 304fa95ae658cee3d301317b683f232a7592e966
Author: Joe Marcus Clarke <marcus at FreeBSD.org>
Date: Mon Feb 18 16:48:42 2008 -0500
properly map ATAPICAM devices to their underlying ATA device
It is not guaranteed that /dev/cd0 will map to /dev/acd0, so we need to
do more agressive checking to make sure the ATAPICAM/ATA mapping is correct
based on ATA host and channel numbers.
diff --git a/hald/freebsd/hf-scsi.c b/hald/freebsd/hf-scsi.c
index f4fd1ea..1303002 100644
--- a/hald/freebsd/hf-scsi.c
+++ b/hald/freebsd/hf-scsi.c
@@ -281,10 +281,13 @@ static HalDevice *
hf_scsi_get_atapi_device (HalDevice *ata_channel, int target_id)
{
HalDevice *device = NULL;
+ int ide_host;
GList *l;
g_return_val_if_fail(HAL_IS_DEVICE(ata_channel), NULL);
- g_return_val_if_fail(target_id == 0 || target_id == 1, NULL); /* ATA master or slave*/
+ g_return_val_if_fail(target_id == 0 || target_id == 1, NULL); /* ATA master or slave */
+
+ ide_host = hal_device_property_get_int(ata_channel, "ide_host.number");
/*
* If there's an ATAPI device it will be in hf_ata_pending_devices,
@@ -293,16 +296,35 @@ hf_scsi_get_atapi_device (HalDevice *ata_channel, int target_id)
HF_LIST_FOREACH(l, hf_ata_pending_devices)
{
- HalDevice *child = l->data;
+ HalDevice *child = HAL_DEVICE(l->data);
+ HalDevice *parent;
const char *driver;
+ const char *phys_device;
+ int host;
+ int channel;
driver = hal_device_property_get_string(child, "freebsd.driver");
/* ATAPI devices: CD-ROM (acd), tape (ast) or floppy (afd) */
- if (driver && (! strcmp(driver, "acd") || ! strcmp(driver, "ast") || ! strcmp(driver, "afd")))
- {
+ if (! driver || (strcmp(driver, "acd") && strcmp(driver, "ast") && strcmp(driver, "afd")))
+ continue;
+
+ phys_device = hal_device_property_get_string(child, "storage.physical_device");
+ if (! phys_device)
+ continue;
+
+ parent = hal_device_store_find(hald_get_gdl(), phys_device);
+ if (! parent)
+ continue;
+
+ host = hal_device_property_get_int(parent, "ide.host");
+ if (host != ide_host)
+ continue;
+
+ channel = hal_device_property_get_int(parent, "ide.channel");
+ if (target_id == channel)
+ {
device = child;
- if (target_id == 0)
- break; /* we wanted the first device, done */
+ break;
}
}
More information about the hal-commit
mailing list