A JMicron JMS583 based NVMe to USB 3.1 enclosure connected to a Raspberry
Pi 4 fails to enumerate as a USB Mass Storage device on first try:
...
startig USB...
Bus xhci_pci: Register 5000420 NbrPorts 5
Starting the controller
USB XHCI 1.00
scanning bus xhci_pci for devces... Device NOT ready
Request Sense returned 02 04 01
4 USB Device(s) found
scanning usb for storage devices... 0 Sorage Device(s) found
However, it consistently works on the second try. It seems that the
device takes longer than 1s to detect the media. With debug enabled
it shows that the 11th retry count typically works.
Increase retries to 20 for a startup time of up to 2s.
Signed-off-by: Stefan Agner <[email protected]>
---
common/usb_storage.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/common/usb_storage.c b/common/usb_storage.c
index ff25441995..04910de21f 100644
--- a/common/usb_storage.c
+++ b/common/usb_storage.c
@@ -1019,7 +1019,7 @@ static int usb_request_sense(struct scsi_cmd *srb, struct
us_data *ss)
static int usb_test_unit_ready(struct scsi_cmd *srb, struct us_data *ss)
{
- int retries = 10;
+ int retries = 20;
do {
memset(&srb->cmd[0], 0, 12);
--
2.28.0