From 3d4dd64dd03622ae5d335f0111c54e184de120c7 Mon Sep 17 00:00:00 2001 From: Aleksander Morgado 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]: [1606862198.230492] [modem1] signal strength (lte): -79 dBm ModemManager[278759]: [1606862198.230520] [modem1] signal strength: -79 dBm --> 55% ModemManager[278759]: [1606862198.230583] [modem1] access technology changed (unknown -> lte) ModemManager[278759]: [1606862198.230654] [modem1] signal quality updated (55) ModemManager[278759]: [1606862198.230675] [modem1] periodic signal quality and access technology checks not rescheduled: unneeded or unsupported ModemManager[278759]: [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(-) diff --git a/src/mm-broadband-modem-qmi.c b/src/mm-broadband-modem-qmi.c index a6442a99..d161d96e 100644 --- a/src/mm-broadband-modem-qmi.c +++ b/src/mm-broadband-modem-qmi.c @@ -4781,7 +4781,15 @@ ser_signal_strength_ready (QmiClientNas *client, output = qmi_client_nas_set_event_report_finish (client, res, &error); if (!output || !qmi_message_nas_set_event_report_output_get_result (output, &error)) - mm_obj_dbg (self, "couldn't set event report: '%s'", error->message); + mm_obj_dbg (self, "couldn't enable signal strength indications: '%s'", error->message); + 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 (!ctx->client_wds) { g_task_return_boolean (task, TRUE); @@ -4842,7 +4850,15 @@ ri_signal_info_ready (QmiClientNas *client, output = qmi_client_nas_register_indications_finish (client, res, &error); if (!output || !qmi_message_nas_register_indications_output_get_result (output, &error)) - mm_obj_dbg (self, "couldn't register indications: '%s'", error->message); + mm_obj_dbg (self, "couldn't register signal info indications: '%s'", error->message); + 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 (!ctx->client_wds) { g_task_return_boolean (task, TRUE);