All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/5] Add ofono_modem_reset()
@ 2010-11-25 19:02 Gustavo F. Padovan
  2010-11-25 19:02 ` [PATCH 2/5] phonesim: Add modem reset trigger Gustavo F. Padovan
  2010-12-02 19:45 ` [PATCH 1/5] Add ofono_modem_reset() Denis Kenzior
  0 siblings, 2 replies; 9+ messages in thread
From: Gustavo F. Padovan @ 2010-11-25 19:02 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1425 bytes --]

Some modems can screw up everything and then we will need to do a silent
reset of the modem. This patch take the modem back to the OFFLINE state.
---
 include/modem.h |    2 ++
 src/modem.c     |   15 +++++++++++++++
 2 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/include/modem.h b/include/modem.h
index 7b13ee0..a92eb88 100644
--- a/include/modem.h
+++ b/include/modem.h
@@ -46,6 +46,8 @@ int ofono_modem_register(struct ofono_modem *modem);
 ofono_bool_t ofono_modem_is_registered(struct ofono_modem *modem);
 void ofono_modem_remove(struct ofono_modem *modem);
 
+void ofono_modem_reset(struct ofono_modem *modem);
+
 void ofono_modem_set_powered(struct ofono_modem *modem, ofono_bool_t powered);
 ofono_bool_t ofono_modem_get_powered(struct ofono_modem *modem);
 
diff --git a/src/modem.c b/src/modem.c
index f032d93..6233944 100644
--- a/src/modem.c
+++ b/src/modem.c
@@ -1615,6 +1615,21 @@ void ofono_modem_remove(struct ofono_modem *modem)
 	g_free(modem);
 }
 
+void ofono_modem_reset(struct ofono_modem *modem)
+{
+	int err;
+
+	DBG("%p", modem);
+
+	ofono_modem_set_powered(modem, FALSE);
+
+	err = set_powered(modem, TRUE);
+	if (err == -EINPROGRESS)
+		return;
+
+	modem_change_state(modem, MODEM_STATE_PRE_SIM);
+}
+
 int ofono_modem_driver_register(const struct ofono_modem_driver *d)
 {
 	DBG("driver: %p, name: %s", d, d->name);
-- 
1.7.3.2


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2010-12-02 20:08 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-25 19:02 [PATCH 1/5] Add ofono_modem_reset() Gustavo F. Padovan
2010-11-25 19:02 ` [PATCH 2/5] phonesim: Add modem reset trigger Gustavo F. Padovan
2010-11-25 19:02   ` [PATCH 3/5] modem: add support to restore state when resetting the modem Gustavo F. Padovan
2010-11-25 19:02     ` [PATCH 4/5] Add Lockdown property to Modem interface Gustavo F. Padovan
2010-11-25 19:02       ` [PATCH 5/5] Add test script for the Lockdown property Gustavo F. Padovan
2010-12-02 19:51         ` Denis Kenzior
2010-12-02 20:08       ` [PATCH 4/5] Add Lockdown property to Modem interface Denis Kenzior
2010-12-02 19:47     ` [PATCH 3/5] modem: add support to restore state when resetting the modem Denis Kenzior
2010-12-02 19:45 ` [PATCH 1/5] Add ofono_modem_reset() Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.