summaryrefslogtreecommitdiffstats
path: root/src/sim.c
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2012-11-22 06:45:10 -0600
committerDenis Kenzior <denkenz@gmail.com>2012-11-22 06:50:08 -0600
commitb97e79b3df36e09274d52179e746ceb89b599935 (patch)
tree8ce2b2c4fc0de8d34edda681ed865f18cdc5ea83 /src/sim.c
parent03bc21af88fd3f6bb250b50eace2de92470267c4 (diff)
downloadofono-b97e79b3df36e09274d52179e746ceb89b599935.tar.bz2
sim: Fix SIM re-init case of SIM Refresh
When the SIM is being refreshed, we try to access the SIM too fast after the SIM REFRESH proactive command is received. Instead set the sim atom into the 'RESETTING' state and wait until the modem driver signals the sim insertion again.
Diffstat (limited to 'src/sim.c')
-rw-r--r--src/sim.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/src/sim.c b/src/sim.c
index 45514075..46e4483d 100644
--- a/src/sim.c
+++ b/src/sim.c
@@ -2436,6 +2436,16 @@ static void sim_free_state(struct ofono_sim *sim)
void ofono_sim_inserted_notify(struct ofono_sim *sim, ofono_bool_t inserted)
{
+ if (sim->state == OFONO_SIM_STATE_RESETTING && inserted) {
+ /*
+ * Start initialization procedure from after EFiccid,
+ * EFli and EFpl are retrieved.
+ */
+ sim->state = OFONO_SIM_STATE_INSERTED;
+ __ofono_sim_recheck_pin(sim);
+ return;
+ }
+
if (inserted == TRUE && sim->state == OFONO_SIM_STATE_NOT_PRESENT)
sim->state = OFONO_SIM_STATE_INSERTED;
else if (inserted == FALSE && sim->state != OFONO_SIM_STATE_NOT_PRESENT)
@@ -3119,7 +3129,7 @@ void __ofono_sim_refresh(struct ofono_sim *sim, GSList *file_list,
/* Force the sim state out of READY */
sim_free_main_state(sim);
- sim->state = OFONO_SIM_STATE_INSERTED;
+ sim->state = OFONO_SIM_STATE_RESETTING;
__ofono_modem_sim_reset(__ofono_atom_get_modem(sim->atom));
}
@@ -3138,17 +3148,4 @@ void __ofono_sim_refresh(struct ofono_sim *sim, GSList *file_list,
sim_fs_notify_file_watches(sim->simfs, id);
}
}
-
- if (reinit_naa) {
- /*
- * REVISIT: There's some concern that on re-insertion the
- * atoms will start to talk to the SIM before it becomes
- * ready, on certain SIMs.
- */
- /*
- * Start initialization procedure from after EFiccid,
- * EFli and EFpl are retrieved.
- */
- __ofono_sim_recheck_pin(sim);
- }
}