pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmocom-bb/+/32757 )
Change subject: layer23: split subscr_write_plmn_na() internally per-backend ......................................................................
layer23: split subscr_write_plmn_na() internally per-backend
Change-Id: I5e3a4996bbb5cbfbe81342eadb46aa10a2033fd9 --- M src/host/layer23/src/common/subscriber.c 1 file changed, 35 insertions(+), 5 deletions(-)
Approvals: Jenkins Builder: Verified fixeria: Looks good to me, approved
diff --git a/src/host/layer23/src/common/subscriber.c b/src/host/layer23/src/common/subscriber.c index f3e6f20..bdd6b62 100644 --- a/src/host/layer23/src/common/subscriber.c +++ b/src/host/layer23/src/common/subscriber.c @@ -61,6 +61,8 @@ static int gsm_subscr_sim_pin_simcard(struct osmocom_ms *ms, const char *pin1, const char *pin2, int8_t mode);
+static int subscr_write_plmn_na_simcard(struct osmocom_ms *ms); + static void subscr_sim_query_cb(struct osmocom_ms *ms, struct msgb *msg); static void subscr_sim_update_cb(struct osmocom_ms *ms, struct msgb *msg); static void subscr_sim_key_cb(struct osmocom_ms *ms, struct msgb *msg); @@ -303,6 +305,29 @@ } }
+/* update plmn not allowed list on SIM */ +static int subscr_write_plmn_na(struct osmocom_ms *ms) +{ + struct gsm_subscriber *subscr = &ms->subscr; + + /* skip, if no real valid SIM */ + if (subscr->sim_type == GSM_SIM_TYPE_NONE || !subscr->sim_valid) + return 0; + + LOGP(DMM, LOGL_INFO, "Updating FPLMN on SIM\n"); + + switch (subscr->sim_type) { + case GSM_SIM_TYPE_L1PHY: + case GSM_SIM_TYPE_SAP: + return subscr_write_plmn_na_simcard(ms); + case GSM_SIM_TYPE_TEST: + LOGP(DMM, LOGL_NOTICE, "Updating FPLMN on test SIM: not implemented!\n"); + return 0; /* TODO */ + default: + OSMO_ASSERT(0); + } +} + /* * test card */ @@ -926,7 +951,7 @@ }
/* update plmn not allowed list on SIM */ -static int subscr_write_plmn_na(struct osmocom_ms *ms) +static int subscr_write_plmn_na_simcard(struct osmocom_ms *ms) { struct gsm_subscriber *subscr = &ms->subscr; struct msgb *nmsg; @@ -940,10 +965,6 @@ return 0; #endif
- /* skip, if no real valid SIM */ - if (!GSM_SIM_IS_READER(subscr->sim_type) || !subscr->sim_valid) - return 0; - /* get tail list from "PLMN not allowed" */ llist_for_each_entry(na, &subscr->plmn_na, entry) { if (count < 4)