aboutsummaryrefslogtreecommitdiff
path: root/src/mm-base-modem.c
diff options
context:
space:
mode:
authorAleksander Morgado <aleksandermj@chromium.org>2024-09-13 12:49:39 +0000
committerAleksander Morgado <aleksandermj@chromium.org>2024-09-30 11:07:11 +0000
commitdfc0f8ebfd6a4a698af6cf784ba749ecdcb05e7e (patch)
tree1cb3fffcf7ffec61746b6c89275cc554351b7449 /src/mm-base-modem.c
parent0aef4c422f5f686741f8943f479ff8d43b751f3d (diff)
base-modem: override disable operations done before modem object removal
If we are going to inhibit the modem or fully reprobe it after a SIM switch event, we should forbid further operations done with the modem object. This logic can be tested by queing different operations one after the other, and then adding a last device inhibition ("override" operation) that should trigger the early abort of all non-running operations, e.g.: mmcli -m a -e & sleep 0.2 mmcli -m a --3gpp-set-initial-eps-bearer-settings="apn=internet,ip-type=ipv4v6,force=true" & sleep 0.2 mmcli -m a -d & sleep 0.2 mmcli -m a -e & sleep 0.2 mmcli -m a --set-power-state-low & sleep 0.2 mmcli -m a -e & sleep 0.2 mmcli -m a --inhibit This previous sequence produces MM logs as follows: <dbg> [1726567756.430308] [modem0] [operation 22] default - enable: scheduled <dbg> [1726567756.430806] [modem0] [operation 22] default - enable: lock acquired <dbg> [1726567756.623746] [modem0] [operation 23] default - set-initial-eps-bearer-settings: scheduled <dbg> [1726567756.751743] [modem0] [operation 22] default - enable: lock released <dbg> [1726567756.752027] [modem0] [operation 23] default - set-initial-eps-bearer-settings: lock acquired <dbg> [1726567756.823739] [modem0] [operation 24] default - disable: scheduled <dbg> [1726567757.049581] [modem0] [operation 25] default - enable: scheduled <dbg> [1726567757.250165] [modem0] [operation 26] default - set-power-state: scheduled <dbg> [1726567757.450518] [modem0] [operation 27] default - enable: scheduled <dbg> [1726567757.676362] [modem0] [operation 28] override - disabling: override requested - no new operations will be allowed <dbg> [1726567757.678792] [modem0] [operation 24] default - disable: aborted early <dbg> [1726567757.679866] [modem0] [operation 25] default - enable: aborted early <dbg> [1726567757.680157] [modem0] [operation 26] default - set-power-state: aborted early <dbg> [1726567757.680496] [modem0] [operation 27] default - enable: aborted early <dbg> [1726567759.695780] [modem0] [operation 23] default - set-initial-eps-bearer-settings: lock released <dbg> [1726567759.695935] [modem0] [operation 28] override - disabling: lock acquired <dbg> [1726567759.872196] [modem0] [operation 28] override - disabling: lock released
Diffstat (limited to 'src/mm-base-modem.c')
-rw-r--r--src/mm-base-modem.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/mm-base-modem.c b/src/mm-base-modem.c
index 6348af33..b6023039 100644
--- a/src/mm-base-modem.c
+++ b/src/mm-base-modem.c
@@ -808,11 +808,12 @@ lock_before_state_operation_ready (MMBaseModem *self,
}
static void
-state_operation (MMBaseModem *self,
- StateOperationType operation_type,
- MMBaseModemOperationLock operation_lock,
- GAsyncReadyCallback callback,
- gpointer user_data)
+state_operation (MMBaseModem *self,
+ StateOperationType operation_type,
+ MMBaseModemOperationLock operation_lock,
+ MMBaseModemOperationPriority operation_priority,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
GTask *task;
StateOperationContext *ctx;
@@ -871,7 +872,7 @@ state_operation (MMBaseModem *self,
g_assert (operation_lock == MM_BASE_MODEM_OPERATION_LOCK_REQUIRED);
mm_base_modem_operation_lock (self,
- MM_BASE_MODEM_OPERATION_PRIORITY_DEFAULT,
+ operation_priority,
operation_description,
(GAsyncReadyCallback) lock_before_state_operation_ready,
task);
@@ -898,6 +899,7 @@ mm_base_modem_sync (MMBaseModem *self,
state_operation (self,
STATE_OPERATION_TYPE_SYNC,
operation_lock,
+ MM_BASE_MODEM_OPERATION_PRIORITY_DEFAULT,
callback,
user_data);
}
@@ -915,14 +917,16 @@ mm_base_modem_disable_finish (MMBaseModem *self,
}
void
-mm_base_modem_disable (MMBaseModem *self,
- MMBaseModemOperationLock operation_lock,
- GAsyncReadyCallback callback,
- gpointer user_data)
+mm_base_modem_disable (MMBaseModem *self,
+ MMBaseModemOperationLock operation_lock,
+ MMBaseModemOperationPriority operation_priority,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
state_operation (self,
STATE_OPERATION_TYPE_DISABLE,
operation_lock,
+ operation_priority,
callback,
user_data);
}
@@ -946,6 +950,7 @@ mm_base_modem_enable (MMBaseModem *self,
state_operation (self,
STATE_OPERATION_TYPE_ENABLE,
operation_lock,
+ MM_BASE_MODEM_OPERATION_PRIORITY_DEFAULT,
callback,
user_data);
}
@@ -969,6 +974,7 @@ mm_base_modem_initialize (MMBaseModem *self,
state_operation (self,
STATE_OPERATION_TYPE_INITIALIZE,
operation_lock,
+ MM_BASE_MODEM_OPERATION_PRIORITY_DEFAULT,
callback,
user_data);
}