diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2012-01-03 13:23:36 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-03-15 14:14:43 +0100 |
commit | 6abcfd54a6c3b45b38c0bc4a999b39f0c683de35 (patch) | |
tree | 1ba0b90806976da4461ce92654010aac8f3f4c4f /src/mm-iface-modem-cdma.c | |
parent | 863bfe9ecd4a5a9e8fba087ee05de04523f8b9d0 (diff) |
iface-modem-cdma: load MEID during initialization
Diffstat (limited to 'src/mm-iface-modem-cdma.c')
-rw-r--r-- | src/mm-iface-modem-cdma.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/mm-iface-modem-cdma.c b/src/mm-iface-modem-cdma.c index ad749909..3d689e5e 100644 --- a/src/mm-iface-modem-cdma.c +++ b/src/mm-iface-modem-cdma.c @@ -541,6 +541,7 @@ static void interface_initialization_step (InitializationContext *ctx); typedef enum { INITIALIZATION_STEP_FIRST, + INITIALIZATION_STEP_MEID, INITIALIZATION_STEP_LAST } InitializationStep; @@ -587,6 +588,28 @@ initialization_context_complete_and_free (InitializationContext *ctx) } static void +load_meid_ready (MMIfaceModemCdma *self, + GAsyncResult *res, + InitializationContext *ctx) +{ + GError *error = NULL; + gchar *meid; + + meid = MM_IFACE_MODEM_CDMA_GET_INTERFACE (self)->load_meid_finish (self, res, &error); + mm_gdbus_modem_cdma_set_meid (ctx->skeleton, meid); + g_free (meid); + + if (error) { + mm_warn ("couldn't load MEID: '%s'", error->message); + g_error_free (error); + } + + /* Go on to next step */ + ctx->step++; + interface_initialization_step (ctx); +} + +static void interface_initialization_step (InitializationContext *ctx) { switch (ctx->step) { @@ -594,6 +617,22 @@ interface_initialization_step (InitializationContext *ctx) /* Fall down to next step */ ctx->step++; + case INITIALIZATION_STEP_MEID: + /* MEID value is meant to be loaded only once during the whole + * lifetime of the modem. Therefore, if we already have it loaded, + * don't try to load it again. */ + if (!mm_gdbus_modem_cdma_get_meid (ctx->skeleton) && + MM_IFACE_MODEM_CDMA_GET_INTERFACE (ctx->self)->load_meid && + MM_IFACE_MODEM_CDMA_GET_INTERFACE (ctx->self)->load_meid_finish) { + MM_IFACE_MODEM_CDMA_GET_INTERFACE (ctx->self)->load_meid ( + ctx->self, + (GAsyncReadyCallback)load_meid_ready, + ctx); + return; + } + /* Fall down to next step */ + ctx->step++; + case INITIALIZATION_STEP_LAST: /* We are done without errors! */ |