Shutdown PPP session if modem did not do it.
---
drivers/atmodem/gprs-context.c | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/drivers/atmodem/gprs-context.c b/drivers/atmodem/gprs-context.c
index 16893ce..100c80b 100644
--- a/drivers/atmodem/gprs-context.c
+++ b/drivers/atmodem/gprs-context.c
@@ -239,6 +239,17 @@ static void at_gprs_activate_primary(struct
ofono_gprs_context *gc,
memcpy(gcd->username, ctx->username, sizeof(ctx->username));
memcpy(gcd->password, ctx->password, sizeof(ctx->password));
+ /*
+ * For some modem, mainly Huawei branded, when GPRS is no more attached
+ * to the network, oFono core will reset context although the modem
+ * has not ended ppp sesssion at driver level.
+ * In this case trigger a disconnection manually and send an error.
+ */
+ if (gcd->ppp != NULL && gcd->state == STATE_ACTIVE) {
+ g_at_ppp_shutdown(gcd->ppp);
+ goto error;
+ }
+
gcd->state = STATE_ENABLING;
if (gcd->vendor == OFONO_VENDOR_ZTE) {
--
1.7.4.1
_______________________________________________
ofono mailing list
[email protected]
http://lists.ofono.org/listinfo/ofono