diff options
author | Ben Chan <benchan@chromium.org> | 2014-02-26 14:56:34 -0800 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2014-02-27 09:38:37 +0100 |
commit | 5d88c2ff8f6bb3a59fa12f35d354eea0e7c26324 (patch) | |
tree | d43aee98d5122e0b641d0212f34efe79e353d5a2 | |
parent | accb611e1f7ec648c6a7a6080c89b41fa5f9fd5c (diff) |
broadband-modem-mbim: handle if unlock retries info is not available
By setting the 'RemainingAttempts' field of a MBIM_CID_PIN response to
0xffffffff, a MBIM modem indicates that it does not support the
information on the number of remaining attempts for pin-related
operations. This patch modifies MMBroadbandModemMbim to handle this case
properly, instead of reporting a very large unlock retries count.
-rw-r--r-- | src/mm-broadband-modem-mbim.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/mm-broadband-modem-mbim.c b/src/mm-broadband-modem-mbim.c index 64f1d7c3..554e7175 100644 --- a/src/mm-broadband-modem-mbim.c +++ b/src/mm-broadband-modem-mbim.c @@ -726,9 +726,13 @@ pin_query_unlock_retries_ready (MbimDevice *device, MMUnlockRetries *retries; retries = mm_unlock_retries_new (); - mm_unlock_retries_set (retries, - mm_modem_lock_from_mbim_pin_type (pin_type), - remaining_attempts); + /* 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, + mm_modem_lock_from_mbim_pin_type (pin_type), + remaining_attempts); + } g_simple_async_result_set_op_res_gpointer (simple, retries, g_object_unref); } else g_simple_async_result_take_error (simple, error); |