-
Notifications
You must be signed in to change notification settings - Fork 2
Description
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
lockedorpin-requiredstate. -
Prompt the user to enter the SIM PIN.
-
Unlock the SIM using the
mmclicommand: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-requiredstate 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
-
Insert a SIM card with a PIN enabled into a modem.
-
Start the application.
-
Observe that no prompt or notification is shown.
-
Check SIM status with:
mmcli -m 0
and note the SIM state is
locked. -
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).