I sort of started a thread a little bit ago:
https://forum.pjrc.com/threads/66338...h-each-other-8)
Where I was maybe setting up for some integration stuff... But only myself and @mj513 posted anything...
Right now playing with your USBMscFat code: sort of relating to what I posted on the MSC thread. about having FsLib support partitions. It would be easy to get it to maybe work by changing the begin Method... But not sure if anyone would take it...
So may duplicate that class in your project with it... May also add in a volumeName method which wraps up the functionality in the thread you just added to that project.
Plus a little cleanup...
My advanced c++ skills are a bit rusty: But I think the FsVolume object leaks other objects:
Code:
class FsVolume {
public:
FsVolume() {}
~FsVolume() {end();}
,,,
/** free dynamic memory and end access to volume */
void end() {
m_fVol = nullptr;
m_xVol = nullptr;
}
...
bool FsVolume::begin(BlockDevice* blockDev, bool setCwv, uint8_t part) {
Serial.printf("FsVolume::begin(%x)\n", (uint32_t)blockDev);
m_blockDev = blockDev;
m_fVol = nullptr;
m_xVol = new (m_volMem) ExFatVolume;
if (m_xVol && m_xVol->begin(m_blockDev, setCwv, part)) {
goto done;
}
m_xVol = nullptr;
m_fVol = new (m_volMem) FatVolume;
if (m_fVol && m_fVol->begin(m_blockDev, setCwv, part)) {
goto done;
}
m_cwv = nullptr;
m_fVol = nullptr;
return false;
done:
m_cwv = this;
return true;
}
I believe that the end function setting the pointers to null frees the object that was created by new? Could be wrong.
Also dito in the begin method, that if the begin for exFatVolume fails... then it should delete the exFatVolume before it sets nullptr...