diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2013-02-18 13:37:35 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2013-02-18 13:47:35 +0100 |
commit | 1746949277cbcf9209fc67b36a091177a8476b29 (patch) | |
tree | 260078e31a53830bce484bfa2386b2986a664128 /src/mm-iface-modem.c | |
parent | be37f41f06af74280edd3e412c42e2357c180925 (diff) |
ports: add port initialization sequences instead of iface-modem's modem_init()
Instead of a custom modem_init() step in the 'Modem' interface, just add a
sequence of port initialization commands in each port.
While enabling for the first time a non-hotplugged modem, we will issue the
port initialization commands only after having run the enabling_modem_init()
step (i.e. after ATZ usually).
Diffstat (limited to 'src/mm-iface-modem.c')
-rw-r--r-- | src/mm-iface-modem.c | 55 |
1 files changed, 18 insertions, 37 deletions
diff --git a/src/mm-iface-modem.c b/src/mm-iface-modem.c index 9faa7775..63ef6fca 100644 --- a/src/mm-iface-modem.c +++ b/src/mm-iface-modem.c @@ -3004,7 +3004,6 @@ static void interface_enabling_step (EnablingContext *ctx); typedef enum { ENABLING_STEP_FIRST, - ENABLING_STEP_MODEM_INIT, ENABLING_STEP_SET_POWER_STATE, ENABLING_STEP_FLOW_CONTROL, ENABLING_STEP_SUPPORTED_CHARSETS, @@ -3058,29 +3057,6 @@ 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 enabling_set_power_state_ready (MMIfaceModem *self, GAsyncResult *res, @@ -3099,7 +3075,24 @@ enabling_set_power_state_ready (MMIfaceModem *self, interface_enabling_step (ctx); } -VOID_REPLY_READY_FN (setup_flow_control); +static void +setup_flow_control_ready (MMIfaceModem *self, + GAsyncResult *res, + EnablingContext *ctx) +{ + GError *error = NULL; + + MM_IFACE_MODEM_GET_INTERFACE (self)->setup_flow_control_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); +} static void load_supported_charsets_ready (MMIfaceModem *self, @@ -3232,18 +3225,6 @@ interface_enabling_step (EnablingContext *ctx) /* Fall down to next step */ ctx->step++; - 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_SET_POWER_STATE: mm_iface_modem_set_power_state (ctx->self, MM_MODEM_POWER_STATE_ON, |