From c6c01110ec1a7c4800b64a88d63725d227d33fe8 Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Tue, 19 Jul 2011 14:09:27 -0500 Subject: [PATCH] sim: Support SIM_STATE_LOCKED_OUT --- src/modem.c | 3 +++ src/sim.c | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/modem.c b/src/modem.c index c60485a5..c1801276 100644 --- a/src/modem.c +++ b/src/modem.c @@ -678,6 +678,9 @@ static void sim_state_watch(enum ofono_sim_state new_state, void *user) modem_change_state(modem, MODEM_STATE_PRE_SIM); case OFONO_SIM_STATE_INSERTED: break; + case OFONO_SIM_STATE_LOCKED_OUT: + modem_change_state(modem, MODEM_STATE_PRE_SIM); + break; case OFONO_SIM_STATE_READY: modem_change_state(modem, MODEM_STATE_OFFLINE); diff --git a/src/sim.c b/src/sim.c index 62139836..03041c7b 100644 --- a/src/sim.c +++ b/src/sim.c @@ -1374,7 +1374,8 @@ static void sim_set_ready(struct ofono_sim *sim) if (sim == NULL) return; - if (sim->state != OFONO_SIM_STATE_INSERTED) + if (sim->state != OFONO_SIM_STATE_INSERTED && + sim->state != OFONO_SIM_STATE_LOCKED_OUT) return; sim->state = OFONO_SIM_STATE_READY; @@ -2385,9 +2386,8 @@ static void sim_pin_query_cb(const struct ofono_error *error, /* Force the sim state out of READY */ sim_free_main_state(sim); - sim->state = OFONO_SIM_STATE_INSERTED; - __ofono_modem_sim_reset( - __ofono_atom_get_modem(sim->atom)); + sim->state = OFONO_SIM_STATE_LOCKED_OUT; + call_state_watches(sim); } break; }