Comment 3 for bug 1245860

Revision history for this message
Alfonso Sanchez-Beato (alfonsosanchezbeato) wrote :

The root cause seems to be a problem with the initialization sequence. Some requests to RIL were getting the error RADIO_NOT_AVAILABLE, being the reason that RIL_REQUEST_RADIO_POWER(1) had not been called yet. But, that request was sent when ril_set_online() was called, thing that only happened when the SIM card moved to state OFONO_SIM_STATE_READY (see src/modem.c). For locked up SIMs, that was not happening.

This seems to be a flaw in our logic, as the set_online() function of the modem driver is called when the modem is powered AND the SIM is ready. So I have made a call to ril_send_power() in ril.c:sim_status_cb(), which callback calls ofono_modem_set_powered(). This solves this bug.

However, this raises a couple of things we should review:

1.- Probably we should not send RIL_REQUEST_RADIO_POWER(1) when the SIM moves to OFONO_SIM_STATE_READY, as that has already been done.

2.- Maybe this is an opportunity for removing the SIM status request that we do in ril.c, and replace it with a call to ril_send_power(). The reply data is used only to set ril->have_sim, and maybe we can do that later.