broadband-modem: initialize the Simple interface even if unlocked
We should be able to unlock the modem during Simple Connect().
This commit is contained in:
@@ -6384,6 +6384,7 @@ typedef struct {
|
|||||||
InitializeStep step;
|
InitializeStep step;
|
||||||
MMAtSerialPort *port;
|
MMAtSerialPort *port;
|
||||||
gboolean close_port;
|
gboolean close_port;
|
||||||
|
gboolean abort_if_locked;
|
||||||
} InitializeContext;
|
} InitializeContext;
|
||||||
|
|
||||||
static void initialize_step (InitializeContext *ctx);
|
static void initialize_step (InitializeContext *ctx);
|
||||||
@@ -6551,12 +6552,10 @@ initialize_step (InitializeContext *ctx)
|
|||||||
* the initialization sequence. Instead, we will re-initialize once
|
* the initialization sequence. Instead, we will re-initialize once
|
||||||
* we are unlocked. */
|
* we are unlocked. */
|
||||||
if (ctx->self->priv->modem_state == MM_MODEM_STATE_LOCKED) {
|
if (ctx->self->priv->modem_state == MM_MODEM_STATE_LOCKED) {
|
||||||
g_simple_async_result_set_error (ctx->result,
|
/* Jump to the Simple interface */
|
||||||
MM_CORE_ERROR,
|
ctx->abort_if_locked = TRUE;
|
||||||
MM_CORE_ERROR_WRONG_STATE,
|
ctx->step = INITIALIZE_STEP_IFACE_SIMPLE;
|
||||||
"Modem is currently locked, "
|
initialize_step (ctx);
|
||||||
"cannot fully initialize");
|
|
||||||
initialize_context_complete_and_free (ctx);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* Fall down to next step */
|
/* Fall down to next step */
|
||||||
@@ -6636,14 +6635,23 @@ initialize_step (InitializeContext *ctx)
|
|||||||
ctx->step++;
|
ctx->step++;
|
||||||
|
|
||||||
case INITIALIZE_STEP_LAST:
|
case INITIALIZE_STEP_LAST:
|
||||||
/* All initialized without errors! */
|
if (ctx->abort_if_locked) {
|
||||||
|
/* We're locked :-/ */
|
||||||
|
g_simple_async_result_set_error (ctx->result,
|
||||||
|
MM_CORE_ERROR,
|
||||||
|
MM_CORE_ERROR_WRONG_STATE,
|
||||||
|
"Modem is currently locked, "
|
||||||
|
"cannot fully initialize");
|
||||||
|
} else {
|
||||||
|
/* All initialized without errors!
|
||||||
|
* Set as disabled (a.k.a. initialized) */
|
||||||
|
mm_iface_modem_update_state (MM_IFACE_MODEM (ctx->self),
|
||||||
|
MM_MODEM_STATE_DISABLED,
|
||||||
|
MM_MODEM_STATE_CHANGE_REASON_UNKNOWN);
|
||||||
|
|
||||||
/* Set as disabled (a.k.a. initialized) */
|
g_simple_async_result_set_op_res_gboolean (G_SIMPLE_ASYNC_RESULT (ctx->result), TRUE);
|
||||||
mm_iface_modem_update_state (MM_IFACE_MODEM (ctx->self),
|
}
|
||||||
MM_MODEM_STATE_DISABLED,
|
|
||||||
MM_MODEM_STATE_CHANGE_REASON_UNKNOWN);
|
|
||||||
|
|
||||||
g_simple_async_result_set_op_res_gboolean (G_SIMPLE_ASYNC_RESULT (ctx->result), TRUE);
|
|
||||||
initialize_context_complete_and_free (ctx);
|
initialize_context_complete_and_free (ctx);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user