aboutsummaryrefslogtreecommitdiffstats
path: root/src/hw/blockcmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/hw/blockcmd.c')
-rw-r--r--src/hw/blockcmd.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/hw/blockcmd.c b/src/hw/blockcmd.c
index 1f15081b..6b6fea97 100644
--- a/src/hw/blockcmd.c
+++ b/src/hw/blockcmd.c
@@ -144,8 +144,9 @@ scsi_is_ready(struct disk_op_s *op)
dprintf(6, "scsi_is_ready (drive=%p)\n", op->drive_fl);
/* Retry TEST UNIT READY for 5 seconds unless MEDIUM NOT PRESENT is
- * reported by the device. If the device reports "IN PROGRESS",
+ * reported by the device 3 times. If the device reports "IN PROGRESS",
* 30 seconds is added. */
+ int tries = 3;
int in_progress = 0;
u32 end = timer_calc(5000);
for (;;) {
@@ -167,8 +168,11 @@ scsi_is_ready(struct disk_op_s *op)
// Sense succeeded.
if (sense.asc == 0x3a) { /* MEDIUM NOT PRESENT */
- dprintf(1, "Device reports MEDIUM NOT PRESENT\n");
- return -1;
+ tries--;
+ dprintf(1, "Device reports MEDIUM NOT PRESENT - %d tries left\n",
+ tries);
+ if (!tries)
+ return -1;
}
if (sense.asc == 0x04 && sense.ascq == 0x01 && !in_progress) {