diff options
author | Michal Mazur <mkm@semihalf.com> | 2021-09-20 17:22:02 +0200 |
---|---|---|
committer | Michal Mazur <mkm@semihalf.com> | 2021-09-21 14:28:01 +0200 |
commit | 5c6b4851c5b15b23580b97dd4b93eaa979f54220 (patch) | |
tree | de8806dce9b30fdb5aa10529b772ad55a28c2367 | |
parent | 5828af115c300045dd8d70ed04578032b5ecabee (diff) | |
download | ModemManager-5c6b4851c5b15b23580b97dd4b93eaa979f54220.tar.gz |
modem-qmi,sim-qmi: read personalization retries from Card Status
-rw-r--r-- | src/mm-broadband-modem-qmi.c | 11 | ||||
-rw-r--r-- | src/mm-modem-helpers-qmi.c | 4 | ||||
-rw-r--r-- | src/mm-modem-helpers-qmi.h | 1 | ||||
-rw-r--r-- | src/mm-sim-qmi.c | 2 |
4 files changed, 14 insertions, 4 deletions
diff --git a/src/mm-broadband-modem-qmi.c b/src/mm-broadband-modem-qmi.c index cc96a9fc7..a74f035a0 100644 --- a/src/mm-broadband-modem-qmi.c +++ b/src/mm-broadband-modem-qmi.c @@ -842,7 +842,7 @@ unlock_required_uim_get_card_status_ready (QmiClientUim *client, if (!mm_qmi_uim_get_card_status_output_parse (self, output, &lock, - NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, &error)) { /* The device may report a SIM NOT INSERTED error if we're querying the * card status soon after power on. We'll let the Modem interface generic @@ -1079,7 +1079,9 @@ unlock_retries_uim_get_card_status_ready (QmiClientUim *client, guint puk1_retries = 0; guint pin2_retries = 0; guint puk2_retries = 0; + guint pers_retries = 0; MMUnlockRetries *retries; + MMModemLock lock = MM_MODEM_LOCK_UNKNOWN; self = g_task_get_source_object (task); @@ -1093,9 +1095,10 @@ unlock_retries_uim_get_card_status_ready (QmiClientUim *client, if (!mm_qmi_uim_get_card_status_output_parse (self, output, - NULL, + &lock, NULL, &pin1_retries, &puk1_retries, NULL, &pin2_retries, &puk2_retries, + &pers_retries, &error)) { g_task_return_error (task, error); g_object_unref (task); @@ -1107,6 +1110,8 @@ unlock_retries_uim_get_card_status_ready (QmiClientUim *client, mm_unlock_retries_set (retries, MM_MODEM_LOCK_SIM_PUK, puk1_retries); mm_unlock_retries_set (retries, MM_MODEM_LOCK_SIM_PIN2, pin2_retries); mm_unlock_retries_set (retries, MM_MODEM_LOCK_SIM_PUK2, puk2_retries); + if (lock >= MM_MODEM_LOCK_PH_SP_PIN) + mm_unlock_retries_set (retries, lock, pers_retries); qmi_message_uim_get_card_status_output_unref (output); @@ -1952,7 +1957,7 @@ get_sim_lock_status_via_get_card_status_ready (QmiClientUim *client, if (!mm_qmi_uim_get_card_status_output_parse (self, output, &lock, - &pin1_state, NULL, NULL, &pin2_state, NULL, NULL, + &pin1_state, NULL, NULL, &pin2_state, NULL, NULL, NULL, &error)) { g_prefix_error (&error, "QMI operation failed: "); g_task_return_error (task, error); diff --git a/src/mm-modem-helpers-qmi.c b/src/mm-modem-helpers-qmi.c index 47587c22d..ac6b735d4 100644 --- a/src/mm-modem-helpers-qmi.c +++ b/src/mm-modem-helpers-qmi.c @@ -2044,6 +2044,7 @@ mm_qmi_uim_get_card_status_output_parse (gpointer log_ QmiUimPinState *o_pin2_state, guint *o_pin2_retries, guint *o_puk2_retries, + guint *o_pers_retries, GError **error) { QmiMessageUimGetCardStatusOutputCardStatusCardsElement *card; @@ -2291,6 +2292,9 @@ mm_qmi_uim_get_card_status_output_parse (gpointer log_ "Unsupported personalization feature"); return FALSE; } + + if (o_pers_retries) + *o_pers_retries = app->personalization_retries; } } diff --git a/src/mm-modem-helpers-qmi.h b/src/mm-modem-helpers-qmi.h index 0b79a5b1b..4891fae16 100644 --- a/src/mm-modem-helpers-qmi.h +++ b/src/mm-modem-helpers-qmi.h @@ -185,6 +185,7 @@ gboolean mm_qmi_uim_get_card_status_output_parse (gpointer QmiUimPinState *o_pin2_state, guint *o_pin2_retries, guint *o_puk2_retries, + guint *o_pers_retries, GError **error); /*****************************************************************************/ diff --git a/src/mm-sim-qmi.c b/src/mm-sim-qmi.c index a4aa3cb93..7c9fe7f52 100644 --- a/src/mm-sim-qmi.c +++ b/src/mm-sim-qmi.c @@ -145,7 +145,7 @@ uim_get_card_status_ready (QmiClientUim *client, output = qmi_client_uim_get_card_status_finish (client, res, &error); if (!output || !qmi_message_uim_get_card_status_output_get_result (output, &error) || - (!mm_qmi_uim_get_card_status_output_parse (self, output, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &error) && + (!mm_qmi_uim_get_card_status_output_parse (self, output, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &error) && (g_error_matches (error, MM_MOBILE_EQUIPMENT_ERROR, MM_MOBILE_EQUIPMENT_ERROR_SIM_NOT_INSERTED) || g_error_matches (error, MM_CORE_ERROR, MM_CORE_ERROR_RETRY)))) { mm_obj_dbg (self, "sim not yet considered ready... retrying"); |