AnsweredAssumed Answered

USB mass storage  Windows 7 compatibility

Question asked by G40 on Apr 19, 2012
Latest reply on May 11, 2012 by MartinK

The existing USB SCSI code is not 100% compatible with Windows 7 and some widely used diagnostic tools. Whilst devices configured as USB drives will appear correctly in Windows Explorer, attempting to format the drive or run any of the error checking tools will silently fail.

 

The problem stems from incomplete handling of the SCSI_INQUIRY message in adi_usb_msd_scsi.c. Windows 7 and some tools send a larger inquiry buffer than is expected by the code. I've made some very modest changes to adi_usb_msd_scsi.c to accommodate several variations on the theme. N.B. I do not claim this is a total fix - I've not had time to check the MMC spec.

 

In SCSI_ProcessCDB()

 

case SCSI_INQUIRY:

            if(pCommandBlock[1] == 0)

            {

                if (datalen  == sizeof (adi_msd_InquiryReport))

                {

                    memcpy(pBuffer, &adi_msd_InquiryReport, datalen);

                    return true;

                }

                // +JME

                else if (datalen == 56 ||           // Windows 7 x64

                                    datalen == 64)                    // HD Tune

                {

                          memcpy(pBuffer, &adi_msd_InquiryReport_1, 36);

                          *pActualBytesToReturn = 36;

                    return true;

                // -JME

                }

            }

            else // Added for Windows Vista

            if(pCommandBlock[1] == 1)

            {

                memcpy(pBuffer, &adi_msd_InquiryReport_1, 36);

                *pActualBytesToReturn = 36;

                return true;

            }

Outcomes