Reinitialization support
Hey, I'm using this library in conjunction with an SDIO SDMMC controller and a removable SDCard.
I would like to be able to reinitialize this library if the user removes the SDCard and reinserts it.
What I am doing is:
- Initialize everything, the SDMMC and this library, with SDCard present ✅
- Remove the SDCard, and then reinsert it (or another card) ✅
- Reinitialize the SDMMC controller ✅
- Reinitialize this library ❌
I need to refresh the handles for the Volume, e.g:
let mut volume = self.controller.get_volume(VolumeIdx(0)).unwrap();
But I then encounter the error:
panicked at 'called Result::unwrap() on an Err value: FormatError("Invalid MBR signature")', src/drivers/sdcard.rs:117:67
Proposed solution:
Either allow the Controller and volumes to be reinitialized, or provide a means to relinquish the block device so that the Controller can be reinitialized from scratch.
Kind regards
Ah, hot-plug. I would love to see a PR to support this!
Closed by #80, I think. You probably need out-of-band support to know when to destroy your VolumeManager though.