So the root cause is the fact that the ril plugin calls ofono_sim_inserted_notify() before the rilmodem's sim_driver has called ofono_sim_register().
Note, the rilmodem sim driver code delays calling ofono_sim_register() until it's received a reply to a GET_SIM_STATUS request. Note, the ril plugin also calls GET_SIM_STATUS to determine if the SIM is present ( ie. this triggers the call to ofono_sim_inserted_notify() ).
So, I need to re-examine the sim driver logic and see if it makes sense to de-couple the call to ofono_sim_register() and the reply to the second GET_SIM_STATUS call.
So the root cause is the fact that the ril plugin calls ofono_sim_ inserted_ notify( ) before the rilmodem's sim_driver has called ofono_sim_ register( ).
Note, the rilmodem sim driver code delays calling ofono_sim_ register( ) until it's received a reply to a GET_SIM_STATUS request. Note, the ril plugin also calls GET_SIM_STATUS to determine if the SIM is present ( ie. this triggers the call to ofono_sim_ inserted_ notify( ) ).
So, I need to re-examine the sim driver logic and see if it makes sense to de-couple the call to ofono_sim_ register( ) and the reply to the second GET_SIM_STATUS call.