mirror of git://git.sysmocom.de/ofono
isimodem: Fix race condition in SIM probe
Fix a potential race condition between HPLMN query and subscribing to SIM status indications.
This commit is contained in:
parent
579a1ebef3
commit
9306837053
|
@ -434,15 +434,12 @@ static void sim_ind_cb(const GIsiMessage *msg, void *data)
|
||||||
static void sim_reachable_cb(const GIsiMessage *msg, void *data)
|
static void sim_reachable_cb(const GIsiMessage *msg, void *data)
|
||||||
{
|
{
|
||||||
struct ofono_sim *sim = data;
|
struct ofono_sim *sim = data;
|
||||||
struct sim_data *sd = ofono_sim_get_data(sim);
|
|
||||||
|
|
||||||
if (g_isi_msg_error(msg) < 0)
|
if (g_isi_msg_error(msg) < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ISI_VERSION_DBG(msg);
|
ISI_VERSION_DBG(msg);
|
||||||
|
|
||||||
g_isi_client_ind_subscribe(sd->client, SIM_IND, sim_ind_cb, sim);
|
|
||||||
|
|
||||||
/* Check if SIM is ready by reading HPLMN */
|
/* Check if SIM is ready by reading HPLMN */
|
||||||
isi_read_hplmn(sim);
|
isi_read_hplmn(sim);
|
||||||
}
|
}
|
||||||
|
@ -465,6 +462,7 @@ static int isi_sim_probe(struct ofono_sim *sim, unsigned int vendor,
|
||||||
|
|
||||||
ofono_sim_set_data(sim, sd);
|
ofono_sim_set_data(sim, sd);
|
||||||
|
|
||||||
|
g_isi_client_ind_subscribe(sd->client, SIM_IND, sim_ind_cb, sim);
|
||||||
g_isi_client_verify(sd->client, sim_reachable_cb, sim, NULL);
|
g_isi_client_verify(sd->client, sim_reachable_cb, sim, NULL);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue