aboutsummaryrefslogtreecommitdiff
path: root/src/mm-iface-modem.c
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2012-09-18 16:09:54 +0200
committerAleksander Morgado <aleksander@lanedo.com>2012-10-01 16:40:51 +0200
commit77208f66ab4ad3c8401b2fe62c93915a5b944331 (patch)
treeda7f7474376f38a5a5c4a8e0c3941999f51228f4 /src/mm-iface-modem.c
parentb622424d2fdcd1f455c3ecbc86a7624a39050f2d (diff)
iface-modem: ensure we're in low power mode when initializing
The power-down command defined by the plugin will be run *only* after having checked for current and modem capabilities, as plugins (e.g. Sierra) may have different commands for that depending on whether they are 3GPP or 3GPP2. We do not reuse the 'modem_power_down' callback from the disabling sequence, as some plugins really behave pretty badly with this (e.g. Samsung CFUN=4 may take up to 30s to complete). So, we let plugins use the power-down command when disabling but avoid launching it during init.
Diffstat (limited to 'src/mm-iface-modem.c')
-rw-r--r--src/mm-iface-modem.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/mm-iface-modem.c b/src/mm-iface-modem.c
index 258a35c8..41036a26 100644
--- a/src/mm-iface-modem.c
+++ b/src/mm-iface-modem.c
@@ -2941,6 +2941,7 @@ typedef enum {
INITIALIZATION_STEP_FIRST,
INITIALIZATION_STEP_CURRENT_CAPABILITIES,
INITIALIZATION_STEP_MODEM_CAPABILITIES,
+ INITIALIZATION_STEP_POWER_DOWN,
INITIALIZATION_STEP_BEARERS,
INITIALIZATION_STEP_MANUFACTURER,
INITIALIZATION_STEP_MODEL,
@@ -3073,6 +3074,26 @@ initialization_context_complete_and_free_if_cancelled (InitializationContext *ct
UINT_REPLY_READY_FN (current_capabilities, "Current Capabilities", TRUE)
UINT_REPLY_READY_FN (modem_capabilities, "Modem Capabilities", FALSE)
+
+static void
+initialization_modem_power_down_ready (MMIfaceModem *self,
+ GAsyncResult *res,
+ InitializationContext *ctx)
+{
+ GError *error = NULL;
+
+ MM_IFACE_MODEM_GET_INTERFACE (self)->modem_init_power_down_finish (self, res, &error);
+ if (error) {
+ mm_dbg ("Couldn't power down the modem during initialization: '%s'", error->message);
+ g_error_free (error);
+ } else
+ mm_dbg ("Modem initially powered down...");
+
+ /* Go on to next step */
+ ctx->step++;
+ interface_initialization_step (ctx);
+}
+
STR_REPLY_READY_FN (manufacturer, "Manufacturer")
STR_REPLY_READY_FN (model, "Model")
STR_REPLY_READY_FN (revision, "Revision")
@@ -3323,6 +3344,20 @@ interface_initialization_step (InitializationContext *ctx)
/* Fall down to next step */
ctx->step++;
+ case INITIALIZATION_STEP_POWER_DOWN:
+ /* We run the power down command during initialization, to ensure we
+ * start with radio off, when possible */
+ if (MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->modem_init_power_down &&
+ MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->modem_init_power_down_finish) {
+ MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->modem_init_power_down (
+ ctx->self,
+ (GAsyncReadyCallback)initialization_modem_power_down_ready,
+ ctx);
+ return;
+ }
+ /* Fall down to next step */
+ ctx->step++;
+
case INITIALIZATION_STEP_BEARERS: {
MMBearerList *list = NULL;