broadband-modem-mbim: update sim-type and esim-status of inactive slot

During initialization if the number of slots is more than 1 then
update the sim-type and esim-status of the inactive slot as well.
This commit is contained in:
som
2022-02-16 17:22:43 +05:30
committed by Aleksander Morgado
parent c447785fd8
commit 035879dab9
3 changed files with 52 additions and 17 deletions

View File

@@ -5148,7 +5148,9 @@ update_sim_from_slot_status (MMBroadbandModemMbim *self,
MbimUiccSlotState slot_status,
guint slot_index)
{
g_autoptr(MMBaseSim) sim = NULL;
g_autoptr(MMBaseSim) sim = NULL;
MMSimType sim_type = MM_SIM_TYPE_UNKNOWN;
MMSimEsimStatus esim_status = MM_SIM_ESIM_STATUS_UNKNOWN;
mm_obj_dbg (self, "Updating sim at slot %d", slot_index + 1);
@@ -5159,9 +5161,21 @@ update_sim_from_slot_status (MMBroadbandModemMbim *self,
slot_status == MBIM_UICC_SLOT_STATE_ACTIVE_ESIM_NO_PROFILES ||
slot_status == MBIM_UICC_SLOT_STATE_NOT_READY ||
slot_status == MBIM_UICC_SLOT_STATE_ERROR) {
if (slot_status == MBIM_UICC_SLOT_STATE_ACTIVE)
sim_type = MM_SIM_TYPE_PHYSICAL;
else if (slot_status == MBIM_UICC_SLOT_STATE_ACTIVE_ESIM) {
sim_type = MM_SIM_TYPE_ESIM;
esim_status = MM_SIM_ESIM_STATUS_WITH_PROFILES;
} else if (slot_status == MBIM_UICC_SLOT_STATE_ACTIVE_ESIM_NO_PROFILES) {
sim_type = MM_SIM_TYPE_ESIM;
esim_status = MM_SIM_ESIM_STATUS_NO_PROFILES;
}
sim = mm_sim_mbim_new_initialized (MM_BASE_MODEM (self),
slot_index,
FALSE,
sim_type,
esim_status,
NULL,
NULL,
NULL,
@@ -8365,6 +8379,8 @@ query_slot_information_status_ready (MbimDevice *device,
LoadSimSlotsContext *ctx;
MMBaseSim *sim;
gboolean sim_active = FALSE;
MMSimType sim_type = MM_SIM_TYPE_UNKNOWN;
MMSimEsimStatus esim_status = MM_SIM_ESIM_STATUS_UNKNOWN;
self = g_task_get_source_object (task);
ctx = g_task_get_task_data (task);
@@ -8393,9 +8409,22 @@ query_slot_information_status_ready (MbimDevice *device,
slot_state == MBIM_UICC_SLOT_STATE_ACTIVE_ESIM_NO_PROFILES ||
slot_state == MBIM_UICC_SLOT_STATE_NOT_READY ||
slot_state == MBIM_UICC_SLOT_STATE_ERROR) {
if (slot_state == MBIM_UICC_SLOT_STATE_ACTIVE)
sim_type = MM_SIM_TYPE_PHYSICAL;
else if (slot_state == MBIM_UICC_SLOT_STATE_ACTIVE_ESIM) {
sim_type = MM_SIM_TYPE_ESIM;
esim_status = MM_SIM_ESIM_STATUS_WITH_PROFILES;
} else if (slot_state == MBIM_UICC_SLOT_STATE_ACTIVE_ESIM_NO_PROFILES) {
sim_type = MM_SIM_TYPE_ESIM;
esim_status = MM_SIM_ESIM_STATUS_NO_PROFILES;
}
sim = mm_sim_mbim_new_initialized (MM_BASE_MODEM (self),
slot_index,
sim_active,
sim_type,
esim_status,
NULL,
NULL,
NULL,

View File

@@ -1186,14 +1186,16 @@ mm_sim_mbim_new (MMBaseModem *modem,
MMBaseSim *
mm_sim_mbim_new_initialized (MMBaseModem *modem,
guint slot_number,
gboolean active,
const gchar *sim_identifier,
const gchar *imsi,
const gchar *eid,
const gchar *operator_identifier,
const gchar *operator_name,
const GStrv emergency_numbers)
guint slot_number,
gboolean active,
MMSimType sim_type,
MMSimEsimStatus esim_status,
const gchar *sim_identifier,
const gchar *imsi,
const gchar *eid,
const gchar *operator_identifier,
const gchar *operator_name,
const GStrv emergency_numbers)
{
MMBaseSim *sim;
@@ -1201,6 +1203,8 @@ mm_sim_mbim_new_initialized (MMBaseModem *modem,
MM_BASE_SIM_MODEM, modem,
MM_BASE_SIM_SLOT_NUMBER, slot_number,
"active", active,
"sim-type", sim_type,
"esim-status", esim_status,
"sim-identifier", sim_identifier,
"eid", eid,
"operator-identifier", operator_identifier,

View File

@@ -51,12 +51,14 @@ void mm_sim_mbim_new (MMBaseModem *modem,
MMBaseSim *mm_sim_mbim_new_finish (GAsyncResult *res,
GError **error);
MMBaseSim *mm_sim_mbim_new_initialized (MMBaseModem *modem,
guint slot_number,
gboolean active,
const gchar *sim_identifier,
const gchar *imsi,
const gchar *eid,
const gchar *operator_identifier,
const gchar *operator_name,
const GStrv emergency_numbers);
guint slot_number,
gboolean active,
MMSimType sim_type,
MMSimEsimStatus esim_status,
const gchar *sim_identifier,
const gchar *imsi,
const gchar *eid,
const gchar *operator_identifier,
const gchar *operator_name,
const GStrv emergency_numbers);
#endif /* MM_SIM_MBIM_H */