Skip to content

SIM Card PIN Not Handled via Modem Interface #59

@andrescera

Description

@andrescera

Note: This issue was cloned from CERALIVE/belaUI-ts#9


❗️SIM Card PIN Not Handled via Modem Interface (mmcli / ModemManager)

Describe the bug

The application currently does not handle SIM card PINs via the modem interface (mmcli / ModemManager). It assumes the SIM is always unlocked. When a SIM requires a PIN, the app fails to detect this and provides no prompt or mechanism for unlocking it. This leads to silent connection failures and confusing behavior for the user.


Expected behavior

  • Detect when the modem reports the SIM is in a locked or pin-required state.

  • Prompt the user to enter the SIM PIN.

  • Unlock the SIM using the mmcli command:

    mmcli -i <SIM-ID> --pin=<PIN>
  • Upon successful unlock, resume modem initialization and connection.

  • Additionally (optional):

    • Track incorrect PIN attempts and display remaining retries.

    • Detect puk-required state and optionally allow PUK entry.

    • Support enabling/disabling SIM PIN lock via:

      mmcli -i <SIM-ID> --enable-pin=<PIN>
      mmcli -i <SIM-ID> --disable-pin=<PIN>

Current behavior

  • No check for SIM lock status is performed.
  • SIM PIN is never requested or submitted.
  • App incorrectly assumes the SIM is ready and tries to connect.
  • Resulting modem connection fails silently.
  • Using mmcli -m <modem> manually reveals that the SIM is locked.

To Reproduce

  1. Insert a SIM card with a PIN enabled into a modem.

  2. Start the application.

  3. Observe that no prompt or notification is shown.

  4. Check SIM status with:

    mmcli -m 0

    and note the SIM state is locked.

  5. Attempt to connect via the app — it fails without explanation.


Proposed Solution

  • On initialization, query the modem’s SIM status via:

    mmcli -m <modem>
  • If the SIM is locked (PIN required), prompt the user to enter their PIN.

  • Unlock the SIM via:

    mmcli -i <SIM-ID> --pin=<PIN>
  • On success:

    • Refresh modem state.
    • Continue with normal network connection flow.
  • Add handling for:

    • Incorrect PIN entries (track retry counts).
    • PUK unlock flow (if supported).
    • SIM PIN configuration (enable/disable via user request).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions