aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mm-base-sim.c30
-rw-r--r--src/mm-base-sim.h8
2 files changed, 38 insertions, 0 deletions
diff --git a/src/mm-base-sim.c b/src/mm-base-sim.c
index cc61a603..c9d24fbb 100644
--- a/src/mm-base-sim.c
+++ b/src/mm-base-sim.c
@@ -1500,6 +1500,7 @@ static void interface_initialization_step (GTask *task);
typedef enum {
INITIALIZATION_STEP_FIRST,
+ INITIALIZATION_STEP_WAIT_READY,
INITIALIZATION_STEP_SIM_IDENTIFIER,
INITIALIZATION_STEP_IMSI,
INITIALIZATION_STEP_OPERATOR_ID,
@@ -1634,6 +1635,23 @@ STR_REPLY_READY_FN (operator_identifier, "operator identifier")
STR_REPLY_READY_FN (operator_name, "operator name")
static void
+init_wait_sim_ready (MMBaseSim *self,
+ GAsyncResult *res,
+ GTask *task)
+{
+ InitAsyncContext *ctx;
+ g_autoptr(GError) error = NULL;
+
+ if (!MM_BASE_SIM_GET_CLASS (self)->wait_sim_ready_finish (self, res, &error))
+ mm_obj_warn (self, "couldn't wait for SIM to be ready: %s", error->message);
+
+ /* Go on to next step */
+ ctx = g_task_get_task_data (task);
+ ctx->step++;
+ interface_initialization_step (task);
+}
+
+static void
interface_initialization_step (GTask *task)
{
MMBaseSim *self;
@@ -1652,6 +1670,18 @@ interface_initialization_step (GTask *task)
ctx->step++;
/* Fall through */
+ case INITIALIZATION_STEP_WAIT_READY:
+ if (MM_BASE_SIM_GET_CLASS (self)->wait_sim_ready &&
+ MM_BASE_SIM_GET_CLASS (self)->wait_sim_ready_finish) {
+ MM_BASE_SIM_GET_CLASS (self)->wait_sim_ready (
+ self,
+ (GAsyncReadyCallback)init_wait_sim_ready,
+ task);
+ return;
+ }
+ ctx->step++;
+ /* Fall through */
+
case INITIALIZATION_STEP_SIM_IDENTIFIER:
/* SIM ID is meant to be loaded only once during the whole
* lifetime of the modem. Therefore, if we already have them loaded,
diff --git a/src/mm-base-sim.h b/src/mm-base-sim.h
index d9457f11..d6bc4bb8 100644
--- a/src/mm-base-sim.h
+++ b/src/mm-base-sim.h
@@ -52,6 +52,14 @@ struct _MMBaseSim {
struct _MMBaseSimClass {
MmGdbusSimSkeletonClass parent;
+ /* Wait SIM ready (async) */
+ void (* wait_sim_ready) (MMBaseSim *self,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ gboolean (* wait_sim_ready_finish) (MMBaseSim *self,
+ GAsyncResult *res,
+ GError **error);
+
/* Load SIM identifier (async) */
void (* load_sim_identifier) (MMBaseSim *self,
GAsyncReadyCallback callback,