[PATCH] telit: unsupported CSIM lock should not skip loading unlock retries

Carlo Lobrano c.lobrano at gmail.com
Thu Apr 6 12:37:05 UTC 2017


Some modems do not support CSIM lock/unlock, but they do support
querying SIM unlock retries through +CSIM command.

If CSIM lock returns with "unsupported command" do not propagate
the error and continue with the other CSIM queries instead.
---

Sorry for not having caught this problem earlier,
when reviewing the CSIM lock patch.

---

 plugins/telit/mm-broadband-modem-telit.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/plugins/telit/mm-broadband-modem-telit.c b/plugins/telit/mm-broadband-modem-telit.c
index cce0229..3680a8a 100644
--- a/plugins/telit/mm-broadband-modem-telit.c
+++ b/plugins/telit/mm-broadband-modem-telit.c
@@ -591,10 +591,17 @@ csim_lock_ready (MMBaseModem              *self,
 
     response = mm_base_modem_at_command_finish (self, res, &error);
     if (!response) {
-        g_prefix_error (&error, "Couldn't lock SIM card: ");
-        g_simple_async_result_take_error (ctx->result, error);
-        load_unlock_retries_context_complete_and_free (ctx);
-        return;
+        if (g_error_matches (error,
+                             MM_MOBILE_EQUIPMENT_ERROR,
+                             MM_MOBILE_EQUIPMENT_ERROR_NOT_SUPPORTED)) {
+            mm_warn ("Couldn't lock SIM card: %s. Continuing as well...", error->message);
+            g_error_free (error);
+        } else {
+            g_prefix_error (&error, "Couldn't lock SIM card: ");
+            g_simple_async_result_take_error (ctx->result, error);
+            load_unlock_retries_context_complete_and_free (ctx);
+            return;
+        }
     }
 
     ctx->step++;
-- 
2.7.4



More information about the ModemManager-devel mailing list