mirror of git://git.sysmocom.de/ofono
sim: Tweak the behavior of sim_refresh slightly
Instead of notifying everyone of sim_inserted condition, we should simply notify the modem directly. It is the only one interested in this particular change. This partly reverts an earlier commit: 9498ad6b5633e350eb529f8efbe08270d95c8003
This commit is contained in:
parent
131d86a2f9
commit
ad181b690b
17
src/modem.c
17
src/modem.c
|
@ -598,13 +598,8 @@ static void sim_state_watch(enum ofono_sim_state new_state, void *user)
|
||||||
|
|
||||||
switch (new_state) {
|
switch (new_state) {
|
||||||
case OFONO_SIM_STATE_NOT_PRESENT:
|
case OFONO_SIM_STATE_NOT_PRESENT:
|
||||||
|
modem_change_state(modem, MODEM_STATE_PRE_SIM);
|
||||||
case OFONO_SIM_STATE_INSERTED:
|
case OFONO_SIM_STATE_INSERTED:
|
||||||
if (modem->modem_state != MODEM_STATE_PRE_SIM) {
|
|
||||||
if (modem->modem_state == MODEM_STATE_ONLINE)
|
|
||||||
modem->get_online = TRUE;
|
|
||||||
|
|
||||||
modem_change_state(modem, MODEM_STATE_PRE_SIM);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case OFONO_SIM_STATE_READY:
|
case OFONO_SIM_STATE_READY:
|
||||||
modem_change_state(modem, MODEM_STATE_OFFLINE);
|
modem_change_state(modem, MODEM_STATE_OFFLINE);
|
||||||
|
@ -1970,6 +1965,16 @@ void ofono_modem_reset(struct ofono_modem *modem)
|
||||||
modem_change_state(modem, MODEM_STATE_PRE_SIM);
|
modem_change_state(modem, MODEM_STATE_PRE_SIM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void __ofono_modem_sim_reset(struct ofono_modem *modem)
|
||||||
|
{
|
||||||
|
DBG("%p", modem);
|
||||||
|
|
||||||
|
if (modem->modem_state == MODEM_STATE_ONLINE)
|
||||||
|
modem->get_online = TRUE;
|
||||||
|
|
||||||
|
modem_change_state(modem, MODEM_STATE_PRE_SIM);
|
||||||
|
}
|
||||||
|
|
||||||
int ofono_modem_driver_register(const struct ofono_modem_driver *d)
|
int ofono_modem_driver_register(const struct ofono_modem_driver *d)
|
||||||
{
|
{
|
||||||
DBG("driver: %p, name: %s", d, d->name);
|
DBG("driver: %p, name: %s", d, d->name);
|
||||||
|
|
|
@ -207,6 +207,8 @@ unsigned int __ofono_modem_add_powered_watch(struct ofono_modem *modem,
|
||||||
void __ofono_modem_remove_powered_watch(struct ofono_modem *modem,
|
void __ofono_modem_remove_powered_watch(struct ofono_modem *modem,
|
||||||
unsigned int id);
|
unsigned int id);
|
||||||
|
|
||||||
|
void __ofono_modem_sim_reset(struct ofono_modem *modem);
|
||||||
|
|
||||||
#include <ofono/call-barring.h>
|
#include <ofono/call-barring.h>
|
||||||
|
|
||||||
gboolean __ofono_call_barring_is_busy(struct ofono_call_barring *cb);
|
gboolean __ofono_call_barring_is_busy(struct ofono_call_barring *cb);
|
||||||
|
|
|
@ -2481,7 +2481,6 @@ void __ofono_sim_refresh(struct ofono_sim *sim, GSList *file_list,
|
||||||
ofono_bool_t full_file_change, ofono_bool_t naa_init)
|
ofono_bool_t full_file_change, ofono_bool_t naa_init)
|
||||||
{
|
{
|
||||||
GSList *l;
|
GSList *l;
|
||||||
ofono_sim_state_event_cb_t notify;
|
|
||||||
gboolean reinit_naa = naa_init || full_file_change;
|
gboolean reinit_naa = naa_init || full_file_change;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -2540,16 +2539,10 @@ void __ofono_sim_refresh(struct ofono_sim *sim, GSList *file_list,
|
||||||
|
|
||||||
if (reinit_naa) {
|
if (reinit_naa) {
|
||||||
/* Force the sim state out of READY */
|
/* Force the sim state out of READY */
|
||||||
|
|
||||||
sim_free_main_state(sim);
|
sim_free_main_state(sim);
|
||||||
|
|
||||||
sim->state = OFONO_SIM_STATE_INSERTED;
|
sim->state = OFONO_SIM_STATE_INSERTED;
|
||||||
for (l = sim->state_watches->items; l; l = l->next) {
|
__ofono_modem_sim_reset(__ofono_atom_get_modem(sim->atom));
|
||||||
struct ofono_watchlist_item *item = l->data;
|
|
||||||
notify = item->notify;
|
|
||||||
|
|
||||||
notify(sim->state, item->notify_data);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue