aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mm-iface-modem.c35
-rw-r--r--src/mm-iface-modem.h8
2 files changed, 43 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;
diff --git a/src/mm-iface-modem.h b/src/mm-iface-modem.h
index 4a3d75b3..d4d9db4f 100644
--- a/src/mm-iface-modem.h
+++ b/src/mm-iface-modem.h
@@ -57,6 +57,14 @@ struct _MMIfaceModem {
GAsyncResult *res,
GError **error);
+ /* Asynchronous modem power-down operation run during initialization */
+ void (*modem_init_power_down) (MMIfaceModem *self,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ gboolean (*modem_init_power_down_finish) (MMIfaceModem *self,
+ GAsyncResult *res,
+ GError **error);
+
/* Loading of the Manufacturer property */
void (*load_manufacturer) (MMIfaceModem *self,
GAsyncReadyCallback callback,