mirror of git://git.sysmocom.de/ofono
sim: backup driver read_imsi by IMSI via EF read
If read_imsi driver function fails, try to obtain IMSI via EF read
This commit is contained in:
parent
aaf70beb06
commit
c5fbfaa55f
33
src/sim.c
33
src/sim.c
|
@ -1472,19 +1472,6 @@ static void sim_imsi_obtained(struct ofono_sim *sim, const char *imsi)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sim_imsi_cb(const struct ofono_error *error, const char *imsi,
|
|
||||||
void *data)
|
|
||||||
{
|
|
||||||
struct ofono_sim *sim = data;
|
|
||||||
|
|
||||||
if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
|
|
||||||
ofono_error("Unable to read IMSI, emergency calls only");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
sim_imsi_obtained(sim, imsi);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void sim_efimsi_cb(const struct ofono_error *error,
|
static void sim_efimsi_cb(const struct ofono_error *error,
|
||||||
const unsigned char *data, int len, void *user)
|
const unsigned char *data, int len, void *user)
|
||||||
{
|
{
|
||||||
|
@ -1524,6 +1511,26 @@ error:
|
||||||
ofono_error("Unable to read IMSI, emergency calls only");
|
ofono_error("Unable to read IMSI, emergency calls only");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void sim_imsi_cb(const struct ofono_error *error, const char *imsi,
|
||||||
|
void *data)
|
||||||
|
{
|
||||||
|
struct ofono_sim *sim = data;
|
||||||
|
|
||||||
|
if (error->type == OFONO_ERROR_TYPE_NO_ERROR) {
|
||||||
|
sim_imsi_obtained(sim, imsi);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Driver function failed, try via EF reads if possible */
|
||||||
|
if (sim->driver->read_file_transparent == NULL) {
|
||||||
|
ofono_error("Unable to read IMSI, emergency calls only");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
sim->driver->read_file_transparent(sim, SIM_EFIMSI_FILEID, 0, 9,
|
||||||
|
NULL, 0, sim_efimsi_cb, sim);
|
||||||
|
}
|
||||||
|
|
||||||
static void sim_retrieve_imsi(struct ofono_sim *sim)
|
static void sim_retrieve_imsi(struct ofono_sim *sim)
|
||||||
{
|
{
|
||||||
if (sim->driver->read_imsi) {
|
if (sim->driver->read_imsi) {
|
||||||
|
|
Loading…
Reference in New Issue