diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2012-12-18 23:38:42 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2013-01-08 18:40:47 +0100 |
commit | 1372933345b197d89a7e4ae0d5bdcec1fd1e1b2e (patch) | |
tree | 908c7103dcf66afcb9090900ada612a6fc66c851 /src/mm-iface-modem-simple.c | |
parent | 959bb9d2ffb8bd7a3d701c21ec2cb58cab3717d9 (diff) |
iface-modem,sim: improve lock info update logic
The logic to handle the lock information (current lock and unlock retry count)
wasn't handling all possible cases properly, e.g.:
* When PIN is incorrectly entered too many times, a SIM-PUK error may happen.
In this case we need to directly assume SIM-PUK is the current lock (some
modems, like Option HSO ones, would incorrectly reply SIM-PIN if CPIN? asked
just after the SIM-PUK error).
* After every operation acting in SIM locks, we need to update the current
unlock retry count.
This change tries to cover those cases, by:
* The logic to check current lock is extended to also load the unlock retry
count when needed.
* Whenever a SIM-PUK error happens in the SIM operations, we directly assume
that SIM-PUK is required, without re-asking CPIN?.
* The overall logic of lock checking is now handled by a state machine, which
is much easier to understand.
Diffstat (limited to 'src/mm-iface-modem-simple.c')
-rw-r--r-- | src/mm-iface-modem-simple.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/mm-iface-modem-simple.c b/src/mm-iface-modem-simple.c index 2c2c58ff..12aa1520 100644 --- a/src/mm-iface-modem-simple.c +++ b/src/mm-iface-modem-simple.c @@ -437,15 +437,15 @@ send_pin_ready (MMSim *sim, } static void -unlock_check_ready (MMIfaceModem *self, - GAsyncResult *res, - ConnectionContext *ctx) +update_lock_info_ready (MMIfaceModem *self, + GAsyncResult *res, + ConnectionContext *ctx) { GError *error = NULL; MMModemLock lock; MMSim *sim; - lock = mm_iface_modem_unlock_check_finish (self, res, &error); + lock = mm_iface_modem_update_lock_info_finish (self, res, &error); if (error) { g_dbus_method_invocation_take_error (ctx->invocation, error); connection_context_free (ctx); @@ -524,9 +524,10 @@ connection_step (ConnectionContext *ctx) case CONNECTION_STEP_UNLOCK_CHECK: mm_info ("Simple connect state (%d/%d): Unlock check", ctx->step, CONNECTION_STEP_LAST); - mm_iface_modem_unlock_check (MM_IFACE_MODEM (ctx->self), - (GAsyncReadyCallback)unlock_check_ready, - ctx); + mm_iface_modem_update_lock_info (MM_IFACE_MODEM (ctx->self), + MM_MODEM_LOCK_UNKNOWN, /* ask */ + (GAsyncReadyCallback)update_lock_info_ready, + ctx); return; case CONNECTION_STEP_WAIT_FOR_INITIALIZED: |