iface-modem: fail initialization if eSIM without profiles
A modem using an eSIM without profiles should not be allowed to get enabled, it should be really treated as a modem without a physical SIM.
This commit is contained in:
@@ -146,6 +146,7 @@ typedef enum { /*< underscore_name=mm_modem_state >*/
|
||||
* @MM_MODEM_STATE_FAILED_REASON_UNKNOWN: Unknown error.
|
||||
* @MM_MODEM_STATE_FAILED_REASON_SIM_MISSING: SIM is required but missing.
|
||||
* @MM_MODEM_STATE_FAILED_REASON_SIM_ERROR: SIM is available, but unusable (e.g. permanently locked).
|
||||
* @MM_MODEM_STATE_FAILED_REASON_ESIM_WITHOUT_PROFILES: eSIM is not initialized. Since 1.20.
|
||||
*
|
||||
* Enumeration of possible errors when the modem is in @MM_MODEM_STATE_FAILED.
|
||||
*
|
||||
@@ -156,6 +157,7 @@ typedef enum { /*< underscore_name=mm_modem_state_failed_reason >*/
|
||||
MM_MODEM_STATE_FAILED_REASON_UNKNOWN = 1,
|
||||
MM_MODEM_STATE_FAILED_REASON_SIM_MISSING = 2,
|
||||
MM_MODEM_STATE_FAILED_REASON_SIM_ERROR = 3,
|
||||
MM_MODEM_STATE_FAILED_REASON_ESIM_WITHOUT_PROFILES = 4,
|
||||
} MMModemStateFailedReason;
|
||||
|
||||
/**
|
||||
|
@@ -101,6 +101,7 @@
|
||||
* @MM_CORE_ERROR_NOT_FOUND: Item not found.
|
||||
* @MM_CORE_ERROR_RETRY: Operation cannot yet be performed, retry later.
|
||||
* @MM_CORE_ERROR_EXISTS: Item already exists.
|
||||
* @MM_CORE_ERROR_WRONG_SIM_STATE: Operation cannot be executed in the current SIM state. Since 1.20.
|
||||
*
|
||||
* Common errors that may be reported by ModemManager.
|
||||
*
|
||||
@@ -121,6 +122,7 @@ typedef enum { /*< underscore_name=mm_core_error >*/
|
||||
MM_CORE_ERROR_NOT_FOUND = 11, /*< nick=NotFound >*/
|
||||
MM_CORE_ERROR_RETRY = 12, /*< nick=Retry >*/
|
||||
MM_CORE_ERROR_EXISTS = 13, /*< nick=Exists >*/
|
||||
MM_CORE_ERROR_WRONG_SIM_STATE = 14, /*< nick=WrongSimState >*/
|
||||
} MMCoreError;
|
||||
|
||||
/**
|
||||
|
@@ -12389,6 +12389,10 @@ iface_modem_initialize_ready (MMBroadbandModem *self,
|
||||
MM_MOBILE_EQUIPMENT_ERROR,
|
||||
MM_MOBILE_EQUIPMENT_ERROR_SIM_WRONG))
|
||||
failed_reason = MM_MODEM_STATE_FAILED_REASON_SIM_MISSING;
|
||||
else if (g_error_matches (error,
|
||||
MM_CORE_ERROR,
|
||||
MM_CORE_ERROR_WRONG_SIM_STATE))
|
||||
failed_reason = MM_MODEM_STATE_FAILED_REASON_ESIM_WITHOUT_PROFILES;
|
||||
|
||||
g_error_free (error);
|
||||
|
||||
|
@@ -4711,6 +4711,7 @@ typedef enum {
|
||||
INITIALIZATION_STEP_SIM,
|
||||
INITIALIZATION_STEP_SETUP_CARRIER_CONFIG,
|
||||
INITIALIZATION_STEP_OWN_NUMBERS,
|
||||
INITIALIZATION_STEP_VALIDATE_ESIM_STATUS,
|
||||
INITIALIZATION_STEP_LAST
|
||||
} InitializationStep;
|
||||
|
||||
@@ -6011,6 +6012,24 @@ interface_initialization_step (GTask *task)
|
||||
ctx->step++;
|
||||
/* fall-through */
|
||||
|
||||
case INITIALIZATION_STEP_VALIDATE_ESIM_STATUS: {
|
||||
g_autoptr(MMBaseSim) sim = NULL;
|
||||
|
||||
g_object_get (self,
|
||||
MM_IFACE_MODEM_SIM, &sim,
|
||||
NULL);
|
||||
|
||||
/* If the current SIM is an eSIM without profiles, we transition to FAILED
|
||||
* status because the modem is really unusable. */
|
||||
if (sim && mm_base_sim_is_esim_without_profiles (sim)) {
|
||||
g_clear_error (&ctx->fatal_error);
|
||||
ctx->fatal_error = g_error_new (MM_CORE_ERROR, MM_CORE_ERROR_WRONG_SIM_STATE,
|
||||
"eSIM without profiles detected");
|
||||
}
|
||||
|
||||
ctx->step++;
|
||||
} /* fall-through */
|
||||
|
||||
case INITIALIZATION_STEP_LAST:
|
||||
/* Setup all method handlers */
|
||||
g_object_connect (ctx->skeleton,
|
||||
|
Reference in New Issue
Block a user