summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/host/layer23/include/osmocom/bb/mobile/subscriber.h3
-rw-r--r--src/host/layer23/src/mobile/subscriber.c9
2 files changed, 7 insertions, 5 deletions
diff --git a/src/host/layer23/include/osmocom/bb/mobile/subscriber.h b/src/host/layer23/include/osmocom/bb/mobile/subscriber.h
index 958700ae..c747af93 100644
--- a/src/host/layer23/include/osmocom/bb/mobile/subscriber.h
+++ b/src/host/layer23/include/osmocom/bb/mobile/subscriber.h
@@ -20,6 +20,9 @@ struct gsm_sub_plmn_na {
#define GSM_IMSI_LENGTH 16
+#define GSM_SIM_IS_READER(type) \
+ (type == GSM_SIM_TYPE_L1PHY || type == GSM_SIM_TYPE_SAP)
+
enum {
GSM_SIM_TYPE_NONE = 0,
GSM_SIM_TYPE_L1PHY,
diff --git a/src/host/layer23/src/mobile/subscriber.c b/src/host/layer23/src/mobile/subscriber.c
index 097f7859..7f24d56f 100644
--- a/src/host/layer23/src/mobile/subscriber.c
+++ b/src/host/layer23/src/mobile/subscriber.c
@@ -711,7 +711,7 @@ void gsm_subscr_sim_pin(struct osmocom_ms *ms, char *pin1, char *pin2,
uint8_t job;
/* skip, if no real valid SIM */
- if (subscr->sim_type != GSM_SIM_TYPE_L1PHY)
+ if (!GSM_SIM_IS_READER(subscr->sim_type))
return;
switch (mode) {
@@ -790,7 +790,7 @@ static int subscr_write_plmn_na(struct osmocom_ms *ms)
#endif
/* skip, if no real valid SIM */
- if (subscr->sim_type != GSM_SIM_TYPE_L1PHY || !subscr->sim_valid)
+ if (!GSM_SIM_IS_READER(subscr->sim_type) || !subscr->sim_valid)
return 0;
/* get tail list from "PLMN not allowed" */
@@ -844,7 +844,7 @@ int gsm_subscr_write_loci(struct osmocom_ms *ms)
struct gsm1111_ef_loci *loci;
/* skip, if no real valid SIM */
- if (subscr->sim_type != GSM_SIM_TYPE_L1PHY || !subscr->sim_valid)
+ if (!GSM_SIM_IS_READER(subscr->sim_type) || !subscr->sim_valid)
return 0;
LOGP(DMM, LOGL_INFO, "Updating LOCI on SIM\n");
@@ -907,8 +907,7 @@ int gsm_subscr_generate_kc(struct osmocom_ms *ms, uint8_t key_seq,
struct sim_hdr *nsh;
/* not a SIM */
- if ((subscr->sim_type != GSM_SIM_TYPE_L1PHY
- && subscr->sim_type != GSM_SIM_TYPE_TEST)
+ if (!GSM_SIM_IS_READER(subscr->sim_type)
|| !subscr->sim_valid || no_sim) {
struct gsm48_mm_event *nmme;