When ofono dies while connected using PPP, modem AT channel is not put
back to command mode (tested with HUAWEI modems E3372 and MS2372).
If ofono is restarted, it won't be able to connect as it gets no answer
to AT commands on this AT channel.
This patch adds a quirk to immediately send escape sequence on modem
channel when gprs-context atom is removed.
---
 drivers/atmodem/gprs-context.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/atmodem/gprs-context.c b/drivers/atmodem/gprs-context.c
index 42ec556..79ac4c8 100644
--- a/drivers/atmodem/gprs-context.c
+++ b/drivers/atmodem/gprs-context.c
@@ -461,10 +461,19 @@ static int at_gprs_context_probe(struct 
ofono_gprs_context *gc,
 static void at_gprs_context_remove(struct ofono_gprs_context *gc)
 {
        struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
+       GAtIO *io;
 
        DBG("");
 
        if (gcd->state != STATE_IDLE && gcd->ppp) {
+               if ((gcd->vendor == OFONO_VENDOR_HUAWEI) && gcd->chat) {
+                       /* immediately send escape sequence */
+                       io = g_at_chat_get_io(gcd->chat);
+
+                       if (io)
+                               g_at_io_write(io, "+++", 3);
+               }
+
                g_at_ppp_unref(gcd->ppp);
                g_at_chat_resume(gcd->chat);
        }
-- 
2.7.4

_______________________________________________
ofono mailing list
[email protected]
https://lists.ofono.org/mailman/listinfo/ofono

Reply via email to