summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2013-04-19 08:34:40 +0200
committerAleksander Morgado <aleksander@lanedo.com>2013-04-19 09:37:20 +0200
commitaa4fd7c421776c33f0955517eb441fa2a14d6401 (patch)
treee1549b07461c10e793aeb492cf0e2b43d1216ef3
parent92035fdf1c39c9e1bf8b7d419d913e85bc8e1a44 (diff)
downloadModemManager-aa4fd7c421776c33f0955517eb441fa2a14d6401.tar.gz
broadband-modem-mbim: don't make no-SIM errors directly fatal, retry instead
The MC7710 will report a MBIM_SUBSCRIBER_READY_STATE_SIM_NOT_INSERTED status when initializing and the SIM is not ready yet. So retry a couple of times as we do for MBIM_SUBSCRIBER_READY_STATE_NOT_INITIALIZED. If all retries are consumed, get the last reported status to build the error. This change makes all modems without SIM require up to 10s to get fully initialized and exposed in DBus; but it shouldn't be a big deal as the modems are unusable anyway. https://bugzilla.gnome.org/show_bug.cgi?id=698264
-rw-r--r--src/mm-broadband-modem-mbim.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/mm-broadband-modem-mbim.c b/src/mm-broadband-modem-mbim.c
index 823528c5e..131033175 100644
--- a/src/mm-broadband-modem-mbim.c
+++ b/src/mm-broadband-modem-mbim.c
@@ -527,7 +527,8 @@ unlock_required_subscriber_ready_state_ready (MbimDevice *device,
/* Don't set error */
break;
case MBIM_SUBSCRIBER_READY_STATE_SIM_NOT_INSERTED:
- error = mm_mobile_equipment_error_for_code (MM_MOBILE_EQUIPMENT_ERROR_SIM_NOT_INSERTED);
+ /* This is an error, but we still want to retry.
+ * The MC7710 may use this while the SIM is not ready yet. */
break;
case MBIM_SUBSCRIBER_READY_STATE_BAD_SIM:
error = mm_mobile_equipment_error_for_code (MM_MOBILE_EQUIPMENT_ERROR_SIM_WRONG);
@@ -546,12 +547,19 @@ unlock_required_subscriber_ready_state_ready (MbimDevice *device,
load_unlock_required_context_complete_and_free (ctx);
}
/* Need to retry? */
- else if (ready_state == MBIM_SUBSCRIBER_READY_STATE_NOT_INITIALIZED) {
+ else if (ready_state == MBIM_SUBSCRIBER_READY_STATE_NOT_INITIALIZED ||
+ ready_state == MBIM_SUBSCRIBER_READY_STATE_SIM_NOT_INSERTED) {
if (--ctx->n_ready_status_checks == 0) {
- g_simple_async_result_set_error (ctx->result,
- MM_CORE_ERROR,
- MM_CORE_ERROR_FAILED,
- "Error waiting for SIM to get initialized");
+ /* All retries consumed, issue error */
+ if (ready_state == MBIM_SUBSCRIBER_READY_STATE_SIM_NOT_INSERTED)
+ g_simple_async_result_take_error (
+ ctx->result,
+ mm_mobile_equipment_error_for_code (MM_MOBILE_EQUIPMENT_ERROR_SIM_NOT_INSERTED));
+ else
+ g_simple_async_result_set_error (ctx->result,
+ MM_CORE_ERROR,
+ MM_CORE_ERROR_FAILED,
+ "Error waiting for SIM to get initialized");
load_unlock_required_context_complete_and_free (ctx);
} else {
/* Retry */