aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2020-10-09 12:50:49 +0200
committerAleksander Morgado <aleksander@aleksander.es>2020-10-10 15:43:57 +0200
commit135d484501dbf641b51b02033377871100323049 (patch)
tree6576c610817f4925b75d008906ea14285c0bf589
parentc6f38ecac3ed2ac783dbab706c5e155ba7409747 (diff)
iface-modem-location: allow Cell ID only updates
The "Serving System" indications reported via QMI when the device is moving may contain LAC/TAC+CID updates or just CID updates. E.g. this one has "CID 3GPP" (0x1e): Mon Aug 3 11:22:42 2020 daemon.debug [1567]: [/dev/cdc-wdm0] received generic indication (translated)... <<<<<< QMUX: <<<<<< length = 33 <<<<<< flags = 0x80 <<<<<< service = "nas" <<<<<< client = 3 <<<<<< QMI: <<<<<< flags = "indication" <<<<<< transaction = 4512 <<<<<< tlv_length = 21 <<<<<< message = "Serving System" (0x0024) <<<<<< 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 '}' ] <<<<<< TLV: <<<<<< type = "Data Service Capability" (0x11) <<<<<< length = 2 <<<<<< value = 01:0B <<<<<< translated = { [0] = 'lte '} <<<<<< TLV: <<<<<< type = "CID 3GPP" (0x1e) <<<<<< length = 4 <<<<<< value = 14:C2:A8:00 <<<<<< translated = 11059732 And this one has both "CID 3GPP" (0x1e) and "LTE TAC" (0x25): Mon Aug 3 11:23:05 2020 daemon.debug [1567]: [/dev/cdc-wdm0] received generic indication (translated)... <<<<<< QMUX: <<<<<< length = 38 <<<<<< flags = 0x80 <<<<<< service = "nas" <<<<<< client = 3 <<<<<< QMI: <<<<<< flags = "indication" <<<<<< transaction = 4513 <<<<<< tlv_length = 26 <<<<<< message = "Serving System" (0x0024) <<<<<< 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 '}' ] <<<<<< TLV: <<<<<< type = "Data Service Capability" (0x11) <<<<<< length = 2 <<<<<< value = 01:0B <<<<<< translated = { [0] = 'lte '} <<<<<< TLV: <<<<<< type = "CID 3GPP" (0x1e) <<<<<< length = 4 <<<<<< value = 32:36:BC:00 <<<<<< translated = 12334642 <<<<<< TLV: <<<<<< type = "LTE TAC" (0x25) <<<<<< length = 2 <<< We should therefore allow changes only in the CID, maintaining whatever LAC/TAC value we had before.
-rw-r--r--src/mm-broadband-modem-qmi.c2
-rw-r--r--src/mm-iface-modem-3gpp.c8
-rw-r--r--src/mm-iface-modem-location.c26
3 files changed, 25 insertions, 11 deletions
diff --git a/src/mm-broadband-modem-qmi.c b/src/mm-broadband-modem-qmi.c
index 9a1a1e64..8fc5660b 100644
--- a/src/mm-broadband-modem-qmi.c
+++ b/src/mm-broadband-modem-qmi.c
@@ -2668,7 +2668,7 @@ common_process_serving_system_3gpp (MMBroadbandModemQmi *self,
qmi_indication_nas_serving_system_output_get_cid_3gpp (indication_output, &cid, NULL);
}
/* Only update info in the interface if we get something */
- if (cid && (lac || tac))
+ if (cid || lac || tac)
mm_iface_modem_3gpp_update_location (MM_IFACE_MODEM_3GPP (self), lac, tac, cid);
/* request to reload operator info explicitly, so that the new
diff --git a/src/mm-iface-modem-3gpp.c b/src/mm-iface-modem-3gpp.c
index 08006709..b933064e 100644
--- a/src/mm-iface-modem-3gpp.c
+++ b/src/mm-iface-modem-3gpp.c
@@ -1359,9 +1359,9 @@ mm_iface_modem_3gpp_update_access_technologies (MMIfaceModem3gpp *self,
void
mm_iface_modem_3gpp_update_location (MMIfaceModem3gpp *self,
- gulong location_area_code,
- gulong tracking_area_code,
- gulong cell_id)
+ gulong location_area_code,
+ gulong tracking_area_code,
+ gulong cell_id)
{
Private *priv;
MMModem3gppRegistrationState state;
@@ -1380,7 +1380,7 @@ mm_iface_modem_3gpp_update_location (MMIfaceModem3gpp *self,
* where we're registering (loading current registration info after a state
* change to registered), we also allow LAC/CID updates. */
if (REG_STATE_IS_REGISTERED (state) || priv->reloading_registration_info) {
- if ((location_area_code > 0 || tracking_area_code > 0) && cell_id > 0)
+ if (location_area_code || tracking_area_code || cell_id)
mm_iface_modem_location_3gpp_update_lac_tac_ci (MM_IFACE_MODEM_LOCATION (self),
location_area_code,
tracking_area_code,
diff --git a/src/mm-iface-modem-location.c b/src/mm-iface-modem-location.c
index ce307ccb..da78a1ff 100644
--- a/src/mm-iface-modem-location.c
+++ b/src/mm-iface-modem-location.c
@@ -396,9 +396,9 @@ mm_iface_modem_location_3gpp_update_mcc_mnc (MMIfaceModemLocation *self,
void
mm_iface_modem_location_3gpp_update_lac_tac_ci (MMIfaceModemLocation *self,
- gulong location_area_code,
- gulong tracking_area_code,
- gulong cell_id)
+ gulong location_area_code,
+ gulong tracking_area_code,
+ gulong cell_id)
{
MmGdbusModemLocation *skeleton;
LocationContext *ctx;
@@ -414,9 +414,23 @@ mm_iface_modem_location_3gpp_update_lac_tac_ci (MMIfaceModemLocation *self,
guint changed = 0;
g_assert (ctx->location_3gpp != NULL);
- changed += mm_location_3gpp_set_location_area_code (ctx->location_3gpp, location_area_code);
- changed += mm_location_3gpp_set_tracking_area_code (ctx->location_3gpp, tracking_area_code);
- changed += mm_location_3gpp_set_cell_id (ctx->location_3gpp, cell_id);
+
+ /* Update LAC if given, and clear TAC unless a TAC is also given */
+ if (location_area_code) {
+ changed += mm_location_3gpp_set_location_area_code (ctx->location_3gpp, location_area_code);
+ if (!tracking_area_code)
+ changed += mm_location_3gpp_set_tracking_area_code (ctx->location_3gpp, 0);
+ }
+ /* Update TAC if given, and clear LAC unless a LAC is also given */
+ if (tracking_area_code) {
+ changed += mm_location_3gpp_set_tracking_area_code (ctx->location_3gpp, tracking_area_code);
+ if (!location_area_code)
+ changed += mm_location_3gpp_set_location_area_code (ctx->location_3gpp, 0);
+ }
+ /* Cell ID only updated if given. It is assumed that if LAC or TAC are given, CID is also given */
+ if (cell_id)
+ changed += mm_location_3gpp_set_cell_id (ctx->location_3gpp, cell_id);
+
if (changed)
notify_3gpp_location_update (self, skeleton, ctx->location_3gpp);
}