cdrom devices are handled properly now
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14125 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
f13c45ad3f
commit
274b8a8cc9
@ -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,
|
||||
|
@ -18,6 +18,6 @@
|
||||
|
||||
#include <device_manager.h>
|
||||
|
||||
#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
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user