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(-)
diff --git a/src/emulator.c b/src/emulator.c
index 5744903..101b33d 100644
--- a/src/emulator.c
+++ b/src/emulator.c
@@ -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;
}
diff --git a/src/modem.c b/src/modem.c
index 8567cac..bf8b0c0 100644
--- a/src/modem.c
+++ b/src/modem.c
@@ -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;
diff --git a/src/ofono.h b/src/ofono.h
index f52356e..9d13684 100644
--- a/src/ofono.h
+++ b/src/ofono.h
@@ -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);
--
1.7.1
Show replies by date
Hi Frédéric,
On 02/17/2011 11:23 AM, Frédéric Danis wrote:
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