mirror of git://git.sysmocom.de/ofono
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.
This commit is contained in:
parent
f223cccfd0
commit
764afde1fe
26
src/sim.c
26
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,
|
||||
|
|
Loading…
Reference in New Issue