Skip to content

mmrs: sim pin/puk operations #404

@cachebag

Description

@cachebag

implement sim card pin/puk unlock and management.

lock state detection

check Modem.State for Locked state, then query Modem.UnlockRequired to determine lock type:

  • MM_MODEM_LOCK_SIM_PIN — needs pin
  • MM_MODEM_LOCK_SIM_PUK — needs puk + new pin
  • MM_MODEM_LOCK_SIM_PIN2, MM_MODEM_LOCK_SIM_PUK2 — secondary pin/puk

api

pub async fn unlock_pin(&self, pin: &str) -> Result<()>;
pub async fn unlock_puk(&self, puk: &str, new_pin: &str) -> Result<()>;
pub async fn set_pin_enabled(&self, pin: &str, enabled: bool) -> Result<()>;
pub async fn change_pin(&self, old: &str, new: &str) -> Result<()>;

error handling

map mm errors to typed variants:

  • wrong pin → ModemError::WrongPin
  • pin required → ModemError::PinRequired
  • puk required → ModemError::PukRequired
  • sim not inserted → ModemError::NoSim

retry tracking

Sim.UnlockRetries property gives remaining attempts before lockout. surface this in error messages or as a query method.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or requestmmrsmodemmanager bindings cratesimsim card and pin operations

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions