SDFileSystem

Dependencies:   FATFileSystem

Dependents:   WavePlayer_HelloWorld CAN_LOG_SD SDCard GPSLogger ... more

Issue: SDFileSystem::disk_initialize

There is no error checking of initialise_card at disk_initialize. when the disk is not connected, an error may occurs.

I solved the problem with the following code.

int SDFileSystem::disk_initialize() {
    int i = initialise_card();
    //<add>
    if(i==SDCARD_FAIL){
        return 1; 
    }
    //</add>
    debug_if(SD_DBG, "init card = %d\n", i);
    _sectors = _sd_sectors();
    
    // Set block length to 512 (CMD16)
    if (_cmd(16, 512) != 0) {
        debug("Set 512-byte block timed out\n");
        return 1;
    }