aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Mazur <mkm@semihalf.com>2021-05-05 18:51:33 +0200
committerAleksander Morgado <aleksander@aleksander.es>2021-05-22 23:56:22 +0000
commit9695f23faf1a85b9dd7e40700cd22aa6de0b146d (patch)
tree4296bd027b6b75685572885c87c709265a39f462
parent83e7600a67d1c5952d0fada07ebe70dfef3492f6 (diff)
iface-modem-3gpp: skip initialization in LOCKED state
-rw-r--r--src/mm-iface-modem-3gpp.c51
1 files changed, 37 insertions, 14 deletions
diff --git a/src/mm-iface-modem-3gpp.c b/src/mm-iface-modem-3gpp.c
index ff5999d3..7022b466 100644
--- a/src/mm-iface-modem-3gpp.c
+++ b/src/mm-iface-modem-3gpp.c
@@ -2506,10 +2506,12 @@ static void interface_initialization_step (GTask *task);
typedef enum {
INITIALIZATION_STEP_FIRST,
- INITIALIZATION_STEP_IMEI,
INITIALIZATION_STEP_ENABLED_FACILITY_LOCKS,
+ INITIALIZATION_STEP_TEST_LOCKED,
+ INITIALIZATION_STEP_IMEI,
INITIALIZATION_STEP_EPS_UE_MODE_OPERATION,
INITIALIZATION_STEP_EPS_INITIAL_BEARER_SETTINGS,
+ INITIALIZATION_STEP_CONNECT_SIGNALS,
INITIALIZATION_STEP_LAST
} InitializationStep;
@@ -2664,6 +2666,7 @@ interface_initialization_step (GTask *task)
{
MMIfaceModem3gpp *self;
InitializationContext *ctx;
+ MMModemState modem_state;
/* Don't run new steps if we're cancelled */
if (g_task_return_error_if_cancelled (task)) {
@@ -2679,6 +2682,32 @@ interface_initialization_step (GTask *task)
ctx->step++;
/* fall through */
+ case INITIALIZATION_STEP_ENABLED_FACILITY_LOCKS:
+ if (MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->load_enabled_facility_locks &&
+ MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->load_enabled_facility_locks_finish) {
+ MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->load_enabled_facility_locks (
+ self,
+ (GAsyncReadyCallback)load_enabled_facility_locks_ready,
+ task);
+ return;
+ }
+ ctx->step++;
+ /* fall through */
+
+ case INITIALIZATION_STEP_TEST_LOCKED:
+ modem_state = MM_MODEM_STATE_UNKNOWN;
+ g_object_get (self,
+ MM_IFACE_MODEM_STATE, &modem_state,
+ NULL);
+ if (modem_state == MM_MODEM_STATE_LOCKED) {
+ /* Skip some steps and export the interface if modem is locked */
+ ctx->step = INITIALIZATION_STEP_LAST;
+ interface_initialization_step (task);
+ return;
+ }
+ ctx->step++;
+ /* fall through */
+
case INITIALIZATION_STEP_IMEI:
/* IMEI value is meant to be loaded only once during the whole
* lifetime of the modem. Therefore, if we already have it loaded,
@@ -2695,18 +2724,6 @@ interface_initialization_step (GTask *task)
ctx->step++;
/* fall through */
- case INITIALIZATION_STEP_ENABLED_FACILITY_LOCKS:
- if (MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->load_enabled_facility_locks &&
- MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->load_enabled_facility_locks_finish) {
- MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->load_enabled_facility_locks (
- self,
- (GAsyncReadyCallback)load_enabled_facility_locks_ready,
- task);
- return;
- }
- ctx->step++;
- /* fall through */
-
case INITIALIZATION_STEP_EPS_UE_MODE_OPERATION:
if (MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->load_eps_ue_mode_operation &&
MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->load_eps_ue_mode_operation_finish) {
@@ -2731,7 +2748,7 @@ interface_initialization_step (GTask *task)
ctx->step++;
/* fall through */
- case INITIALIZATION_STEP_LAST:
+ case INITIALIZATION_STEP_CONNECT_SIGNALS:
/* We are done without errors! */
/* Handle method invocations */
@@ -2751,6 +2768,12 @@ interface_initialization_step (GTask *task)
"handle-set-initial-eps-bearer-settings",
G_CALLBACK (handle_set_initial_eps_bearer_settings),
self);
+
+ ctx->step++;
+ /* fall through */
+
+ case INITIALIZATION_STEP_LAST:
+ /* Always connect the signal to unlock modem */
g_signal_connect (ctx->skeleton,
"handle-disable-facility-lock",
G_CALLBACK (handle_disable_facility_lock),