aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mm-broadband-modem.c13
-rw-r--r--src/mm-iface-modem.c80
-rw-r--r--src/mm-iface-modem.h3
3 files changed, 62 insertions, 34 deletions
diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c
index 0afca140..adc285e9 100644
--- a/src/mm-broadband-modem.c
+++ b/src/mm-broadband-modem.c
@@ -121,6 +121,7 @@ enum {
PROP_MODEM_SIM_HOT_SWAP_SUPPORTED,
PROP_MODEM_SIM_HOT_SWAP_CONFIGURED,
PROP_MODEM_PERIODIC_SIGNAL_CHECK_DISABLED,
+ PROP_MODEM_PERIODIC_ACCESS_TECH_CHECK_DISABLED,
PROP_MODEM_PERIODIC_CALL_LIST_CHECK_DISABLED,
PROP_MODEM_CARRIER_CONFIG_MAPPING,
PROP_FLOW_CONTROL,
@@ -144,6 +145,7 @@ struct _MMBroadbandModemPrivate {
gboolean sim_hot_swap_supported;
gboolean sim_hot_swap_configured;
gboolean periodic_signal_check_disabled;
+ gboolean periodic_access_tech_check_disabled;
/*<--- Modem interface --->*/
/* Properties */
@@ -11763,6 +11765,9 @@ set_property (GObject *object,
case PROP_MODEM_PERIODIC_SIGNAL_CHECK_DISABLED:
self->priv->periodic_signal_check_disabled = g_value_get_boolean (value);
break;
+ case PROP_MODEM_PERIODIC_ACCESS_TECH_CHECK_DISABLED:
+ self->priv->periodic_access_tech_check_disabled = g_value_get_boolean (value);
+ break;
case PROP_MODEM_PERIODIC_CALL_LIST_CHECK_DISABLED:
self->priv->periodic_call_list_check_disabled = g_value_get_boolean (value);
break;
@@ -11892,6 +11897,9 @@ get_property (GObject *object,
case PROP_MODEM_PERIODIC_SIGNAL_CHECK_DISABLED:
g_value_set_boolean (value, self->priv->periodic_signal_check_disabled);
break;
+ case PROP_MODEM_PERIODIC_ACCESS_TECH_CHECK_DISABLED:
+ g_value_set_boolean (value, self->priv->periodic_access_tech_check_disabled);
+ break;
case PROP_MODEM_PERIODIC_CALL_LIST_CHECK_DISABLED:
g_value_set_boolean (value, self->priv->periodic_call_list_check_disabled);
break;
@@ -11934,6 +11942,7 @@ mm_broadband_modem_init (MMBroadbandModem *self)
self->priv->current_sms_mem2_storage = MM_SMS_STORAGE_UNKNOWN;
self->priv->sim_hot_swap_supported = FALSE;
self->priv->periodic_signal_check_disabled = FALSE;
+ self->priv->periodic_access_tech_check_disabled = FALSE;
self->priv->periodic_call_list_check_disabled = FALSE;
self->priv->modem_cmer_enable_mode = MM_3GPP_CMER_MODE_NONE;
self->priv->modem_cmer_disable_mode = MM_3GPP_CMER_MODE_NONE;
@@ -12468,6 +12477,10 @@ mm_broadband_modem_class_init (MMBroadbandModemClass *klass)
MM_IFACE_MODEM_PERIODIC_SIGNAL_CHECK_DISABLED);
g_object_class_override_property (object_class,
+ PROP_MODEM_PERIODIC_ACCESS_TECH_CHECK_DISABLED,
+ MM_IFACE_MODEM_PERIODIC_ACCESS_TECH_CHECK_DISABLED);
+
+ g_object_class_override_property (object_class,
PROP_MODEM_PERIODIC_CALL_LIST_CHECK_DISABLED,
MM_IFACE_MODEM_VOICE_PERIODIC_CALL_LIST_CHECK_DISABLED);
diff --git a/src/mm-iface-modem.c b/src/mm-iface-modem.c
index d708f78c..4247a7e3 100644
--- a/src/mm-iface-modem.c
+++ b/src/mm-iface-modem.c
@@ -1142,18 +1142,24 @@ typedef enum {
typedef struct {
gboolean enabled;
- guint interval;
- guint initial_retries;
guint timeout_source;
+ /* We first attempt an initial loading, and once it's done we
+ * setup polling */
+ guint initial_retries;
+ gboolean initial_check_done;
+
/* Values polled in this iteration */
guint signal_quality;
MMModemAccessTechnology access_technologies;
guint access_technologies_mask;
- /* If both these are unset we'll automatically stop polling */
+ /* If both signal and access tech polling are either unsupported
+ * or disabled, we'll automatically stop polling */
gboolean signal_quality_polling_supported;
+ gboolean signal_quality_polling_disabled;
gboolean access_technology_polling_supported;
+ gboolean access_technology_polling_disabled;
/* Steps triggered when polling active */
SignalCheckStep running_step;
@@ -1194,6 +1200,12 @@ get_signal_check_context (MMIfaceModem *self)
ctx->signal_quality_polling_supported = (MM_IFACE_MODEM_GET_INTERFACE (self)->load_signal_quality &&
MM_IFACE_MODEM_GET_INTERFACE (self)->load_signal_quality_finish);
+ /* Get plugin-specific setup for the polling logic */
+ g_object_get (self,
+ MM_IFACE_MODEM_PERIODIC_SIGNAL_CHECK_DISABLED, &ctx->signal_quality_polling_disabled,
+ MM_IFACE_MODEM_PERIODIC_ACCESS_TECH_CHECK_DISABLED, &ctx->access_technology_polling_disabled,
+ NULL);
+
g_object_set_qdata_full (G_OBJECT (self), signal_check_context_quark,
ctx, (GDestroyNotify) signal_check_context_free);
}
@@ -1274,7 +1286,6 @@ 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);
@@ -1288,7 +1299,8 @@ peridic_signal_check_step (MMIfaceModem *self)
ctx->running_step++;
case SIGNAL_CHECK_STEP_SIGNAL_QUALITY:
- if (ctx->enabled && ctx->signal_quality_polling_supported) {
+ if (ctx->enabled && ctx->signal_quality_polling_supported &&
+ (!ctx->initial_check_done || !ctx->signal_quality_polling_disabled)) {
MM_IFACE_MODEM_GET_INTERFACE (self)->load_signal_quality (
self, (GAsyncReadyCallback)signal_quality_check_ready, NULL);
return;
@@ -1297,7 +1309,8 @@ peridic_signal_check_step (MMIfaceModem *self)
ctx->running_step++;
case SIGNAL_CHECK_STEP_ACCESS_TECHNOLOGIES:
- if (ctx->enabled && ctx->access_technology_polling_supported) {
+ if (ctx->enabled && ctx->access_technology_polling_supported &&
+ (!ctx->initial_check_done || !ctx->access_technology_polling_disabled)) {
MM_IFACE_MODEM_GET_INTERFACE (self)->load_access_technologies (
self, (GAsyncReadyCallback)access_technologies_check_ready, NULL);
return;
@@ -1312,7 +1325,7 @@ peridic_signal_check_step (MMIfaceModem *self)
/* If we have been disabled while we were running the steps, we don't
* do anything else. */
if (!ctx->enabled) {
- mm_dbg ("Periodic signal checks not rescheduled: disabled");
+ mm_dbg ("Periodic signal quality and access technology checks not rescheduled: disabled");
return;
}
@@ -1321,45 +1334,38 @@ peridic_signal_check_step (MMIfaceModem *self)
* quality and access technology values. As soon as we get them, OR if
* we made too many retries at a high frequency, we fallback to the
* slower polling. */
- if (ctx->interval == SIGNAL_CHECK_INITIAL_TIMEOUT_SEC) {
+ if (!ctx->initial_check_done) {
gboolean signal_quality_ready;
gboolean access_technology_ready;
- gboolean initial_check_done;
/* Signal quality is ready if unsupported or if we got a valid
* value reported */
signal_quality_ready = (!ctx->signal_quality_polling_supported || (ctx->signal_quality != 0));
+
/* Access technology is ready if unsupported or if we got a valid
* value reported */
access_technology_ready = (!ctx->access_technology_polling_supported ||
((ctx->access_technologies & ctx->access_technologies_mask) != MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN));
- initial_check_done = ((signal_quality_ready && access_technology_ready) ||
- (--ctx->initial_retries == 0));
- if (initial_check_done) {
- /* 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);
- ctx->interval = SIGNAL_CHECK_TIMEOUT_SEC;
- }
+ ctx->initial_check_done = ((signal_quality_ready && access_technology_ready) || (--ctx->initial_retries == 0));
}
- /* 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 || periodic_signal_check_disabled)) {
- mm_dbg ("Periodic signal and access technologies checks not supported");
+ /* After running the initial check, if both signal quality and access tech
+ * loading are either disabled or unsupported, we'll stop polling completely,
+ * because they may be loaded asynchronously by unsolicited messages */
+ if (ctx->initial_check_done &&
+ (!ctx->signal_quality_polling_supported || ctx->signal_quality_polling_disabled) &&
+ (!ctx->access_technology_polling_supported || ctx->access_technology_polling_disabled)) {
+ mm_dbg ("Periodic signal quality and access technology checks not rescheduled: unneeded or unsupported");
periodic_signal_check_disable (self, FALSE);
return;
}
- mm_dbg ("Periodic signal quality checks scheduled in %ds", ctx->interval);
+ mm_dbg ("Periodic signal quality and access technology checks scheduled");
g_assert (!ctx->timeout_source);
- ctx->timeout_source = g_timeout_add_seconds (ctx->interval, (GSourceFunc) periodic_signal_check_cb, self);
+ ctx->timeout_source = g_timeout_add_seconds (ctx->initial_check_done ? SIGNAL_CHECK_TIMEOUT_SEC : SIGNAL_CHECK_INITIAL_TIMEOUT_SEC,
+ (GSourceFunc) periodic_signal_check_cb,
+ self);
return;
}
}
@@ -1414,8 +1420,8 @@ mm_iface_modem_refresh_signal (MMIfaceModem *self)
/* Reset refresh rate and initial retries when we're asked to refresh signal
* so that we poll at a higher frequency */
- ctx->interval = SIGNAL_CHECK_INITIAL_TIMEOUT_SEC;
- ctx->initial_retries = SIGNAL_CHECK_INITIAL_RETRIES;
+ ctx->initial_retries = SIGNAL_CHECK_INITIAL_RETRIES;
+ ctx->initial_check_done = FALSE;
/* Start sequence */
periodic_signal_check_cb (self);
@@ -1469,7 +1475,7 @@ periodic_signal_check_enable (MMIfaceModem *self)
ctx->enabled = TRUE;
}
- /* And refresh, which will trigger the first check at high frequency*/
+ /* And refresh, which will trigger the first check at high frequency */
mm_iface_modem_refresh_signal (self);
}
@@ -5695,8 +5701,16 @@ iface_modem_init (gpointer g_iface)
g_object_interface_install_property
(g_iface,
g_param_spec_boolean (MM_IFACE_MODEM_PERIODIC_SIGNAL_CHECK_DISABLED,
- "Periodic signal check disabled",
- "Whether periodic signal check is disabled.",
+ "Periodic signal quality check disabled",
+ "Whether periodic signal quality check is disabled.",
+ FALSE,
+ G_PARAM_READWRITE));
+
+ g_object_interface_install_property
+ (g_iface,
+ g_param_spec_boolean (MM_IFACE_MODEM_PERIODIC_ACCESS_TECH_CHECK_DISABLED,
+ "Periodic access technology check disabled",
+ "Whether periodic access technology check is disabled.",
FALSE,
G_PARAM_READWRITE));
diff --git a/src/mm-iface-modem.h b/src/mm-iface-modem.h
index 9df39030..c4aba7aa 100644
--- a/src/mm-iface-modem.h
+++ b/src/mm-iface-modem.h
@@ -38,8 +38,9 @@
#define MM_IFACE_MODEM_BEARER_LIST "iface-modem-bearer-list"
#define MM_IFACE_MODEM_SIM_HOT_SWAP_SUPPORTED "iface-modem-sim-hot-swap-supported"
#define MM_IFACE_MODEM_SIM_HOT_SWAP_CONFIGURED "iface-modem-sim-hot-swap-configured"
-#define MM_IFACE_MODEM_PERIODIC_SIGNAL_CHECK_DISABLED "iface-modem-periodic-signal-check-disabled"
#define MM_IFACE_MODEM_CARRIER_CONFIG_MAPPING "iface-modem-carrier-config-mapping"
+#define MM_IFACE_MODEM_PERIODIC_SIGNAL_CHECK_DISABLED "iface-modem-periodic-signal-check-disabled"
+#define MM_IFACE_MODEM_PERIODIC_ACCESS_TECH_CHECK_DISABLED "iface-modem-periodic-access-tech-check-disabled"
typedef struct _MMIfaceModem MMIfaceModem;