From 5b568e97f8126879099c349486465cc9f14f64e5 Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Thu, 15 Oct 2015 10:07:08 +0200 Subject: [PATCH] iface-modem-3gpp: allow LAC/CID updates reported while registering When changing from idle to registered we'll load registration info before really reporting that we're registered (so that clients can get the new registration info directly). During this time, we should also allow LAC/CID updates triggered in the location interface. E.g. when receiving this QMI message, we're not processing LAC/CID because when they get reported, the registration state was not yet 'registered': [/dev/cdc-wdm0] Received message (translated)... >>>>>> QMUX: >>>>>> length = 67 >>>>>> flags = 0x80 >>>>>> service = "nas" >>>>>> client = 1 >>>>>> QMI: >>>>>> flags = "indication" >>>>>> transaction = 0 >>>>>> tlv_length = 55 >>>>>> message = "Serving System" (0x0024) >>>>>> TLV: >>>>>> type = "MNC PCS Digit Include Status" (0x29) >>>>>> length = 5 >>>>>> value = D6:00:01:00:00 >>>>>> translated = [ mcc = '214' mnc = '1' includes_pcs_digit = 'no' ] >>>>>> TLV: >>>>>> type = "LTE TAC" (0x25) >>>>>> length = 2 >>>>>> value = 08:01 >>>>>> translated = 264 >>>>>> TLV: >>>>>> type = "Detailed Service Status" (0x22) >>>>>> length = 5 >>>>>> value = 02:03:00:01:00 >>>>>> translated = [ status = 'available' capability = 'cs-ps' hdr_status = 'none' hdr_hybrid = 'yes' forbidden = 'no' ] >>>>>> TLV: >>>>>> type = "CID 3GPP" (0x1e) >>>>>> length = 4 >>>>>> value = 01:A1:4D:04 >>>>>> translated = 72196353 >>>>>> TLV: >>>>>> type = "LAC 3GPP" (0x1d) >>>>>> length = 2 >>>>>> value = FE:FF >>>>>> translated = 65534 >>>>>> TLV: >>>>>> type = "Current PLMN" (0x12) >>>>>> length = 5 >>>>>> value = D6:00:01:00:00 >>>>>> translated = [ mcc = '214' mnc = '1' description = '' ] >>>>>> TLV: >>>>>> type = "Data Service Capability" (0x11) >>>>>> length = 2 >>>>>> value = 01:0B >>>>>> translated = { [0] = 'lte '} >>>>>> TLV: >>>>>> type = "Serving System" (0x01) >>>>>> length = 6 >>>>>> value = 01:01:01:02:01:08 >>>>>> translated = [ registration_state = 'registered' cs_attach_state = 'attached' ps_attach_state = 'attached' selected_network = '3gpp' radio_interfaces = '{ [0] = 'lte '}' ] [1444895382.427216] Processing 3GPP info... [1444895382.433423] Modem /org/freedesktop/ModemManager1/Modem/3: 3GPP Registration state changed (idle -> registering) [ Here we tried to update LAC/CID ] [1444895382.439668] Modem /org/freedesktop/ModemManager1/Modem/3: 3GPP location updated (MCC: '214', MNC: '1', Location area code: '0', Cell ID: '0') [1444895382.446788] Modem /org/freedesktop/ModemManager1/Modem/3: 3GPP Registration state changed (registering -> home) [1444895382.452383] Modem /org/freedesktop/ModemManager1/Modem/3: state changed (enabled -> registered) --- src/mm-iface-modem-3gpp.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/mm-iface-modem-3gpp.c b/src/mm-iface-modem-3gpp.c index c8f3c2e7..409c03f8 100644 --- a/src/mm-iface-modem-3gpp.c +++ b/src/mm-iface-modem-3gpp.c @@ -1052,6 +1052,10 @@ mm_iface_modem_3gpp_update_location (MMIfaceModem3gpp *self, gulong cell_id) { MMModem3gppRegistrationState state; + RegistrationStateContext *ctx; + + ctx = get_registration_state_context (self); + g_assert (ctx); if (!MM_IS_IFACE_MODEM_LOCATION (self)) return; @@ -1061,8 +1065,11 @@ mm_iface_modem_3gpp_update_location (MMIfaceModem3gpp *self, NULL); /* Even if registration state didn't change, report access technology or - * location updates, but only if something valid to report */ - if (state == MM_MODEM_3GPP_REGISTRATION_STATE_HOME || + * location updates, but only if something valid to report. For the case + * where we're registering (loading current registration info after a state + * change to registered), we also allow LAC/CID updates. */ + if (ctx->reloading_registration_info || + state == MM_MODEM_3GPP_REGISTRATION_STATE_HOME || state == MM_MODEM_3GPP_REGISTRATION_STATE_ROAMING) { if (location_area_code > 0 && cell_id > 0) mm_iface_modem_location_3gpp_update_lac_ci (MM_IFACE_MODEM_LOCATION (self),