aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2011-11-25 15:02:31 +0100
committerAleksander Morgado <aleksander@lanedo.com>2012-03-15 14:14:27 +0100
commit7fa372d1185dc9ea195d3d7d8b8a5cfffe26963e (patch)
tree60f1842b899f3e1faaa8a10ad648f84c52b054a4 /src
parent0adbd8edadbf3c0a07df59c362977e015481cedb (diff)
iface-modem: allow plugins to send custom commands after power-up
Just after powering up the modem, plugins can run additional setup commands themselves, in a new "after" power-up step.
Diffstat (limited to 'src')
-rw-r--r--src/mm-iface-modem.c14
-rw-r--r--src/mm-iface-modem.h9
2 files changed, 23 insertions, 0 deletions
diff --git a/src/mm-iface-modem.c b/src/mm-iface-modem.c
index 4c58a35c..5e13a0c4 100644
--- a/src/mm-iface-modem.c
+++ b/src/mm-iface-modem.c
@@ -755,6 +755,7 @@ typedef enum {
ENABLING_STEP_FLASH_PORT,
ENABLING_STEP_MODEM_INIT,
ENABLING_STEP_MODEM_POWER_UP,
+ ENABLING_STEP_MODEM_AFTER_POWER_UP,
ENABLING_STEP_LAST
} EnablingStep;
@@ -854,6 +855,7 @@ mm_iface_modem_enable_finish (MMIfaceModem *self,
VOID_REPLY_READY_FN (modem_init);
VOID_REPLY_READY_FN (modem_power_up);
+VOID_REPLY_READY_FN (modem_after_power_up);
static void
interface_enabling_flash_done (MMSerialPort *port,
@@ -928,6 +930,18 @@ interface_enabling_step (EnablingContext *ctx)
/* Fall down to next step */
ctx->step++;
+ case ENABLING_STEP_MODEM_AFTER_POWER_UP:
+ if (MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->modem_after_power_up &&
+ MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->modem_after_power_up_finish) {
+ MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->modem_after_power_up (
+ ctx->self,
+ (GAsyncReadyCallback)modem_after_power_up_ready,
+ ctx);
+ return;
+ }
+ /* Fall down to next step */
+ ctx->step++;
+
case ENABLING_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 67df959a..cac7b54e 100644
--- a/src/mm-iface-modem.h
+++ b/src/mm-iface-modem.h
@@ -198,6 +198,15 @@ struct _MMIfaceModem {
gboolean (*modem_power_up_finish) (MMIfaceModem *self,
GAsyncResult *res,
GError **error);
+
+ /* Asynchronous additional setup needed after power-up,
+ * Plugins can implement this to provide custom setups. */
+ void (*modem_after_power_up) (MMIfaceModem *self,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ gboolean (*modem_after_power_up_finish) (MMIfaceModem *self,
+ GAsyncResult *res,
+ GError **error);
};
GType mm_iface_modem_get_type (void);