+2022xxxx 6.4.14
+ - Fix firmware version displaying as "0.0" in scsi2sd-util when there is no
+ SD card inserted.
+
20220121 6.4.13
- Fix SCSI writes with sector sizes larger than 512.
- Fix 2Gb SD cards being detected as 1Gb
\r
#include <string.h>\r
\r
-static const uint16_t FIRMWARE_VERSION = 0x064D;\r
+static const uint16_t FIRMWARE_VERSION = 0x064E;\r
\r
// Optional static config\r
extern uint8_t* __fixed_config;\r
if(((USBD_StorageTypeDef *)pdev->pUserData)->GetCapacity(lun, &hmsc->scsi_blk_nbr, &hmsc->scsi_blk_size) != 0)
{
- SCSI_SenseCode(pdev,
+ memset(hmsc->bot_data, 0, 8);
+ if (hmsc->bot_state == USBD_BOT_DATA_IN)
+ {
+ if (hmsc->bot_data_length > 0)
+ {
+ USBD_LL_Transmit (pdev,
+ MSC_EPIN_ADDR,
+ hmsc->bot_data,
+ hmsc->bot_data_length);
+ hmsc->csw.dDataResidue -= hmsc->bot_data_length;
+ hmsc->bot_data_length = 0;
+ return 0;
+ }
+ else
+ {
+ return -1; // Time to send the error.
+ }
+ }
+ else
+ {
+ SCSI_SenseCode(pdev,
lun,
NOT_READY,
MEDIUM_NOT_PRESENT);
- hmsc->bot_state = USBD_BOT_NO_DATA;
- return -1;
+
+ // Don't send the error just yet. Microsoft Windows fails to detect the CSW
+ // prior to the 8 byte response is sent. Windows also insists on calling
+ // ReadCapacity even when TestUnitReady fails with MEDIUM_NOT_PRESENT
+ hmsc->bot_state = USBD_BOT_DATA_IN;
+ hmsc->bot_data_length = MIN(8, hmsc->csw.dDataResidue);
+ return 0;
+ }
}
else
{