sim: Do not teardown SIM state when PIN2 is asked

We should not tear down the SIM state if PIN2 is being asked for, or if
PIN2 is blocked and PUK2 is being asked.

We also want to continue with SIM initialization if the modem requires
PIN2 / PUK2 for some reason.
This commit is contained in:
Jussi Kangas 2011-02-25 15:20:16 +02:00 committed by Denis Kenzior
parent 996840288f
commit 9007bf6392
1 changed files with 24 additions and 7 deletions

View File

@ -2231,20 +2231,37 @@ static void sim_pin_query_cb(const struct ofono_error *error,
&pin_name);
}
if (pin_type != OFONO_SIM_PASSWORD_NONE &&
sim->state == OFONO_SIM_STATE_READY) {
/* Force the sim state out of READY */
sim_free_main_state(sim);
switch (pin_type) {
case OFONO_SIM_PASSWORD_NONE:
case OFONO_SIM_PASSWORD_SIM_PIN2:
case OFONO_SIM_PASSWORD_SIM_PUK2:
break;
default:
if (sim->state == OFONO_SIM_STATE_READY) {
/* 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_INSERTED;
__ofono_modem_sim_reset(
__ofono_atom_get_modem(sim->atom));
}
break;
}
sim_pin_retries_check(sim);
checkdone:
if (pin_type == OFONO_SIM_PASSWORD_NONE)
switch (pin_type) {
case OFONO_SIM_PASSWORD_SIM_PIN2:
case OFONO_SIM_PASSWORD_SIM_PUK2:
if (sim->state == OFONO_SIM_STATE_READY)
break;
case OFONO_SIM_PASSWORD_NONE:
sim_initialize_after_pin(sim);
break;
default:
break;
}
}
static void sim_pin_check(struct ofono_sim *sim)