diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2011-11-29 17:02:05 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-03-15 14:14:30 +0100 |
commit | 0076106c9048ed73f260297c5aea54deae2f1f10 (patch) | |
tree | c581f9d01ea569da20c1ad47c25dd2641d716641 /src | |
parent | 670e2dcdc9bcb79147606e029f99969b930ad6fd (diff) |
iface-modem: don't report LOCKED state if SIM PIN2/PUK2
If unlock required reports needing SIM PIN2 or PUK2, don't report LOCKED state,
as the device is fully operational without it.
Diffstat (limited to 'src')
-rw-r--r-- | src/mm-iface-modem.c | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/src/mm-iface-modem.c b/src/mm-iface-modem.c index 2d103831..db623326 100644 --- a/src/mm-iface-modem.c +++ b/src/mm-iface-modem.c @@ -175,24 +175,12 @@ run_enable (MMIfaceModem *self, g_assert_not_reached (); break; - case MM_MODEM_STATE_LOCKED: { - MMModemLock lock; - - lock = mm_gdbus_modem_get_unlock_required (skeleton); - /* We don't care about SIM-PIN2/SIM-PUK2 since the device is - * operational without it. */ - if (lock != MM_MODEM_LOCK_NONE && - lock != MM_MODEM_LOCK_SIM_PIN2 && - lock != MM_MODEM_LOCK_SIM_PUK2) { - g_dbus_method_invocation_return_error (invocation, - MM_CORE_ERROR, - MM_CORE_ERROR_WRONG_STATE, - "Cannot enable modem: device locked"); - break; - } - - /* Fall through, treat as disabled */ - } + case MM_MODEM_STATE_LOCKED: + g_dbus_method_invocation_return_error (invocation, + MM_CORE_ERROR, + MM_CORE_ERROR_WRONG_STATE, + "Cannot enable modem: device locked"); + break; case MM_MODEM_STATE_DISABLED: MM_BASE_MODEM_GET_CLASS (self)->enable (MM_BASE_MODEM (self), @@ -667,7 +655,11 @@ set_lock_status (MMIfaceModem *self, old_lock = mm_gdbus_modem_get_unlock_required (skeleton); mm_gdbus_modem_set_unlock_required (skeleton, lock); - if (lock == MM_MODEM_LOCK_NONE) { + /* We don't care about SIM-PIN2/SIM-PUK2 since the device is + * operational without it. */ + if (lock == MM_MODEM_LOCK_NONE || + lock == MM_MODEM_LOCK_SIM_PIN2 || + lock == MM_MODEM_LOCK_SIM_PUK2) { if (old_lock != MM_MODEM_LOCK_NONE) { /* Notify transition from UNKNOWN/LOCKED to DISABLED */ mm_iface_modem_update_state (self, |