none
Can I send SD/MMC commands via IOCTL_SFFDISK_DEVICE_COMMAND? RRS feed

  • Question

  • Dear all,

    There are same problems with me but have no solution yet:

    problem on access SD memory card using DeviceIoControl

    Whether IOCTL_SFFDISK_DEVICE_COMMAND to sffdisk.sys Support SD COMMAND CMD56 /CMD16/CMD17

    DeviceIOControl failed to get SD card MID information correctly

    I sent CMD0~CMD63 and always received ERROR_ACCESS_DENIED except CMD9, CMD10, and CMD13.

    My environment contains PCIe to SD Host Contoller(sdbus.sys) and a SD Memory Card(sffdisk.sys).

    Does anyone has any idea?

    My function's format is like following:

    SFFDISK_DEVICE_COMMAND_DATA *pCmd = (SFFDISK_DEVICE_COMMAND_DATA*) new BYTE[nSizeOfCmd];
    memset(pCmd, 0, nSizeOfCmd);
    pCmd->HeaderSize = sizeof (SFFDISK_DEVICE_COMMAND_DATA);
    pCmd->Command = SFFDISK_DC_DEVICE_COMMAND;
    pCmd->ProtocolArgumentSize = sizeof (SDCMD_DESCRIPTOR);
    pCmd->DeviceDataBufferSize = 16;
    ULONG_PTR info = 0;
    pCmd->Information = info;
    ///Command protocol
    SDCMD_DESCRIPTOR sdCmdDescriptor = { 0 };
    sdCmdDescriptor.Cmd = 0; //GO_IDLE_STATE
    sdCmdDescriptor.CmdClass = SDCC_STANDARD;
    sdCmdDescriptor.TransferDirection = SDTD_WRITE;
    sdCmdDescriptor.TransferType = SDTT_CMD_ONLY;
    sdCmdDescriptor.ResponseType = SDRT_NONE;
    memcpy((BYTE *)(&(pCmd->Data[0])), &sdCmdDescriptor, sizeof(SDCMD_DESCRIPTOR));
     
    HANDLE hVol = CreateFile(L"\\\\.\\F:",  // SD CARD PATH
                                 GENERIC_READ | GENERIC_WRITE,
                                 FILE_SHARE_READ | FILE_SHARE_WRITE,
                                 NULL,
                                 OPEN_EXISTING,
                                 FILE_ATTRIBUTE_NORMAL,
                                 NULL);
     
    bool bResult = DeviceIoControl(hVol,
                                       IOCTL_SFFDISK_DEVICE_COMMAND,
                                       pCmd,
                                       nSizeOfCmd,
                                       pCmd,
                                       nSizeOfCmd,
                                       &dwBytesReturned,
                                       NULL);




    • Edited by U.I.O Friday, January 18, 2013 5:30 AM
    Tuesday, January 15, 2013 2:36 AM