diff options
-rw-r--r-- | src/mm-iface-modem-simple.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/mm-iface-modem-simple.c b/src/mm-iface-modem-simple.c index bfc0e260..c735ce09 100644 --- a/src/mm-iface-modem-simple.c +++ b/src/mm-iface-modem-simple.c @@ -577,6 +577,7 @@ connect_auth_ready (MMBaseModem *self, ConnectionContext *ctx) { GError *error = NULL; + MMModemState current = MM_MODEM_STATE_UNKNOWN; if (!mm_base_modem_authorize_finish (self, res, &error)) { g_dbus_method_invocation_take_error (ctx->invocation, error); @@ -591,8 +592,18 @@ connect_auth_ready (MMBaseModem *self, return; } - /* Start */ - ctx->step = CONNECTION_STEP_FIRST; + /* We may be able to skip some steps, so check that before doing anything */ + g_object_get (self, + MM_IFACE_MODEM_STATE, ¤t, + NULL); + + if (current >= MM_MODEM_STATE_ENABLED) + ctx->step = CONNECTION_STEP_ENABLE + 1; + else if (current >= MM_MODEM_STATE_DISABLED) + ctx->step = CONNECTION_STEP_UNLOCK_CHECK + 1; + else + ctx->step = CONNECTION_STEP_FIRST; + connection_step (ctx); } |