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.
This commit is contained in:

committed by
Aleksander Morgado

parent
accb611e1f
commit
5d88c2ff8f
@@ -726,9 +726,13 @@ pin_query_unlock_retries_ready (MbimDevice *device,
|
|||||||
MMUnlockRetries *retries;
|
MMUnlockRetries *retries;
|
||||||
|
|
||||||
retries = mm_unlock_retries_new ();
|
retries = mm_unlock_retries_new ();
|
||||||
mm_unlock_retries_set (retries,
|
/* According to the MBIM specification, RemainingAttempts is set to
|
||||||
mm_modem_lock_from_mbim_pin_type (pin_type),
|
* 0xffffffff if the device does not support this information. */
|
||||||
remaining_attempts);
|
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);
|
g_simple_async_result_set_op_res_gpointer (simple, retries, g_object_unref);
|
||||||
} else
|
} else
|
||||||
g_simple_async_result_take_error (simple, error);
|
g_simple_async_result_take_error (simple, error);
|
||||||
|
Reference in New Issue
Block a user