From 599d922134fd48a2a576ad7640759d8f6c1fcd9b Mon Sep 17 00:00:00 2001 From: Andreas Eversberg Date: Sun, 26 Jun 2011 10:40:56 +0200 Subject: [PATCH] [layer23] Detach SIM, if reading fails This way the mobility management and cell selection process continues as if no SIM has been inserted. --- src/host/layer23/src/mobile/subscriber.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/host/layer23/src/mobile/subscriber.c b/src/host/layer23/src/mobile/subscriber.c index 9a2085a..544d53f 100644 --- a/src/host/layer23/src/mobile/subscriber.c +++ b/src/host/layer23/src/mobile/subscriber.c @@ -567,6 +567,7 @@ static void subscr_sim_query_cb(struct osmocom_ms *ms, struct msgb *msg) uint16_t payload_len = msg->len - sizeof(*sh); int rc; struct subscr_sim_file *sf = &subscr_sim_files[subscr->sim_file_index]; + struct msgb *nmsg; /* error handling */ if (sh->job_type == SIM_JOB_ERROR) { @@ -612,6 +613,13 @@ static void subscr_sim_query_cb(struct osmocom_ms *ms, struct msgb *msg) vty_notify(ms, NULL); vty_notify(ms, "SIM failed, replace SIM!\n"); + + /* detach simcard */ + subscr->sim_valid = 0; + nmsg = gsm48_mmr_msgb_alloc(GSM48_MMR_NREG_REQ); + if (!nmsg) + return; + gsm48_mmr_downmsg(ms, nmsg); } msgb_free(msg); -- 2.20.1