iface-modem: skip setting up carrier config on esim without profiles

This commit is contained in:
Aleksander Morgado
2022-05-20 14:16:17 +02:00
parent fe91a3044d
commit 0123030136
3 changed files with 15 additions and 8 deletions

View File

@@ -85,6 +85,12 @@ static guint signals[SIGNAL_LAST] = { 0 };
#define IS_ESIM_WITHOUT_PROFILES(self) \ #define IS_ESIM_WITHOUT_PROFILES(self) \
(IS_ESIM (self) && (mm_gdbus_sim_get_esim_status (MM_GDBUS_SIM (self)) == MM_SIM_ESIM_STATUS_NO_PROFILES)) (IS_ESIM (self) && (mm_gdbus_sim_get_esim_status (MM_GDBUS_SIM (self)) == MM_SIM_ESIM_STATUS_NO_PROFILES))
gboolean
mm_base_sim_is_esim_without_profiles (MMBaseSim *self)
{
return IS_ESIM_WITHOUT_PROFILES (self);
}
/*****************************************************************************/ /*****************************************************************************/
void void

View File

@@ -254,4 +254,6 @@ gchar *mm_base_sim_load_sim_identifier_finish (MMBaseSim *self,
gboolean mm_base_sim_is_emergency_number (MMBaseSim *self, gboolean mm_base_sim_is_emergency_number (MMBaseSim *self,
const gchar *number); const gchar *number);
gboolean mm_base_sim_is_esim_without_profiles (MMBaseSim *self);
#endif /* MM_BASE_SIM_H */ #endif /* MM_BASE_SIM_H */

View File

@@ -5960,8 +5960,8 @@ interface_initialization_step (GTask *task)
if (!mm_iface_modem_is_cdma_only (self) && if (!mm_iface_modem_is_cdma_only (self) &&
MM_IFACE_MODEM_GET_INTERFACE (self)->setup_carrier_config && MM_IFACE_MODEM_GET_INTERFACE (self)->setup_carrier_config &&
MM_IFACE_MODEM_GET_INTERFACE (self)->setup_carrier_config_finish) { MM_IFACE_MODEM_GET_INTERFACE (self)->setup_carrier_config_finish) {
MMBaseSim *sim = NULL; g_autoptr(MMBaseSim) sim = NULL;
gchar *carrier_config_mapping = NULL; g_autofree gchar *carrier_config_mapping = NULL;
g_object_get (self, g_object_get (self,
MM_IFACE_MODEM_SIM, &sim, MM_IFACE_MODEM_SIM, &sim,
@@ -5972,26 +5972,25 @@ interface_initialization_step (GTask *task)
* validate whether we're already using the best config or not. */ * validate whether we're already using the best config or not. */
if (!sim) if (!sim)
mm_obj_dbg (self, "not setting up carrier config: SIM not found"); mm_obj_dbg (self, "not setting up carrier config: SIM not found");
else if (!mm_base_sim_is_esim_without_profiles (sim))
mm_obj_dbg (self, "not setting up carrier config: eSIM without profiles");
else if (!carrier_config_mapping) else if (!carrier_config_mapping)
mm_obj_dbg (self, "not setting up carrier config: mapping file not configured"); mm_obj_dbg (self, "not setting up carrier config: mapping file not configured");
else { else {
const gchar *imsi; const gchar *imsi;
imsi = mm_gdbus_sim_get_imsi (MM_GDBUS_SIM (sim)); imsi = mm_gdbus_sim_get_imsi (MM_GDBUS_SIM (sim));
if (imsi) { if (!imsi)
mm_obj_dbg (self, "not setting up carrier config: unknown IMSI");
else {
MM_IFACE_MODEM_GET_INTERFACE (self)->setup_carrier_config (self, MM_IFACE_MODEM_GET_INTERFACE (self)->setup_carrier_config (self,
imsi, imsi,
carrier_config_mapping, carrier_config_mapping,
(GAsyncReadyCallback)setup_carrier_config_ready, (GAsyncReadyCallback)setup_carrier_config_ready,
task); task);
g_object_unref (sim);
g_free (carrier_config_mapping);
return; return;
} }
mm_obj_warn (self, "couldn't setup carrier config: unknown IMSI");
} }
g_clear_object (&sim);
g_free (carrier_config_mapping);
} }
ctx->step++; ctx->step++;
/* fall-through */ /* fall-through */