From 8c905383b7f8f59e7b78c054ace828096a7fe6ba Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Sat, 30 Jan 2016 16:25:20 -0800 Subject: [PATCH] broadband-modem-qmi: locked states also indicate readiness of the SIM card When the card application is flagged as needing PIN or PUK, then the card can be considered as being ready. --- src/mm-broadband-modem-qmi.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/mm-broadband-modem-qmi.c b/src/mm-broadband-modem-qmi.c index 999ead1c..3946745a 100644 --- a/src/mm-broadband-modem-qmi.c +++ b/src/mm-broadband-modem-qmi.c @@ -1622,8 +1622,13 @@ uim_get_card_status_ready (QmiClientUim *client, card = &g_array_index (cards, QmiMessageUimGetCardStatusOutputCardStatusCardsElement, card_i); app = &g_array_index (card->applications, QmiMessageUimGetCardStatusOutputCardStatusCardsElementApplicationsElement, application_j); - /* If card not ready yet, return RETRY error */ - if (app->state != QMI_UIM_CARD_APPLICATION_STATE_READY) { + /* If card not ready yet, return RETRY error. + * If the application state reports needing PIN/PUk, consider that ready as + * well, and let the logic fall down to check PIN1/PIN2. */ + if (app->state != QMI_UIM_CARD_APPLICATION_STATE_READY && + app->state != QMI_UIM_CARD_APPLICATION_STATE_PIN1_OR_UPIN_PIN_REQUIRED && + app->state != QMI_UIM_CARD_APPLICATION_STATE_PUK1_OR_UPIN_PUK_REQUIRED && + app->state != QMI_UIM_CARD_APPLICATION_STATE_PIN1_BLOCKED) { g_debug ("Neither SIM nor USIM are ready"); g_simple_async_result_set_error (ctx->result, MM_CORE_ERROR,