sim: Check for SIM lockout condition

When a user tries to lock/unlock/change a PIN and enters it wrongly
several times, it is possible to lock themselves out.  In this case we
should drop to a pre-sim state, wait for the user to enter the PUK and
re-init the sim.
This commit is contained in:
Denis Kenzior 2011-02-18 11:24:08 -06:00
parent 5543d935c5
commit e8553f5337
1 changed files with 12 additions and 3 deletions

View File

@ -624,7 +624,7 @@ static void sim_unlock_cb(const struct ofono_error *error, void *data)
DBusMessage *reply = __ofono_error_failed(sim->pending);
__ofono_dbus_pending_reply(&sim->pending, reply);
sim_pin_retries_check(sim);
sim_pin_check(sim);
return;
}
@ -640,7 +640,7 @@ static void sim_lock_cb(const struct ofono_error *error, void *data)
DBusMessage *reply = __ofono_error_failed(sim->pending);
__ofono_dbus_pending_reply(&sim->pending, reply);
sim_pin_retries_check(sim);
sim_pin_check(sim);
return;
}
@ -711,7 +711,7 @@ static void sim_change_pin_cb(const struct ofono_error *error, void *data)
__ofono_dbus_pending_reply(&sim->pending,
__ofono_error_failed(sim->pending));
sim_pin_retries_check(sim);
sim_pin_check(sim);
return;
}
@ -2231,6 +2231,15 @@ 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);
sim->state = OFONO_SIM_STATE_INSERTED;
__ofono_modem_sim_reset(__ofono_atom_get_modem(sim->atom));
}
sim_pin_retries_check(sim);
checkdone: