From 3fac73a113bcfcca6a68ac24f44c15e0d1ea0d2d Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Fri, 17 Dec 2021 11:16:54 +0100 Subject: iface-modem-simple: explicit short wait after enabling When we have just enabled, we want to give it some time before starting the registration process, so that any pending registration update that may have been scheduled during the enabling phase is applied. We don't want to trigger a new automatic registration if e.g. we're already registered. --- src/mm-iface-modem-simple.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src') diff --git a/src/mm-iface-modem-simple.c b/src/mm-iface-modem-simple.c index 57ee18ed..e7746f54 100644 --- a/src/mm-iface-modem-simple.c +++ b/src/mm-iface-modem-simple.c @@ -215,6 +215,7 @@ typedef enum { CONNECTION_STEP_WAIT_FOR_INITIALIZED, CONNECTION_STEP_ENABLE, CONNECTION_STEP_WAIT_FOR_ENABLED, + CONNECTION_STEP_WAIT_AFTER_ENABLED, CONNECTION_STEP_REGISTER, CONNECTION_STEP_BEARER, CONNECTION_STEP_CONNECT, @@ -331,6 +332,15 @@ register_in_3gpp_or_cdma_network_ready (MMIfaceModemSimple *self, connection_step (ctx); } +static gboolean +wait_after_enabled_ready (ConnectionContext *ctx) +{ + /* Just go on now */ + ctx->step++; + connection_step (ctx); + return G_SOURCE_REMOVE; +} + static void wait_for_enabled_ready (MMIfaceModem *self, GAsyncResult *res, @@ -561,6 +571,17 @@ connection_step (ConnectionContext *ctx) ctx); return; + case CONNECTION_STEP_WAIT_AFTER_ENABLED: + mm_obj_info (ctx->self, "simple connect state (%d/%d): wait after enabled", + ctx->step, CONNECTION_STEP_LAST); + /* When we have just enabled, we want to give it some time before starting + * the registration process, so that any pending registration update that may + * have been scheduled during the enabling phase is applied. We don't want to + * trigger a new automatic registration if e.g. we're already registered. */ + g_timeout_add (100, (GSourceFunc)wait_after_enabled_ready, ctx); + return; + + case CONNECTION_STEP_REGISTER: mm_obj_info (ctx->self, "simple connect state (%d/%d): register", ctx->step, CONNECTION_STEP_LAST); -- cgit v1.2.3-70-g09d2