From 8340237f9da911ca6ecc58fd6c453e9ea32616d4 Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Fri, 12 Jun 2020 09:17:40 +0200 Subject: [PATCH] broadband-modem-qmi: avoid using stale EPS registration state When the device goes from LTE to UMTS, we must make sure we also always update the EPS registration state as unknown, or the built consolidated state will be wrong. Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/225 --- src/mm-broadband-modem-qmi.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/mm-broadband-modem-qmi.c b/src/mm-broadband-modem-qmi.c index 2926d2fb..e6a05b2c 100644 --- a/src/mm-broadband-modem-qmi.c +++ b/src/mm-broadband-modem-qmi.c @@ -2766,11 +2766,18 @@ common_process_serving_system_3gpp (MMBroadbandModemQmi *self, g_free (new_operator_id); } - /* Report new registration states */ + /* Report new registration states. The QMI serving system API reports "CS" + * and "PS" registration states, and if the device is in LTE, we'll take the "PS" + * one as "EPS". But, if the device is not in LTE, we should also set the "EPS" + * state as unknown, so that the "PS" one takes precedence when building + * the consolidated registration state (otherwise we may be using some old cached + * "EPS" state wrongly). */ mm_iface_modem_3gpp_update_cs_registration_state (MM_IFACE_MODEM_3GPP (self), mm_cs_registration_state); mm_iface_modem_3gpp_update_ps_registration_state (MM_IFACE_MODEM_3GPP (self), mm_ps_registration_state); - if (mm_access_technologies & MM_MODEM_ACCESS_TECHNOLOGY_LTE) - mm_iface_modem_3gpp_update_eps_registration_state (MM_IFACE_MODEM_3GPP (self), mm_ps_registration_state); + if (mm_iface_modem_is_3gpp_lte (MM_IFACE_MODEM (self))) + mm_iface_modem_3gpp_update_eps_registration_state (MM_IFACE_MODEM_3GPP (self), + (mm_access_technologies & MM_MODEM_ACCESS_TECHNOLOGY_LTE) ? + mm_ps_registration_state : MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN); /* Get 3GPP location LAC/TAC and CI */ lac = 0;