This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Mass Storage device with apple OSX

Hello,

I'm working with a custom board based on the C6746. We need to transfer data from the attached SD card to a host computer over USB. I implemented the mass-storage code from the example code from starterware. It works fine using a windows host. However, using an apple with OSX, the host doesn't see the device as a disk.

I added printf's in USBDSCSICommand (in usbdmsc.c), to see what commands get in. This is what I get:

SCSI_TEST_UNIT_READY
SCSI_REQUEST_SENSE
SCSI_INQUIRY_CMD
SCSI_TEST_UNIT_READY
Allow usb access: 1
SCSI_REQUEST_SENSE
SCSI_INQUIRY_CMD
SCSI_TEST_UNIT_READY
SCSI default: 1e
SCSI_REQUEST_SENSE
SCSI_READ_CAPACITY
SCSI default: 5a

Then all transfers just stop.

I did change the code a bit, so the user can allow or disallow access to the SD card. That's the "allow usb access" log line.

Any idea what is going on? Do I need to implement command 0x5a? But that is (from what I find) only used for usb-attached floppy disk. So why is OSX sending that command?

Thanks,

Michiel

  • Hi Michiel,

    From a first look at it  seems the host has sent  a MODE SENSE 10 command and we don't have a handler for it. 

    As with regard to "allow usb access" change I suspect you have made it as a response to TEST_UNIT_READY. Is that correct ?

    Is there a way you can get a USB bus trace ( using an USB analyser) or at least a log on what's happening on the host PC side? 

  • I made some progress: If I send a version in the INQUIRY response, it seems to work a lot better. I now have this:

        _mem4(&g_pucCommand[0]) = SCSI_INQ_PDT_SBC | (SCSI_INQ_RMB << 8) | (SCSI_INQ_VERSION_SPC2 << 16); // version SPC2 is needed for OSX support

    and in the .h:

    #define SCSI_INQ_VERSION_UNSPECIFIED 0x00
    #define SCSI_INQ_VERSION_SPC2        0x04
    #define SCSI_INQ_VERSION_SPC3        0x05
    #define SCSI_INQ_VERSION_SPC4        0x06

    This seems to be a solution. I hope it is the right solution. I will test and let you know.

    I this the usb access by returing 0 in USBDMSCStorageOpen, which is indeed called from SCSI_TEST_UNIT_READY.

  • Hi Michiel ,

    Good to know that you have made progress.

    Which field of the SCSI INQUIRY response are you trying to modify? ISO version field ? Not all devices report/ fill this field ( hitachi drives report this and Disk on Key does not). Please let me know if you face any issues with this change. I would like to pull this change into the StarterWare stack if this works. 

  • Hi,

    I'm changing the version field, as described in http://www.t10.org/cgi-bin/ac.pl?t=f&f=spc4r36h.pdf on page 336 and 339.
    The modification is based on a look through the Darwin code: http://opensource.apple.com/source/IOSCSIArchitectureModelFamily/IOSCSIArchitectureModelFamily-1.1_35/IOSCSIBlockCommands/IOSCSIBlockCommandsDevice.cpp  function DetermineDeviceCharacteristics.

    It seems to me that sending a zero for the version (as the original starterware code) is OK. But then the OSC host goes into some mode, and doesn't understand that the device doesn't have MODE_SENSE_10 implemented. Sending an actual version sets the host in another mode, and now it sends MODE_SENSE_6, and all works.

    However, this is based on testing with just one mac, one device and one set of software. A bit more testing would be good. I haven't done any testing with other hosts yet.

    Michiel