aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBen Chan <benchan@chromium.org>2018-01-11 23:47:28 -0800
committerAleksander Morgado <aleksander@aleksander.es>2018-01-12 12:24:13 +0100
commitc9e85b67164f81310d1a7ca0bffbb8c938a6a943 (patch)
tree2b70da0399176416b034577ac3e803459a72a8de /src
parentd8c7251687dca8c4aca059428d374d06cbdc9e79 (diff)
iface-modem-3gpp: ignore initial registration check result when appropriate
When a modem is being enabled, an initial registration check is scheduled to determine the current registration state and access technology. The initial registration check is performed asynchronously and may not complete before the modem state is transitioned to 'enabled'. When the modem is disabled shortly afterwards, the registration state is transitioned to 'unknown' and the modem state is transitioned to 'disabled'. But the completion of the initial registration check after that can transition the registration state and modem state to a wrong state. This patch addresses the issue by ignoring a registration state update if the modem isn't already enabled or being enabled.
Diffstat (limited to 'src')
-rw-r--r--src/mm-iface-modem-3gpp.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/mm-iface-modem-3gpp.c b/src/mm-iface-modem-3gpp.c
index e1a61ced..f5abc092 100644
--- a/src/mm-iface-modem-3gpp.c
+++ b/src/mm-iface-modem-3gpp.c
@@ -1205,10 +1205,28 @@ update_registration_state (MMIfaceModem3gpp *self,
new_state == MM_MODEM_3GPP_REGISTRATION_STATE_ROAMING_SMS_ONLY ||
new_state == MM_MODEM_3GPP_REGISTRATION_STATE_HOME_CSFB_NOT_PREFERRED ||
new_state == MM_MODEM_3GPP_REGISTRATION_STATE_ROAMING_CSFB_NOT_PREFERRED) {
+ MMModemState modem_state;
+
/* If already reloading registration info, skip it */
if (ctx->reloading_registration_info)
return;
+ /* If the modem isn't already enabled or being enabled, this
+ * registration state update is due to a previously scheduled
+ * initial registration check when the modem was being enabled.
+ * We need to ignore it as otherwise it may cause an incorrect
+ * transition of the registration state and modem state when the
+ * modem is being disabled. */
+ modem_state = MM_MODEM_STATE_UNKNOWN;
+ g_object_get (self,
+ MM_IFACE_MODEM_STATE, &modem_state,
+ NULL);
+ if (modem_state < MM_MODEM_STATE_ENABLING) {
+ mm_dbg ("Modem %s: 3GPP Registration state change ignored as modem isn't enabled",
+ g_dbus_object_get_object_path (G_DBUS_OBJECT (self)));
+ return;
+ }
+
mm_info ("Modem %s: 3GPP Registration state changed (%s -> registering)",
g_dbus_object_get_object_path (G_DBUS_OBJECT (self)),
mm_modem_3gpp_registration_state_get_string (old_state));