summaryrefslogtreecommitdiffstats
path: root/src/sim.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sim.c')
-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,