From: Richard Röjfors <[email protected]>

To be considered attached on LTE a context should be activated.
But in case the context got deactivated we did not update
the attached state, it remained attached.
That caused the connection manager to try to re-activate the
context manually, but for LTE thats done automatically.
In the case of ublox it returns errors, which is passed
on to the connection manager, which tries again and
again, until we get attached again.

It looked like this:
12:03:18 ofonod[547]: Aux: < \r\n+CIEV: 2,3\r\n
12:03:23 ofonod[547]: Aux: < \r\n+CIEV: 2,2\r\n

Deactivated

12:16:01 ofonod[547]: Aux: < \r\n+CGEV: NW PDN DEACT 4\r\n
12:16:01 ofonod[547]: drivers/ubloxmodem/gprs-context.c:cgev_notify() cid 4, 
active cid: 4
12:16:01 ofonod[547]: src/gprs.c:ofono_gprs_context_deactivated() 0x1743e50 
0x17424a8 4

Connection manager now try to activate, over and over again
because Attached remains TRUE

12:16:01 ofonod[547]: 
drivers/ubloxmodem/gprs-context.c:ublox_gprs_activate_primary() cid 1
12:16:01 ofonod[547]: Aux: > AT+CGDCONT=1,"IP","apn"\r
12:16:01 ofonod[547]: Aux: < \r\nOK\r\n
12:16:01 ofonod[547]: drivers/ubloxmodem/gprs-context.c:cgdcont_cb() ok 1
12:16:01 ofonod[547]: Aux: > AT+CGACT=1,1\r
12:16:01 ofonod[547]: Aux: < \r\n+CME ERROR: 30\r\n
12:16:01 ofonod[547]: drivers/ubloxmodem/gprs-context.c:cgact_enable_cb() ok 0
12:16:01 ofonod[547]: src/gprs.c:pri_activate_callback() 0x17475c0
12:16:01 ofonod[547]: src/gprs.c:pri_activate_callback() Activating context 
failed with error: No network service
12:16:01 ofonod[547]: 
drivers/ubloxmodem/gprs-context.c:ublox_gprs_activate_primary() cid 1
12:16:02 ofonod[547]: Aux: > AT+CGDCONT=1,"IP","apn"\r
12:16:02 ofonod[547]: Aux: < \r\nOK\r\n
12:16:02 ofonod[547]: drivers/ubloxmodem/gprs-context.c:cgdcont_cb() ok 1
12:16:02 ofonod[547]: Aux: > AT+CGACT=1,1\r
12:16:02 ofonod[547]: Aux: < \r\n+CME ERROR: 30\r\n
12:16:02 ofonod[547]: drivers/ubloxmodem/gprs-context.c:cgact_enable_cb() ok 0
12:16:02 ofonod[547]: src/gprs.c:pri_activate_callback() 0x17475c0
12:16:02 ofonod[547]: src/gprs.c:pri_activate_callback() Activating context 
failed with error: No network service
.
.
.
12:16:14 ofonod[547]: 
drivers/ubloxmodem/gprs-context.c:ublox_gprs_activate_primary() cid 1
12:16:14 ofonod[547]: Aux: > AT+CGDCONT=1,"IP","apn"\r
12:16:14 ofonod[547]: Aux: < \r\nOK\r\n
12:16:14 ofonod[547]: drivers/ubloxmodem/gprs-context.c:cgdcont_cb() ok 1
12:16:14 ofonod[547]: Aux: > AT+CGACT=1,1\r
12:16:14 ofonod[547]: Aux: < \r\n+CME ERROR: 30\r\n
12:16:14 ofonod[547]: drivers/ubloxmodem/gprs-context.c:cgact_enable_cb() ok 0
12:16:14 ofonod[547]: src/gprs.c:pri_activate_callback() 0x17475c0
12:16:14 ofonod[547]: src/gprs.c:pri_activate_callback() Activating context 
failed with error: No network service
12:16:14 ofonod[547]: 
drivers/ubloxmodem/gprs-context.c:ublox_gprs_activate_primary() cid 1
12:16:14 ofonod[547]: Aux: > AT+CGDCONT=1,"IP","apn"\r
12:16:14 ofonod[547]: Aux: < \r\nOK\r\n
12:16:14 ofonod[547]: drivers/ubloxmodem/gprs-context.c:cgdcont_cb() ok 1
12:16:14 ofonod[547]: Aux: > AT+CGACT=1,1\r

The context got activated again

12:16:14 ofonod[547]: Aux: < \r\n+CGEV: ME PDN ACT 4\r\n\r\n+CIEV: 
9,2\r\n\r\n+CTZE: +04,0,"19/12/11,13:17:58"\r\n
12:16:14 ofonod[547]: drivers/ubloxmodem/network-registration.c:ctze_notify() 
tz +04 dst 0 time 19/12/11,13:17:58
12:16:14 ofonod[547]: src/network.c:ofono_netreg_time_notify() net time 
2019-12-11 13:17:58 utcoff 3600 dst 0
12:16:14 ofonod[547]: Aux: < \r\n+CME ERROR: 100\r\n
12:16:14 ofonod[547]: drivers/ubloxmodem/gprs-context.c:cgact_enable_cb() ok 0
12:16:14 ofonod[547]: src/gprs.c:pri_activate_callback() 0x17475c0
12:16:14 ofonod[547]: src/gprs.c:pri_activate_callback() Activating context 
failed with error: Unknown error
---
 src/gprs.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/gprs.c b/src/gprs.c
index 2d3a99e6..3d016d95 100644
--- a/src/gprs.c
+++ b/src/gprs.c
@@ -2730,14 +2730,15 @@ void ofono_gprs_context_deactivated(struct 
ofono_gprs_context *gc,
                                        unsigned int cid)
 {
        DBusConnection *conn = ofono_dbus_get_connection();
+       struct ofono_gprs *gprs = gc->gprs;
        GSList *l;
        struct pri_context *ctx;
        dbus_bool_t value;
 
-       if (gc->gprs == NULL)
+       if (gprs == NULL)
                return;
 
-       for (l = gc->gprs->contexts; l; l = l->next) {
+       for (l = gprs->contexts; l; l = l->next) {
                ctx = l->data;
 
                if (ctx->context.cid != cid)
@@ -2759,10 +2760,13 @@ void ofono_gprs_context_deactivated(struct 
ofono_gprs_context *gc,
         * If "Attached" property was about to be signalled as TRUE but there
         * were still active contexts, try again to signal "Attached" property
         * to registered applications after active contexts have been released.
+        *
+        * "Attached" could also change to FALSE in case of LTE and getting
+        * deactivated
         */
-       if (gc->gprs->flags & GPRS_FLAG_ATTACHED_UPDATE) {
-               gc->gprs->flags &= ~GPRS_FLAG_ATTACHED_UPDATE;
-               gprs_attached_update(gc->gprs);
+       if (on_lte(gprs) || gprs->flags & GPRS_FLAG_ATTACHED_UPDATE) {
+               gprs->flags &= ~GPRS_FLAG_ATTACHED_UPDATE;
+               gprs_attached_update(gprs);
        }
 }
 
-- 
2.20.1
_______________________________________________
ofono mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to