d/patches: Add patches to enable unsolicited signal strength indication

Without that, ModemManager resorts to battery unfriendly periodic polling.
parent 1098cccb
Pipeline #61729 passed with stages
in 17 minutes and 34 seconds
From 008c4d71490887da63c2d389659c2e19fb1426f0 Mon Sep 17 00:00:00 2001
From: Aleksander Morgado <aleksander@aleksander.es>
Date: Tue, 1 Dec 2020 22:55:56 +0100
Subject: [PATCH] broadband-modem-qmi: fix disabling of signal strength events
Attempting to disable the signal strength events was failing because
the protocol handler expects a valid set of thresholds also during the
disabling. So, just pass always the thresholds.
ModemManager[274522]: [/dev/cdc-wdm1] sent generic request (translated)...
<<<<<< QMUX:
<<<<<< length = 17
<<<<<< flags = 0x00
<<<<<< service = "nas"
<<<<<< client = 3
<<<<<< QMI:
<<<<<< flags = "none"
<<<<<< transaction = 7
<<<<<< tlv_length = 5
<<<<<< message = "Set Event Report" (0x0002)
<<<<<< TLV:
<<<<<< type = "Signal Strength Indicator" (0x10)
<<<<<< length = 2
<<<<<< value = 00:00
<<<<<< translated = [ report = 'no' thresholds = '{}' ]
ModemManager[274522]: [/dev/cdc-wdm1] received generic response (translated)...
<<<<<< QMUX:
<<<<<< length = 19
<<<<<< flags = 0x80
<<<<<< service = "nas"
<<<<<< client = 3
<<<<<< QMI:
<<<<<< flags = "response"
<<<<<< transaction = 7
<<<<<< tlv_length = 7
<<<<<< message = "Set Event Report" (0x0002)
<<<<<< TLV:
<<<<<< type = "Result" (0x02)
<<<<<< length = 4
<<<<<< value = 01:00:08:00
<<<<<< translated = FAILURE: NoThresholdsProvided
---
src/mm-broadband-modem-qmi.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
--- a/src/mm-broadband-modem-qmi.c
+++ b/src/mm-broadband-modem-qmi.c
@@ -4847,9 +4847,9 @@
/* Prepare thresholds, separated 20 each */
thresholds = g_array_sized_new (FALSE, FALSE, sizeof (gint8), G_N_ELEMENTS (thresholds_data));
- /* Only set thresholds during enable */
- if (ctx->enable)
- g_array_append_vals (thresholds, thresholds_data, G_N_ELEMENTS (thresholds_data));
+ /* Always set thresholds, both in enable and disable, or otherwise the protocol will
+ * complain with FAILURE: NoThresholdsProvided */
+ g_array_append_vals (thresholds, thresholds_data, G_N_ELEMENTS (thresholds_data));
qmi_message_nas_set_event_report_input_set_signal_strength_indicator (
input,
From 2a743d5b109079cd07ed5afa55fb9a79ccb8d155 Mon Sep 17 00:00:00 2001
From: Aleksander Morgado <aleksander@aleksander.es>
Date: Tue, 1 Dec 2020 22:59:32 +0100
Subject: [PATCH] broadband-modem-qmi: fix reporting of signal strength
indications
We had all the logic in place... but we were never actually enabling
the signal strength indications because the `enable` flag in the
context was never set.
The bug was introduced back in May 2018, and released with 1.10.0.
Fixes baefe53ab9c0ea0612d2bf7da64b6f6cf9753bcd
(cherry picked from commit 12dd53a12e81e4f4752ded5579a52751141461ca)
---
src/mm-broadband-modem-qmi.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/mm-broadband-modem-qmi.c b/src/mm-broadband-modem-qmi.c
index 5e99deb1b..ae27b333c 100644
--- a/src/mm-broadband-modem-qmi.c
+++ b/src/mm-broadband-modem-qmi.c
@@ -5013,6 +5013,7 @@ common_enable_disable_unsolicited_events (MMBroadbandModemQmi *self,
}
ctx = g_new0 (EnableUnsolicitedEventsContext, 1);
+ ctx->enable = enable;
ctx->client = g_object_ref (client);
g_task_set_task_data (task, ctx, (GDestroyNotify)enable_unsolicited_events_context_free);
--
GitLab
From 6f7a3c6ec6f8fb963c6bec0d7d30cdfccb070b95 Mon Sep 17 00:00:00 2001
From: Aleksander Morgado <aleksander@aleksander.es>
Date: Tue, 1 Dec 2020 23:26:42 +0100
Subject: [PATCH] broadband-modem-qmi: disable signal/access-tech polling if
indications enabled
We can rely on QMI indications when the signal quality and access tech
changes happen, instead of doing explicit polling.
The modem will run the signal quality retrieval once, and then just
rely on indications, with polling disabled:
ModemManager[278759]: <debug> [1606862198.230492] [modem1] signal strength (lte): -79 dBm
ModemManager[278759]: <debug> [1606862198.230520] [modem1] signal strength: -79 dBm --> 55%
ModemManager[278759]: <debug> [1606862198.230583] [modem1] access technology changed (unknown -> lte)
ModemManager[278759]: <debug> [1606862198.230654] [modem1] signal quality updated (55)
ModemManager[278759]: <debug> [1606862198.230675] [modem1] periodic signal quality and access technology checks not rescheduled: unneeded or unsupported
ModemManager[278759]: <debug> [1606862198.230692] [modem1] periodic signal checks disabled
Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/231
---
src/mm-broadband-modem-qmi.c | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
--- a/src/mm-broadband-modem-qmi.c
+++ b/src/mm-broadband-modem-qmi.c
@@ -4813,12 +4813,16 @@
ctx = g_task_get_task_data (task);
output = qmi_client_nas_set_event_report_finish (client, res, &error);
- if (!output) {
- mm_obj_dbg (self, "QMI operation failed: '%s'", error->message);
- g_error_free (error);
- } else if (!qmi_message_nas_set_event_report_output_get_result (output, &error)) {
- mm_obj_dbg (self, "couldn't set event report: '%s'", error->message);
+ if (!output || !qmi_message_nas_set_event_report_output_get_result (output, &error)) {
+ mm_obj_dbg (self, "couldn't enable signal strength indications: '%s'", error->message);
g_error_free (error);
+ } else {
+ /* Disable access technology and signal quality polling if we can use the indications */
+ mm_obj_dbg (self, "signal strength indications enabled: polling disabled");
+ g_object_set (self,
+ MM_IFACE_MODEM_PERIODIC_SIGNAL_CHECK_DISABLED, TRUE,
+ MM_IFACE_MODEM_PERIODIC_ACCESS_TECH_CHECK_DISABLED, TRUE,
+ NULL);
}
if (output)
@@ -4883,12 +4887,16 @@
ctx = g_task_get_task_data (task);
output = qmi_client_nas_register_indications_finish (client, res, &error);
- if (!output) {
- mm_obj_dbg (self, "QMI operation failed: '%s'", error->message);
- g_error_free (error);
- } else if (!qmi_message_nas_register_indications_output_get_result (output, &error)) {
- mm_obj_dbg (self, "couldn't register indications: '%s'", error->message);
+ if (!output || !qmi_message_nas_register_indications_output_get_result (output, &error)) {
+ mm_obj_dbg (self, "couldn't register signal info indications: '%s'", error->message);
g_error_free (error);
+ } else {
+ /* Disable access technology and signal quality polling if we can use the indications */
+ mm_obj_dbg (self, "signal strength indications enabled: polling disabled");
+ g_object_set (self,
+ MM_IFACE_MODEM_PERIODIC_SIGNAL_CHECK_DISABLED, TRUE,
+ MM_IFACE_MODEM_PERIODIC_ACCESS_TECH_CHECK_DISABLED, TRUE,
+ NULL);
}
if (output)
2a743d5b109079cd07ed5afa55fb9a79ccb8d155.patch
008c4d71490887da63c2d389659c2e19fb1426f0.patch
6f7a3c6ec6f8fb963c6bec0d7d30cdfccb070b95.patch
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment