//=============================================================================
// try to get the right FS for this store and then call it's format if we have one...
// Here is for MSC Drives (SDFat)
PFsFatFormatter FatFormatter;
PFsExFatFormatter ExFatFormatter;
uint8_t sectorBuffer[512];
uint8_t MSCMTPCB::formatStore(MTPStorage_SD *mtpstorage, uint32_t store, uint32_t user_token, uint32_t p2, bool post_process)
{
// Lets map the user_token back to oint to our object...
Serial.printf("Format Callback: user_token:%x store: %u p2:%u post:%u \n", user_token, store, p2, post_process);
if (msc[user_token].mscfs.fatType() == FAT_TYPE_FAT12) {
Serial.printf(" Fat12 not supported\n");
return MTPStorageInterfaceCB::FORMAT_NOT_SUPPORTED;
}
// For all of these the fat ones will do on post_process
if (!post_process) return MTPStorageInterfaceCB::FORMAT_NEEDS_CALLBACK;
if (msc[user_token].mscfs.fatType() == FAT_TYPE_EXFAT) {
Serial.println("ExFatFormatter - WIP");
ExFatFormatter.format(msc[user_token].mscfs.usbDrive(), msc[user_token].mscfs.part(), msc[user_token].mscfs, sectorBuffer, &Serial);
} else {
FatFormatter.format(msc[user_token].mscfs.usbDrive(), msc[user_token].mscfs.part(), msc[user_token].mscfs, sectorBuffer, &Serial);
}
return MTPStorageInterfaceCB::FORMAT_SUCCESSFUL;
}