aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAkash Aggarwal <quic_akasagga@quicinc.com>2022-10-11 11:55:28 +0530
committerAkash Aggarwal <quic_akasagga@quicinc.com>2022-10-11 11:55:28 +0530
commit04ed52a74cf9d24c5deacbb118ec985375ac4a9b (patch)
tree3895df551c46df214c909412df04b32eebc5bab1 /src
parentead9f1809f6fa0d94723620b66078da6a168716b (diff)
mm-iface-modem: always require a SIM card in 3GPP modules
Avoid removing 3GPP capabilities if sim is absent. Transition to 'Failed' state for 3GPP capable devices if sim is absent.
Diffstat (limited to 'src')
-rw-r--r--src/mm-iface-modem.c64
1 files changed, 4 insertions, 60 deletions
diff --git a/src/mm-iface-modem.c b/src/mm-iface-modem.c
index c9d16190..911c139d 100644
--- a/src/mm-iface-modem.c
+++ b/src/mm-iface-modem.c
@@ -3758,16 +3758,16 @@ internal_load_unlock_required_ready (MMIfaceModem *self,
g_error_matches (error,
MM_MOBILE_EQUIPMENT_ERROR,
MM_MOBILE_EQUIPMENT_ERROR_SIM_WRONG)) {
- /* SIM errors are only critical in 3GPP-only devices */
- if (!mm_iface_modem_is_cdma (self)) {
+ /* SIM errors are only critical in 3GPP-capable devices */
+ if (mm_iface_modem_is_3gpp (self)) {
ctx->saved_error = error;
ctx->step = UPDATE_LOCK_INFO_CONTEXT_STEP_LAST;
update_lock_info_context_step (task);
return;
}
- /* For mixed 3GPP+3GPP2 devices, skip SIM errors */
- mm_obj_dbg (self, "skipping SIM error in 3GPP2-capable device, assuming no lock is needed");
+ /* For non 3GPP-capable devices, skip SIM errors */
+ mm_obj_dbg (self, "skipping SIM error in non 3GPP-capable device, assuming no lock is needed");
g_error_free (error);
ctx->lock = MM_MODEM_LOCK_NONE;
} else {
@@ -4778,48 +4778,6 @@ initialization_context_free (InitializationContext *ctx)
}
static void
-current_capabilities_internal_load_unlock_required_ready (MMIfaceModem *self,
- GAsyncResult *res,
- GTask *task)
-{
- InitializationContext *ctx;
- GError *error = NULL;
-
- ctx = g_task_get_task_data (task);
-
- internal_load_unlock_required_finish (self, res, &error);
- if (error) {
- /* These SIM errors indicate that there is NO valid SIM available. So,
- * remove all 3GPP caps from the current capabilities */
- if (g_error_matches (error,
- MM_MOBILE_EQUIPMENT_ERROR,
- MM_MOBILE_EQUIPMENT_ERROR_SIM_NOT_INSERTED) ||
- g_error_matches (error,
- MM_MOBILE_EQUIPMENT_ERROR,
- MM_MOBILE_EQUIPMENT_ERROR_SIM_FAILURE) ||
- g_error_matches (error,
- MM_MOBILE_EQUIPMENT_ERROR,
- MM_MOBILE_EQUIPMENT_ERROR_SIM_WRONG)) {
- MMModemCapability caps;
-
- mm_obj_dbg (self, "multimode device without SIM, no 3GPP capabilities");
- caps = mm_gdbus_modem_get_current_capabilities (ctx->skeleton);
- caps &= ~MM_MODEM_CAPABILITY_3GPP;
-
- /* CDMA-EVDO must still be around */
- g_assert (caps & MM_MODEM_CAPABILITY_CDMA_EVDO);
- mm_gdbus_modem_set_current_capabilities (ctx->skeleton, caps);
- }
-
- g_error_free (error);
- }
-
- /* Keep on */
- ctx->step++;
- interface_initialization_step (task);
-}
-
-static void
load_current_capabilities_ready (MMIfaceModem *self,
GAsyncResult *res,
GTask *task)
@@ -4871,22 +4829,8 @@ load_current_capabilities_ready (MMIfaceModem *self,
NULL);
}
- /* Update current caps right away, even if we may fix them during the
- * multimode device check. No big deal in updating them twice, as we're not
- * exposed in DBus yet. */
mm_gdbus_modem_set_current_capabilities (ctx->skeleton, caps);
- /* If the device is a multimode device (3GPP+3GPP2) check whether we have a
- * SIM or not. */
- if ((caps & MM_MODEM_CAPABILITY_CDMA_EVDO) && (caps & MM_MODEM_CAPABILITY_3GPP)) {
- mm_obj_dbg (self, "checking if multimode device has a SIM...");
- internal_load_unlock_required (
- self,
- (GAsyncReadyCallback)current_capabilities_internal_load_unlock_required_ready,
- task);
- return;
- }
-
ctx->step++;
interface_initialization_step (task);
}