diff --git a/src/add-ons/kernel/drivers/disk/scsi/scsi_cd/scsi_cd.c b/src/add-ons/kernel/drivers/disk/scsi/scsi_cd/scsi_cd.c index 9ebc427f4c..d62db7e0d9 100644 --- a/src/add-ons/kernel/drivers/disk/scsi/scsi_cd/scsi_cd.c +++ b/src/add-ons/kernel/drivers/disk/scsi/scsi_cd/scsi_cd.c @@ -683,6 +683,45 @@ scsi_periph_callbacks callbacks = { }; +static float +cd_supports_device(device_node_handle parent, bool *_noConnection) +{ + char *bus; + uint8 device_type; + + SHOW_FLOW0(3, ""); + + // make sure parent is really the SCSI bus manager + if (pnp->get_attr_string(parent, B_DRIVER_BUS, &bus, false)) + return B_ERROR; + + if (strcmp(bus, "scsi")) { + free(bus); + return 0.0; + } + + // check whether it's really a Direct Access Device + if (pnp->get_attr_uint8(parent, SCSI_DEVICE_TYPE_ITEM, &device_type, true) != B_OK + || (device_type != scsi_dev_CDROM && device_type != scsi_dev_WORM)) { + free(bus); + return 0.0; + } + + free(bus); + return 0.6; +} + + +static void +cd_get_paths(const char ***_bus, const char ***_device) +{ + static const char *kBus[] = { "scsi", NULL }; + + *_bus = kBus; + *_device = NULL; +} + + static status_t std_ops(int32 op, ...) { @@ -712,11 +751,13 @@ block_device_interface scsi_cd_module = { std_ops }, - NULL, + cd_supports_device, cd_device_added, cd_init_device, (status_t (*) (void *))cd_uninit_device, - NULL + NULL, // remove device + NULL, // cleanup device + cd_get_paths, }, (status_t (*)(block_device_device_cookie, block_device_handle_cookie *))&cd_open, diff --git a/src/add-ons/kernel/drivers/disk/scsi/scsi_cd/scsi_cd.h b/src/add-ons/kernel/drivers/disk/scsi/scsi_cd/scsi_cd.h index f01d0f6ba0..951c20e0b1 100644 --- a/src/add-ons/kernel/drivers/disk/scsi/scsi_cd/scsi_cd.h +++ b/src/add-ons/kernel/drivers/disk/scsi/scsi_cd/scsi_cd.h @@ -18,6 +18,6 @@ #include -#define SCSI_CD_MODULE_NAME "drivers/disk/scsi/scsi_cd/"SCSI_DEVICE_TYPE_NAME +#define SCSI_CD_MODULE_NAME "drivers/disk/scsi/scsi_cd/device_v1" #endif diff --git a/src/add-ons/kernel/drivers/disk/scsi/scsi_dsk/scsi_dsk.c b/src/add-ons/kernel/drivers/disk/scsi/scsi_dsk/scsi_dsk.c index ca0767e842..19a9d98983 100644 --- a/src/add-ons/kernel/drivers/disk/scsi/scsi_dsk/scsi_dsk.c +++ b/src/add-ons/kernel/drivers/disk/scsi/scsi_dsk/scsi_dsk.c @@ -228,6 +228,7 @@ static float das_supports_device(device_node_handle parent, bool *_noConnection) { char *bus; + uint8 device_type; // make sure parent is really the SCSI bus manager if (pnp->get_attr_string(parent, B_DRIVER_BUS, &bus, false)) @@ -238,7 +239,12 @@ das_supports_device(device_node_handle parent, bool *_noConnection) return 0.0; } - // ToDo: check SCSI device type! (must be "disk") + // check whether it's really a Direct Access Device + if (pnp->get_attr_uint8(parent, SCSI_DEVICE_TYPE_ITEM, &device_type, true) != B_OK + || device_type != scsi_dev_direct_access) { + free(bus); + return 0.0; + } free(bus); return 0.6;