Hi, I use a Huawei MS2372h-607. It is a classical AT+PPP modem. I have a problem when I stop ofono while context is activated. When I restart ofono (without unplugging the modem), I am not able to send any AT command on Modem channel because this channel is still in data mode.
I made a patch to send escape sequence when gprs-context atom is removed. It fixes the problem but I don't know if this is the right thing to do. Attached to this mail: I/ reconnectError_01: traces of complete test (with debug and AT debug). Test done: 1) board boot 2) Connection (success), start at line 1058: connmanctl connect cellular... 3) stop ofono, start at line 1109: /etc/init.d/ofono stop 4) start ofono, start at line 1348: /etc/init.d/ofono start 5) Connection (error), start at line 2018: connmanctl connect cellular... I don't have PPP debug in this trace but here is what happens at PPP level when Ofono is stopped: ofonod[944]: ../ofono-1.24/drivers/atmodem/gprs-context.c:at_gprs_detach_shutdown() cid 0 ofonod[944]: PPP: lcp: pppcp_generate_event: current state 9:OPENED ofonod[944]: PPP: event: 3 (Close), action: 8224, new_state: 4 (CLOSING) ofonod[944]: PPP: lcp: pppcp_initialize_restart_count: current state 9:OPENED ofonod[944]: PPP: lcp: pppcp_send_terminate_request: current state 9:OPENED ofonod[944]: PPP: ipcp: pppcp_generate_event: current state 9:OPENED ofonod[944]: PPP: event: 1 (Down), action: 201, new_state: 1 (STARTING) ofonod[944]: PPP: ../ofono-1.24/gatchat/gatppp.c:ppp_enter_phase() 5 ofonod[944]: ../ofono-1.24/src/gprs.c:gprs_context_unregister() 0xc10ed0, 0xc10d90 ofonod[944]: ../ofono-1.24/src/gprs.c:gprs_context_remove() atom: 0xc10ef0 ofonod[944]: ../ofono-1.24/drivers/atmodem/gprs-context.c:at_gprs_context_remove() ofonod[944]: ../ofono-1.24/src/gprs.c:gprs_unregister() 0xc10d90 Terminate request is sent and then gprs-context atom is removed before Terminate Ack is received. II/ 0001-PPP-send-escape-sequence-when-ofono-dies.patch The patch I made to fix the problem. The idea is to immediately send escape sequence when removing gprs-context atom. This patch is not ready to be sent (at least it must be split in two patches). Can you tell me what you think about this patch? Best Regards, Christophe Ronco
From 124a67db2437b4619bb2a42d7776fa3b1aeab50c Mon Sep 17 00:00:00 2001 From: Christophe Ronco <[email protected]> Date: Thu, 12 Jul 2018 18:04:44 +0200 Subject: [PATCH 1/1] PPP: send escape sequence when ofono dies When ofono dies while connected using PPP, AT channel is not put back to command mode. If ofono is restarted, it won't be able to connect as it gets no answer to AT commands on this AT channel. --- drivers/atmodem/gprs-context.c | 1 + gatchat/gatppp.c | 16 ++++++++++++++++ gatchat/gatppp.h | 1 + 3 files changed, 18 insertions(+) diff --git a/drivers/atmodem/gprs-context.c b/drivers/atmodem/gprs-context.c index 42ec556..5761b3c 100644 --- a/drivers/atmodem/gprs-context.c +++ b/drivers/atmodem/gprs-context.c @@ -465,6 +465,7 @@ static void at_gprs_context_remove(struct ofono_gprs_context *gc) DBG(""); if (gcd->state != STATE_IDLE && gcd->ppp) { + g_at_ppp_send_escape_sequence(gcd->ppp); g_at_ppp_unref(gcd->ppp); g_at_chat_resume(gcd->chat); } diff --git a/gatchat/gatppp.c b/gatchat/gatppp.c index 4a80b4b..dbb99e3 100644 --- a/gatchat/gatppp.c +++ b/gatchat/gatppp.c @@ -712,6 +712,22 @@ static gboolean send_escape_sequence(gpointer user_data) return FALSE; } +void g_at_ppp_send_escape_sequence(GAtPPP *ppp) +{ + GAtIO *io; + + DBG(ppp, ""); + if (ppp == NULL) + return; + + io = g_at_hdlc_get_io(ppp->hdlc); + + if (io == NULL) + return; + + g_at_io_write(io, "+++", 3); +} + void g_at_ppp_suspend(GAtPPP *ppp) { if (ppp == NULL) diff --git a/gatchat/gatppp.h b/gatchat/gatppp.h index 213f7e9..ffd6879 100644 --- a/gatchat/gatppp.h +++ b/gatchat/gatppp.h @@ -69,6 +69,7 @@ void g_at_ppp_set_suspend_function(GAtPPP *ppp, GAtSuspendFunc func, gpointer user_data); void g_at_ppp_set_debug(GAtPPP *ppp, GAtDebugFunc func, gpointer user_data); void g_at_ppp_shutdown(GAtPPP *ppp); +void g_at_ppp_send_escape_sequence(GAtPPP *ppp); void g_at_ppp_suspend(GAtPPP *ppp); void g_at_ppp_resume(GAtPPP *ppp); void g_at_ppp_ref(GAtPPP *ppp); -- 2.7.4
reconnectError_01.tar.gz
Description: application/gzip
_______________________________________________ ofono mailing list [email protected] https://lists.ofono.org/mailman/listinfo/ofono
