aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mm-iface-modem.c43
-rw-r--r--src/mm-iface-modem.h8
2 files changed, 51 insertions, 0 deletions
diff --git a/src/mm-iface-modem.c b/src/mm-iface-modem.c
index 05f6588d..f0d5b18f 100644
--- a/src/mm-iface-modem.c
+++ b/src/mm-iface-modem.c
@@ -755,6 +755,7 @@ mm_iface_modem_signal_quality_check (MMIfaceModem *self,
typedef enum {
DISABLING_STEP_FIRST,
DISABLING_STEP_FLASH_PORT,
+ DISABLING_STEP_MODEM_POWER_DOWN,
DISABLING_STEP_LAST
} DisablingStep;
@@ -826,6 +827,29 @@ mm_iface_modem_disable_finish (MMIfaceModem *self,
return !g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error);
}
+#undef VOID_REPLY_READY_FN
+#define VOID_REPLY_READY_FN(NAME) \
+ static void \
+ NAME##_ready (MMIfaceModem *self, \
+ GAsyncResult *res, \
+ DisablingContext *ctx) \
+ { \
+ GError *error = NULL; \
+ \
+ MM_IFACE_MODEM_GET_INTERFACE (self)->NAME##_finish (self, res, &error); \
+ if (error) { \
+ g_simple_async_result_take_error (ctx->result, error); \
+ disabling_context_complete_and_free (ctx); \
+ return; \
+ } \
+ \
+ /* Go on to next step */ \
+ ctx->step++; \
+ interface_disabling_step (ctx); \
+ }
+
+VOID_REPLY_READY_FN (modem_power_down)
+
static void
interface_disabling_flash_done (MMSerialPort *port,
GError *error,
@@ -865,6 +889,25 @@ interface_disabling_step (DisablingContext *ctx)
/* Fall down to next step */
ctx->step++;
+ case DISABLING_STEP_MODEM_POWER_DOWN:
+ /* CFUN=0 is dangerous and often will shoot devices in the head (that's
+ * what it's supposed to do). So don't use CFUN=0 by default, but let
+ * specific plugins use it when they know it's safe to do so. For
+ * example, CFUN=0 will often make phones turn themselves off, but some
+ * dedicated devices (ex Sierra WWAN cards) will just turn off their
+ * radio but otherwise still work.
+ */
+ if (MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->modem_power_down &&
+ MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->modem_power_down_finish) {
+ MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->modem_power_down (
+ ctx->self,
+ (GAsyncReadyCallback)modem_power_down_ready,
+ ctx);
+ return;
+ }
+ /* Fall down to next step */
+ ctx->step++;
+
case DISABLING_STEP_LAST:
/* We are done without errors! */
g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE);
diff --git a/src/mm-iface-modem.h b/src/mm-iface-modem.h
index d69dd8fd..ee994cd1 100644
--- a/src/mm-iface-modem.h
+++ b/src/mm-iface-modem.h
@@ -234,6 +234,14 @@ struct _MMIfaceModem {
gboolean (*modem_charset_finish) (MMIfaceModem *self,
GAsyncResult *res,
GError **error);
+
+ /* Asynchronous modem power-down operation */
+ void (*modem_power_down) (MMIfaceModem *self,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ gboolean (*modem_power_down_finish) (MMIfaceModem *self,
+ GAsyncResult *res,
+ GError **error);
};
GType mm_iface_modem_get_type (void);