From 6cf7524447e811754e70d15a0b162212424f6dc7 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Sun, 22 Jun 2008 18:32:02 +0000 Subject: [PATCH] Add comment explaining the reason for retrying capacity reads. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26083 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.cpp b/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.cpp index f740d78b35..ddfe905020 100644 --- a/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.cpp +++ b/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.cpp @@ -426,6 +426,12 @@ usb_disk_update_capacity(device_lun *lun) uint32 dataLength = sizeof(scsi_read_capacity_10_parameter); scsi_read_capacity_10_parameter parameter; status_t result = B_ERROR; + + // 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 more or less expected if it is the first operation + // on the device or the device only clears the unit atention for capacity + // reads. for (int32 i = 0; i < 3; i++) { result = usb_disk_operation(lun, SCSI_READ_CAPACITY_10, 10, 0, 0, ¶meter, &dataLength, true);