[PATCH 2/2] broadband-modem-mbim: fix preservation logic for PIN1 unlock retries

Aleksander Morgado aleksander at aleksander.es
Wed Sep 20 16:29:49 UTC 2017


On 18/09/17 09:10, Ben Chan wrote:
> 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").
> ---

Pushed to git master.

>  src/mm-broadband-modem-mbim.c | 29 +++++++++++++----------------
>  1 file 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
> 


-- 
Aleksander
https://aleksander.es


More information about the ModemManager-devel mailing list