[PATCH] iface-modem: allow initial signal check after the modem is re-enabled

Ben Chan benchan at chromium.org
Wed Apr 25 00:18:56 UTC 2018


Commit 708b00ae3 "modem: allow periodic signal check to be disabled"
added a "iface-modem-periodic-signal-check-disabled" property in
MMIfaceModem/MMBroadbandModem to indicate if the periodic signal check
should be disabled. If the property is set to TRUE, the
signal_quality_polling_supported field of SignalCheckContext is set to
FALSE, which is sticky across modem disable/enable operations. However,
that is undesirable as we would like to issue an initial signal check to
refresh the signal quality value after the modem is re-enabled from a
state when the RF may have been previously turned off.
---
 src/mm-iface-modem.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/src/mm-iface-modem.c b/src/mm-iface-modem.c
index b1224428..11bdf1f6 100644
--- a/src/mm-iface-modem.c
+++ b/src/mm-iface-modem.c
@@ -1222,6 +1222,7 @@ signal_quality_check_ready (MMIfaceModem *self,
 static void
 peridic_signal_check_step (MMIfaceModem *self)
 {
+    gboolean periodic_signal_check_disabled = FALSE;
     SignalCheckContext *ctx;
 
     ctx = get_signal_check_context (self);
@@ -1284,17 +1285,12 @@ peridic_signal_check_step (MMIfaceModem *self)
             initial_check_done = ((signal_quality_ready && access_technology_ready) ||
                                   (--ctx->initial_retries == 0));
             if (initial_check_done) {
-                gboolean periodic_signal_check_disabled = FALSE;
-
+                /* After the initial check is done, check if periodic signal
+                 * check is disabled. */
                 g_object_get (self,
                               MM_IFACE_MODEM_PERIODIC_SIGNAL_CHECK_DISABLED,
                               &periodic_signal_check_disabled,
                               NULL);
-                /* If periodic signal check is disabled, treat it as
-                 * unsupported after the initial check is done. */
-                if (periodic_signal_check_disabled)
-                    ctx->signal_quality_polling_supported = FALSE;
-
                 ctx->interval = SIGNAL_CHECK_TIMEOUT_SEC;
             }
         }
@@ -1302,7 +1298,8 @@ peridic_signal_check_step (MMIfaceModem *self)
         /* If both tasks are unsupported, implicitly disable. Do NOT clear the
          * values, because if we're told they are unsupported it may be that
          * they're really updated via unsolicited messages. */
-        if (!ctx->access_technology_polling_supported && !ctx->signal_quality_polling_supported) {
+        if (!ctx->access_technology_polling_supported &&
+            (!ctx->signal_quality_polling_supported || periodic_signal_check_disabled)) {
             mm_dbg ("Periodic signal and access technologies checks not supported");
             periodic_signal_check_disable (self, FALSE);
             return;
-- 
2.17.0.484.g0c8726318c-goog



More information about the ModemManager-devel mailing list