-
Notifications
You must be signed in to change notification settings - Fork 98
Description
I've run into a road-block trying to make my use of the library generic across different implementations of BlockDevice
. The issue is that with the SdCard
type, I am able to yank SD card and reinsert it, but I must call SdCard::mark_card_uninit()
to force the device to re-acquire. I cannot seem to do this generically But I would also think that other implementations might have their own methods for detecting the need for a device reset. I propose two options, though I am mostly in favor of the first.
-
The
BlockDevice
trait could include something like areset(&self)
method. It could then either be up to the user to call reset in the case they receive aError::DeviceError
. Of course there may be implementations which do not require a reset, but for those it could just be a no-op. -
This option would not require changing the trait, and would instead have the
SdCard
(and other imlpementations) handle errors which require a reset to recover from, and make the reset itself (or just markinner.card_type = None
). This would of course keep things simple, but it might require modifying the error type to allow reporting the force-reset to the user.