Retry reading the capacity up to three times. The first try might only yield a
unit attention telling us that the device or media status changed, which is expected. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26081 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -415,8 +415,14 @@ usb_disk_update_capacity(device_lun *lun)
|
|||||||
{
|
{
|
||||||
uint32 dataLength = sizeof(scsi_read_capacity_10_parameter);
|
uint32 dataLength = sizeof(scsi_read_capacity_10_parameter);
|
||||||
scsi_read_capacity_10_parameter parameter;
|
scsi_read_capacity_10_parameter parameter;
|
||||||
status_t result = usb_disk_operation(lun, SCSI_READ_CAPACITY_10, 10, 0, 0,
|
status_t result = B_ERROR;
|
||||||
|
for (int32 i = 0; i < 3; i++) {
|
||||||
|
result = usb_disk_operation(lun, SCSI_READ_CAPACITY_10, 10, 0, 0,
|
||||||
¶meter, &dataLength, true);
|
¶meter, &dataLength, true);
|
||||||
|
if (result == B_OK)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (result != B_OK) {
|
if (result != B_OK) {
|
||||||
TRACE_ALWAYS("failed to update capacity\n");
|
TRACE_ALWAYS("failed to update capacity\n");
|
||||||
lun->media_present = false;
|
lun->media_present = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user