summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2010-08-05 10:00:57 -0500
committerDenis Kenzior <denkenz@gmail.com>2010-08-05 10:00:57 -0500
commit764afde1fef4c34c1e625a841c9491f9efe8fa63 (patch)
tree866b0104cea47ee92296aa187fe7a7fdff38e5cc /src
parentf223cccfd027e657008435909e121a2d7ee8a0bc (diff)
downloadofono-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.
Diffstat (limited to 'src')
-rw-r--r--src/sim.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/sim.c b/src/sim.c
index 2514e7b0..0b31111a 100644
--- a/src/sim.c
+++ b/src/sim.c
@@ -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,