Skip to contentSkip to conversation

emulator: force creation of atom at modem offline state

PATCH In review Frédéric Danis 2 participants 2 messages Feb 17, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 emulator: force creation of atom at modem offline state

this allows to fix problem when atom created in online state are destroyed when modem goes to offline state

---
 src/emulator.c |    3 ++-
 src/modem.c    |   14 ++++++++++++++
 src/ofono.h    |    5 +++++
 3 files changed, 21 insertions(+), 1 deletions(-)
src/emulator.c +2 -1
index 5744903..101b33d 100644
@@ -115,7 +115,8 @@ struct ofono_emulator *ofono_emulator_create(struct ofono_modem *modem,
 
 	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;
 }
src/modem.c +14 -0
index 8567cac..bf8b0c0 100644
@@ -189,6 +189,20 @@ struct ofono_atom *__ofono_modem_add_atom(struct ofono_modem *modem,
 	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)
 {
 	return atom->data;
src/ofono.h +5 -0
index f52356e..9d13684 100644
@@ -148,6 +148,11 @@ struct ofono_atom *__ofono_modem_add_atom(struct ofono_modem *modem,
 					void (*destruct)(struct ofono_atom *),
 					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,
 						enum ofono_atom_type type);
 
Signature · 1 line
1.7.1
#1 lore raw

Hi Frédéric,

Quoted 8 lines · Frédéric Danis

this allows to fix problem when atom created in online state are destroyed when modem goes to offline state

---
 src/emulator.c |    3 ++-
 src/modem.c    |   14 ++++++++++++++
 src/ofono.h    |    5 +++++
 3 files changed, 21 insertions(+), 1 deletions(-)

Patch has been applied, thanks.

Regards,
-Denis