aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2011-11-25 14:59:53 +0100
committerAleksander Morgado <aleksander@lanedo.com>2012-03-15 14:14:26 +0100
commitb948c93e598ffc42e4c0a34f856b42944719e916 (patch)
treeab3c70827e5227ffc1bbb958424fced757d6479e /src
parentb0a1eccd543f88880a9d6bcab90398e2b2fbd45e (diff)
iface-modem: send modem initialization commands during enable
Diffstat (limited to 'src')
-rw-r--r--src/mm-iface-modem.c36
-rw-r--r--src/mm-iface-modem.h8
2 files changed, 44 insertions, 0 deletions
diff --git a/src/mm-iface-modem.c b/src/mm-iface-modem.c
index 5a10446c..1eca5bcb 100644
--- a/src/mm-iface-modem.c
+++ b/src/mm-iface-modem.c
@@ -753,6 +753,7 @@ typedef enum {
ENABLING_STEP_FIRST,
ENABLING_STEP_OPEN_PORT,
ENABLING_STEP_FLASH_PORT,
+ ENABLING_STEP_MODEM_INIT,
ENABLING_STEP_LAST
} EnablingStep;
@@ -829,6 +830,29 @@ mm_iface_modem_enable_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, \
+ EnablingContext *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); \
+ enabling_context_complete_and_free (ctx); \
+ return; \
+ } \
+ \
+ /* Go on to next step */ \
+ ctx->step++; \
+ interface_enabling_step (ctx); \
+ }
+
+VOID_REPLY_READY_FN (modem_init);
+
static void
interface_enabling_flash_done (MMSerialPort *port,
GError *error,
@@ -878,6 +902,18 @@ interface_enabling_step (EnablingContext *ctx)
ctx);
return;
+ case ENABLING_STEP_MODEM_INIT:
+ if (MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->modem_init &&
+ MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->modem_init_finish) {
+ MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->modem_init (
+ ctx->self,
+ (GAsyncReadyCallback)modem_init_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 82a9a4a4..62060f24 100644
--- a/src/mm-iface-modem.h
+++ b/src/mm-iface-modem.h
@@ -182,6 +182,14 @@ struct _MMIfaceModem {
gboolean (*set_allowed_modes_finish) (MMIfaceModem *self,
GAsyncResult *res,
GError **error);
+
+ /* Asynchronous modem initialization operation */
+ void (*modem_init) (MMIfaceModem *self,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ gboolean (*modem_init_finish) (MMIfaceModem *self,
+ GAsyncResult *res,
+ GError **error);
};
GType mm_iface_modem_get_type (void);