Skip to content

Ensuring generic device-level reset #128

@peterkrull

Description

@peterkrull

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.

  1. The BlockDevice trait could include something like a reset(&self) method. It could then either be up to the user to call reset in the case they receive a Error::DeviceError. Of course there may be implementations which do not require a reset, but for those it could just be a no-op.

  2. 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 mark inner.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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions