diff options
author | Denis Kenzior <denkenz@gmail.com> | 2010-08-05 10:00:57 -0500 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2010-08-05 10:00:57 -0500 |
commit | 764afde1fef4c34c1e625a841c9491f9efe8fa63 (patch) | |
tree | 866b0104cea47ee92296aa187fe7a7fdff38e5cc | |
parent | f223cccfd027e657008435909e121a2d7ee8a0bc (diff) | |
download | ofono-764afde1fef4c34c1e625a841c9491f9efe8fa63.tar.bz2 |
sim: Fix LockedPins in case SIM wants a PUK first
In the case that oFono is started with the SIM asking for a PUK, we
don't report LockedPins properly.
-rw-r--r-- | src/sim.c | 26 |
1 files changed, 26 insertions, 0 deletions
@@ -172,6 +172,28 @@ static gboolean password_is_pin(enum ofono_sim_password_type type) return FALSE; } +static enum ofono_sim_password_type puk2pin(enum ofono_sim_password_type type) +{ + switch (type) { + case OFONO_SIM_PASSWORD_SIM_PUK: + return OFONO_SIM_PASSWORD_SIM_PIN; + case OFONO_SIM_PASSWORD_PHFSIM_PUK: + return OFONO_SIM_PASSWORD_PHFSIM_PIN; + case OFONO_SIM_PASSWORD_SIM_PUK2: + return OFONO_SIM_PASSWORD_SIM_PIN2; + case OFONO_SIM_PASSWORD_PHNET_PUK: + return OFONO_SIM_PASSWORD_PHNET_PUK; + case OFONO_SIM_PASSWORD_PHNETSUB_PUK: + return OFONO_SIM_PASSWORD_PHNETSUB_PIN; + case OFONO_SIM_PASSWORD_PHSP_PUK: + return OFONO_SIM_PASSWORD_PHSP_PIN; + case OFONO_SIM_PASSWORD_PHCORP_PUK: + return OFONO_SIM_PASSWORD_PHCORP_PIN; + default: + return OFONO_SIM_PASSWORD_INVALID; + } +} + static char **get_own_numbers(GSList *own_numbers) { int nelem = 0; @@ -1078,6 +1100,10 @@ static void sim_pin_query_cb(const struct ofono_error *error, sim->pin_type = pin_type; pin_name = sim_passwd_name(pin_type); + if (pin_type != OFONO_SIM_PASSWORD_NONE && + password_is_pin(pin_type) == FALSE) + pin_type = puk2pin(pin_type); + sim->locked_pins[pin_type] = TRUE; ofono_dbus_signal_property_changed(conn, path, |