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
This commit is contained in:
Aleksander Morgado
2013-04-19 08:34:40 +02:00
parent 92035fdf1c
commit aa4fd7c421

View File

@@ -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 */