All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Handle NW DETACH and ME DETACH
@ 2015-07-03  8:43 Marko Sulejic
  2015-07-05 10:53 ` Denis Kenzior
  0 siblings, 1 reply; 2+ messages in thread
From: Marko Sulejic @ 2015-07-03  8:43 UTC (permalink / raw)
  To: ofono

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

From: August Mayer <august.mayer@hale.at>

 * According to the Telit AT reference, NW DETACH and ME DETACH
   imply network deactivation.
 * Handle in drivers/atmodem/gprs-context.c, function cgev_notify.
---
 drivers/atmodem/gprs-context.c | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/drivers/atmodem/gprs-context.c b/drivers/atmodem/gprs-context.c
index 7e9a43c..db32b17 100644
--- a/drivers/atmodem/gprs-context.c
+++ b/drivers/atmodem/gprs-context.c
@@ -360,20 +360,24 @@ static void cgev_notify(GAtResult *result, gpointer user_data)
 	if (!g_at_result_iter_next_unquoted_string(&iter, &event))
 		return;
 
-	if (g_str_has_prefix(event, "NW DEACT") == FALSE &&
+	if (g_str_has_prefix(event, "NW DETACH") == FALSE &&
+			g_str_has_prefix(event, "ME DETACH") == FALSE) {
+
+		if (g_str_has_prefix(event, "NW DEACT") == FALSE &&
 				g_str_has_prefix(event, "ME DEACT") == FALSE)
-		return;
+			return;
 
-	if (!g_at_result_iter_skip_next(&iter))
-		return;
+		if (!g_at_result_iter_skip_next(&iter))
+			return;
 
-	if (!g_at_result_iter_next_number(&iter, &cid))
-		return;
+		if (!g_at_result_iter_next_number(&iter, &cid))
+			return;
 
-	DBG("cid %d", cid);
+		DBG("cid %d", cid);
 
-	if ((unsigned int) cid != gcd->active_context)
-		return;
+		if ((unsigned int) cid != gcd->active_context)
+			return;
+	}
 
 	if (gcd->state != STATE_IDLE && gcd->ppp)
 		g_at_ppp_shutdown(gcd->ppp);
-- 
2.1.0


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

end of thread, other threads:[~2015-07-05 10:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-03  8:43 [PATCH] Handle NW DETACH and ME DETACH Marko Sulejic
2015-07-05 10:53 ` 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.