Increase Downstream's host command timeout to 5 seconds. It turns out

some flash drives can take up to 2 seconds to write a single block.
USG_1.0
Robert Fisk 9 years ago
parent b9c1b23e4b
commit 90e236561d

@ -136,7 +136,8 @@ MSC_HandleTypeDef;
#define USB_REQ_BOT_RESET 0xFF
#define USB_REQ_GET_MAX_LUN 0xFE
#define MSC_TIMEOUT_FRAMES_PER_BLOCK 1000
//#define MSC_TIMEOUT_FRAMES_PER_BLOCK 1000
#define MSC_TIMEOUT_FIXED 5000 //Some flash drives take 2 seconds to write a single block!
/* MSC Class Codes */
#define USB_MSC_CLASS 0x08

@ -735,7 +735,7 @@ USBH_StatusTypeDef USBH_MSC_Read(USBH_HandleTypeDef *phost,
MSC_Handle->unit[lun].state = MSC_READ;
MSC_Handle->rw_lun = lun;
MSC_Handle->RdWrCompleteCallback = callback;
MSC_Handle->timeout = phost->Timer + (length * MSC_TIMEOUT_FRAMES_PER_BLOCK);
MSC_Handle->timeout = phost->Timer + MSC_TIMEOUT_FIXED;
USBH_MSC_SCSI_Read(phost,
lun,
@ -776,7 +776,7 @@ USBH_StatusTypeDef USBH_MSC_Write(USBH_HandleTypeDef *phost,
MSC_Handle->unit[lun].state = MSC_WRITE;
MSC_Handle->rw_lun = lun;
MSC_Handle->RdWrCompleteCallback = callback;
MSC_Handle->timeout = phost->Timer + (length * MSC_TIMEOUT_FRAMES_PER_BLOCK);
MSC_Handle->timeout = phost->Timer + MSC_TIMEOUT_FIXED;
USBH_MSC_SCSI_Write(phost,
lun,

Loading…
Cancel
Save