[PATCH v2 2/4] iface-modem: if bands, capabilities or modes change, refresh signal

Aleksander Morgado aleksander at aleksander.es
Tue May 30 18:09:56 UTC 2017


We also remove the explicit refresh request from the Cinterion plugin,
as this is a generic action applicable to all modems that require
polling for signal quality and/or access technology.
---
 plugins/cinterion/mm-broadband-modem-cinterion.c | 10 ++--------
 src/mm-iface-modem.c                             | 16 +++++++++++++---
 2 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/plugins/cinterion/mm-broadband-modem-cinterion.c b/plugins/cinterion/mm-broadband-modem-cinterion.c
index d829fe15..5cdb0107 100644
--- a/plugins/cinterion/mm-broadband-modem-cinterion.c
+++ b/plugins/cinterion/mm-broadband-modem-cinterion.c
@@ -852,11 +852,8 @@ allowed_access_technology_update_ready (MMBroadbandModemCinterion *self,
     mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, &error);
     if (error)
         g_task_return_error (task, error);
-    else {
-        /* Request immediate signal update */
-        mm_iface_modem_refresh_signal (MM_IFACE_MODEM (self));
+    else
         g_task_return_boolean (task, TRUE);
-    }
     g_object_unref (task);
 }

@@ -1139,11 +1136,8 @@ scfg_set_ready (MMBaseModem *self,
     if (!mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, &error))
         /* Let the error be critical */
         g_simple_async_result_take_error (operation_result, error);
-    else {
-        /* Request immediate signal update */
-        mm_iface_modem_refresh_signal (MM_IFACE_MODEM (self));
+    else
         g_simple_async_result_set_op_res_gboolean (operation_result, TRUE);
-    }

     g_simple_async_result_complete (operation_result);
     g_object_unref (operation_result);
diff --git a/src/mm-iface-modem.c b/src/mm-iface-modem.c
index 223f2785..7f040d1d 100644
--- a/src/mm-iface-modem.c
+++ b/src/mm-iface-modem.c
@@ -2058,8 +2058,12 @@ set_current_capabilities_ready (MMIfaceModem *self,

     if (!MM_IFACE_MODEM_GET_INTERFACE (self)->set_current_capabilities_finish (self, res, &error))
         g_dbus_method_invocation_take_error (ctx->invocation, error);
-    else
+    else {
+        /* Capabilities updated: explicitly refresh signal and access technology */
+        mm_iface_modem_refresh_signal (self);
         mm_gdbus_modem_complete_set_current_capabilities (ctx->skeleton, ctx->invocation);
+    }
+
     handle_set_current_capabilities_context_free (ctx);
 }

@@ -2436,8 +2440,11 @@ handle_set_current_bands_ready (MMIfaceModem *self,

     if (!mm_iface_modem_set_current_bands_finish (self, res, &error))
         g_dbus_method_invocation_take_error (ctx->invocation, error);
-    else
+    else {
+        /* Bands updated: explicitly refresh signal and access technology */
+        mm_iface_modem_refresh_signal (self);
         mm_gdbus_modem_complete_set_current_bands (ctx->skeleton, ctx->invocation);
+    }

     handle_set_current_bands_context_free (ctx);
 }
@@ -2752,8 +2759,11 @@ handle_set_current_modes_ready (MMIfaceModem *self,

     if (!mm_iface_modem_set_current_modes_finish (self, res, &error))
         g_dbus_method_invocation_take_error (ctx->invocation, error);
-    else
+    else {
+        /* Modes updated: explicitly refresh signal and access technology */
+        mm_iface_modem_refresh_signal (self);
         mm_gdbus_modem_complete_set_current_modes (ctx->skeleton, ctx->invocation);
+    }

     handle_set_current_modes_context_free (ctx);
 }
--
2.13.0


More information about the ModemManager-devel mailing list