If the device tells us that it doesn't support the Test Unit Ready (TUR) command,
don't try to use it for media status polling. In those cases we'll assume a fixed device with no exchangable medias and therefore always return B_OK. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32731 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -493,8 +493,19 @@ usb_disk_mode_sense(device_lun *lun)
|
||||
status_t
|
||||
usb_disk_test_unit_ready(device_lun *lun)
|
||||
{
|
||||
return usb_disk_operation(lun, SCSI_TEST_UNIT_READY_6, 6, 0, 0, NULL, NULL,
|
||||
true);
|
||||
// if unsupported we assume the unit is fixed and therefore always ok
|
||||
if (!lun->device->tur_supported)
|
||||
return B_OK;
|
||||
|
||||
status_t result = usb_disk_operation(lun, SCSI_TEST_UNIT_READY_6, 6, 0, 0,
|
||||
NULL, NULL, true);
|
||||
|
||||
if (result == B_DEV_INVALID_IOCTL) {
|
||||
lun->device->tur_supported = false;
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -633,6 +644,7 @@ usb_disk_device_added(usb_device newDevice, void **cookie)
|
||||
device->interface = 0xff;
|
||||
device->current_tag = 0;
|
||||
device->sync_support = SYNC_SUPPORT_RELOAD;
|
||||
device->tur_supported = true;
|
||||
device->luns = NULL;
|
||||
|
||||
// scan through the interfaces to find our bulk-only data interface
|
||||
|
||||
@@ -44,6 +44,7 @@ typedef struct disk_device_s {
|
||||
uint8 interface;
|
||||
uint32 current_tag;
|
||||
uint8 sync_support;
|
||||
bool tur_supported;
|
||||
|
||||
// used to store callback information
|
||||
sem_id notify;
|
||||
|
||||
Reference in New Issue
Block a user