aboutsummaryrefslogtreecommitdiff
path: root/src/mm-iface-modem.c
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2011-12-15 20:21:57 +0100
committerAleksander Morgado <aleksander@lanedo.com>2012-03-15 14:14:34 +0100
commit88077cbbe83a8d6beaed92a3277cab3ba0e429d3 (patch)
treec3b83fa3517caf96d060581d5e020608846ec4f7 /src/mm-iface-modem.c
parent5f4655c57415e5fe28581fbe6e29f334d1517c17 (diff)
iface-modem: treat several SIM related errors as fatal
If the SIM is not inserted or the modem reports SIM failures, just abort the initialization process. We don't want to export modems which cannot be used. I know at least of one modem (wavecom) which supports SIM insertion while connected, but being such a corner case, probably not worth supporting it.
Diffstat (limited to 'src/mm-iface-modem.c')
-rw-r--r--src/mm-iface-modem.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/mm-iface-modem.c b/src/mm-iface-modem.c
index 4176af3b..5fca0660 100644
--- a/src/mm-iface-modem.c
+++ b/src/mm-iface-modem.c
@@ -806,6 +806,23 @@ unlock_check_ready (MMIfaceModem *self,
res,
&error);
if (error) {
+ /* Treat several SIM related errors as critical and abort the checks
+ * TODO: do this only after the retries? */
+ if (g_error_matches (error,
+ MM_MOBILE_EQUIPMENT_ERROR,
+ MM_MOBILE_EQUIPMENT_ERROR_SIM_NOT_INSERTED) ||
+ g_error_matches (error,
+ MM_MOBILE_EQUIPMENT_ERROR,
+ MM_MOBILE_EQUIPMENT_ERROR_SIM_FAILURE) ||
+ g_error_matches (error,
+ MM_MOBILE_EQUIPMENT_ERROR,
+ MM_MOBILE_EQUIPMENT_ERROR_SIM_WRONG)) {
+ g_simple_async_result_take_error (ctx->result, error);
+ g_simple_async_result_complete (ctx->result);
+ unlock_check_context_free (ctx);
+ return;
+ }
+
/* Retry up to 3 times */
if (mm_gdbus_modem_get_unlock_required (ctx->skeleton) != MM_MODEM_LOCK_NONE &&
++ctx->pin_check_tries < 3) {
@@ -1663,8 +1680,11 @@ load_unlock_required_ready (MMIfaceModem *self,
/* NOTE: we already propagated the lock state, no need to do it again */
mm_iface_modem_unlock_check_finish (self, res, &error);
if (error) {
+ /* FATAL */
mm_warn ("couldn't load unlock required status: '%s'", error->message);
- g_error_free (error);
+ g_simple_async_result_take_error (ctx->result, error);
+ initialization_context_complete_and_free (ctx);
+ return;
}
/* Go on to next step */