From c2149b78bea649febb4a9ff2f1229bc7a863841c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= <jerome.duval@gmail.com>
Date: Tue, 19 Nov 2013 20:42:45 +0100
Subject: [PATCH] usb_disk: update_capacity() now retries until success.
---
src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
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 5da2965..5c937f1 100644
a
|
b
|
usb_disk_update_capacity(device_lun *lun)
|
607 | 607 | // Retry reading the capacity up to three times. The first try might only |
608 | 608 | // yield a unit attention telling us that the device or media status |
609 | 609 | // changed, which is more or less expected if it is the first operation |
610 | | // on the device or the device only clears the unit atention for capacity |
| 610 | // on the device or the device only clears the unit attention for capacity |
611 | 611 | // reads. |
612 | 612 | for (int32 i = 0; i < 3; i++) { |
613 | 613 | result = usb_disk_operation(lun, SCSI_READ_CAPACITY_10, 10, 0, 0, |
614 | 614 | ¶meter, &dataLength, true, &action); |
615 | | if (result == B_OK || (action != err_act_retry |
616 | | && action != err_act_many_retries)) { |
| 615 | if (result == B_OK && action != err_act_retry |
| 616 | && action != err_act_many_retries) { |
617 | 617 | break; |
618 | 618 | } |
619 | 619 | } |