diff options
author | Ben Chan <benchan@chromium.org> | 2017-09-18 09:10:57 -0700 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2017-09-20 09:28:16 -0700 |
commit | 4cb6f0e5aa1038e4335e062bf2a4d0bc2d8902b6 (patch) | |
tree | 78743763e0494946495d6d010a42a4a1871b0882 | |
parent | 4f8e9e2e1ca25c474de8472484f6eccf9834ae67 (diff) |
broadband-modem-mbim: fix preservation logic for PIN1 unlock retries
This patches fixes commit 334273979 "broadband-modem-mbim: preserve
unlock retries for PIN1 when appropriate", which doesn't correctly
propagate the unlock retries information for PIN1 observed from
responses to MBIM_CID_PIN set operations (see commit eb9ec1b61
"sim-mbim: update unlock retries information after PIN operations").
-rw-r--r-- | src/mm-broadband-modem-mbim.c | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/src/mm-broadband-modem-mbim.c b/src/mm-broadband-modem-mbim.c index 93a61085..aaa3e1cc 100644 --- a/src/mm-broadband-modem-mbim.c +++ b/src/mm-broadband-modem-mbim.c @@ -93,9 +93,6 @@ struct _MMBroadbandModemMbimPrivate { /* For notifying when the mbim-proxy connection is dead */ gulong mbim_device_removed_id; - - /* Previously observed SIM-PIN remaining retries */ - guint sim_pin_retries; }; /*****************************************************************************/ @@ -713,7 +710,7 @@ pin_query_unlock_retries_ready (MbimDevice *device, NULL, &remaining_attempts, &error)) { - MMBroadbandModemMbim *self; + MMIfaceModem *self; MMModemLock lock; MMUnlockRetries *retries; @@ -737,22 +734,24 @@ pin_query_unlock_retries_ready (MbimDevice *device, * PIN1. Here we thus carry over any existing information on PIN1 from * MMIfaceModem's MMUnlockRetries if the MBIM_CID_PIN query reports * something other than PIN1. */ - if (lock != MM_MODEM_LOCK_SIM_PIN && - self->priv->sim_pin_retries != MM_UNLOCK_RETRIES_UNKNOWN) { - mm_unlock_retries_set (retries, - MM_MODEM_LOCK_SIM_PIN, - self->priv->sim_pin_retries); + if (lock != MM_MODEM_LOCK_SIM_PIN) { + MMUnlockRetries *previous_retries; + guint previous_sim_pin_retries; + + previous_retries = mm_iface_modem_get_unlock_retries (self); + previous_sim_pin_retries = mm_unlock_retries_get (previous_retries, + MM_MODEM_LOCK_SIM_PIN); + if (previous_sim_pin_retries != MM_UNLOCK_RETRIES_UNKNOWN) { + mm_unlock_retries_set (retries, + MM_MODEM_LOCK_SIM_PIN, + previous_sim_pin_retries); + } } /* According to the MBIM specification, RemainingAttempts is set to * 0xffffffff if the device does not support this information. */ if (remaining_attempts != G_MAXUINT32) mm_unlock_retries_set (retries, lock, remaining_attempts); - else - remaining_attempts = MM_UNLOCK_RETRIES_UNKNOWN; - - if (lock == MM_MODEM_LOCK_SIM_PIN) - self->priv->sim_pin_retries = remaining_attempts; g_task_return_pointer (task, retries, g_object_unref); } else @@ -3274,8 +3273,6 @@ mm_broadband_modem_mbim_init (MMBroadbandModemMbim *self) self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, MM_TYPE_BROADBAND_MODEM_MBIM, MMBroadbandModemMbimPrivate); - - self->priv->sim_pin_retries = MM_UNLOCK_RETRIES_UNKNOWN; } static void |