mirror of git://git.sysmocom.de/ofono
emulator: always create emulators in offline state
this allows to fix problem when atom created in online state are destroyed when modem goes to offline state
This commit is contained in:
parent
de02942e77
commit
afe16ba22a
|
@ -115,7 +115,8 @@ struct ofono_emulator *ofono_emulator_create(struct ofono_modem *modem,
|
||||||
|
|
||||||
em->type = type;
|
em->type = type;
|
||||||
|
|
||||||
em->atom = __ofono_modem_add_atom(modem, atom_t, emulator_remove, em);
|
em->atom = __ofono_modem_add_atom_offline(modem, atom_t,
|
||||||
|
emulator_remove, em);
|
||||||
|
|
||||||
return em;
|
return em;
|
||||||
}
|
}
|
||||||
|
|
14
src/modem.c
14
src/modem.c
|
@ -189,6 +189,20 @@ struct ofono_atom *__ofono_modem_add_atom(struct ofono_modem *modem,
|
||||||
return atom;
|
return atom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct ofono_atom *__ofono_modem_add_atom_offline(struct ofono_modem *modem,
|
||||||
|
enum ofono_atom_type type,
|
||||||
|
void (*destruct)(struct ofono_atom *),
|
||||||
|
void *data)
|
||||||
|
{
|
||||||
|
struct ofono_atom *atom;
|
||||||
|
|
||||||
|
atom = __ofono_modem_add_atom(modem, type, destruct, data);
|
||||||
|
|
||||||
|
atom->modem_state = MODEM_STATE_OFFLINE;
|
||||||
|
|
||||||
|
return atom;
|
||||||
|
}
|
||||||
|
|
||||||
void *__ofono_atom_get_data(struct ofono_atom *atom)
|
void *__ofono_atom_get_data(struct ofono_atom *atom)
|
||||||
{
|
{
|
||||||
return atom->data;
|
return atom->data;
|
||||||
|
|
|
@ -148,6 +148,11 @@ struct ofono_atom *__ofono_modem_add_atom(struct ofono_modem *modem,
|
||||||
void (*destruct)(struct ofono_atom *),
|
void (*destruct)(struct ofono_atom *),
|
||||||
void *data);
|
void *data);
|
||||||
|
|
||||||
|
struct ofono_atom *__ofono_modem_add_atom_offline(struct ofono_modem *modem,
|
||||||
|
enum ofono_atom_type type,
|
||||||
|
void (*destruct)(struct ofono_atom *),
|
||||||
|
void *data);
|
||||||
|
|
||||||
struct ofono_atom *__ofono_modem_find_atom(struct ofono_modem *modem,
|
struct ofono_atom *__ofono_modem_find_atom(struct ofono_modem *modem,
|
||||||
enum ofono_atom_type type);
|
enum ofono_atom_type type);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue