Skip to contentSkip to conversation

ublox: gprs: React on context deactivation

PATCH Applied [email protected] 3 participants 4 messages Sep 2, 2019 – Sep 3, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ublox: gprs: React on context deactivation

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

In case a context get deactivated when a AT+CGACT=0 is not issued, indicate that to gprs core.
This can happen if the device has an auto activated LTE context and modem switches over to for instance UTRAN.

---
 drivers/ubloxmodem/gprs-context.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
drivers/ubloxmodem/gprs-context.c +14 -1
index ff78a42a..188c2c62 100644
@@ -40,6 +40,8 @@
 
 #include "ubloxmodem.h"
 
+#define UBLOX_FLAG_DEACTIVATING 0x01
+
 static const char *none_prefix[] = { NULL };
 static const char *cgcontrdp_prefix[] = { "+CGCONTRDP:", NULL };
 static const char *uipaddr_prefix[] = { "+UIPADDR:", NULL };
@@ -57,6 +59,7 @@ struct gprs_context_data {
 	ofono_gprs_context_cb_t cb;
 	void *cb_data;
 	enum netmode networking_mode;
+	int flags;
 };
 
 static void uipaddr_cb(gboolean ok, GAtResult *result, gpointer user_data)
@@ -426,6 +429,8 @@ static void cgact_disable_cb(gboolean ok, GAtResult *result, gpointer user_data)
 
 	DBG("ok %d", ok);
 
+	gcd->flags &= ~UBLOX_FLAG_DEACTIVATING;
+
 	if (!ok) {
 		CALLBACK_WITH_FAILURE(gcd->cb, gcd->cb_data);
 		return;
@@ -448,6 +453,8 @@ static void ublox_gprs_deactivate_primary(struct ofono_gprs_context *gc,
 	gcd->cb = cb;
 	gcd->cb_data = data;
 
+	gcd->flags |= UBLOX_FLAG_DEACTIVATING;
+
 	snprintf(buf, sizeof(buf), "AT+CGACT=0,%u", gcd->active_context);
 	g_at_chat_send(gcd->chat, buf, none_prefix,
 			cgact_disable_cb, gc, NULL);
@@ -473,10 +480,16 @@ static void cgev_notify(GAtResult *result, gpointer user_data)
 		sscanf(event, "%*s %*s %*s %u", &cid);
 	else if (g_str_has_prefix(event, "NW DEACT"))
 		sscanf(event, "%*s %*s %u", &cid);
+	else if (!(gcd->flags & UBLOX_FLAG_DEACTIVATING) &&
+		 g_str_has_prefix(event, "ME PDN DEACT"))
+		/* The modem might consider the ME deactivating without
+		 * an explicit CGACT=0 beeing sent
+		 */
+		sscanf(event, "%*s %*s %*s %u", &cid);
 	else
 		return;
 
-	DBG("cid %d", cid);
+	DBG("cid %d, active cid: %d", cid, gcd->active_context);
 
 	if ((unsigned int) cid != gcd->active_context)
 		return;
Signature · 1 line
2.20.1
#1 lore raw

Hi Richard,

Quoted 10 lines · richard.rojfors(a)gmail.com

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

In case a context get deactivated when a AT+CGACT=0 is not issued, indicate that to gprs core.
This can happen if the device has an auto activated LTE context and modem switches over to for instance UTRAN.

---
  drivers/ubloxmodem/gprs-context.c | 15 ++++++++++++++-
  1 file changed, 14 insertions(+), 1 deletion(-)

Applied, thanks.

Regards,
-Denis

#2 lore raw
In reply to [email protected]

Hi,

An example log when this happened. In this case ofono thought context 4 was still activated
even though it was deactivated

12:47:52 info: Aux: < \r\n+CIEV: 9,2\r\n
12:50:37 info: Aux: < \r\n+CIEV: 2,2\r\n
12:50:42 info: Aux: < \r\n+CIEV: 2,1\r\n
12:51:06 info: Aux: < \r\n+CIEV: 2,0\r\n
12:51:08 info: Aux: < \r\n+CGREG: 5,"004B","0000E404",6,"01"\r\n 12:51:08 debug: ../git/src/gprs.c:ofono_gprs_status_notify() /ublox_0 status roaming (5)
12:51:08 info: Aux: < \r\n+UREG: 6\r\n
12:51:08 info: Aux: < \r\n+CIEV: 9,2\r\n
12:51:08 info: Aux: < \r\n+CIEV: 9,1\r\n
12:51:09 info: Aux: < \r\n+CGEV: NW MODIFY 4,0,0\r\n
12:51:16 info: Aux: < \r\n+CREG: 0\r\n
12:51:16 debug: ../git/src/network.c:ofono_netreg_status_notify() /ublox_0 status 0 tech -1 lac -1 ci -1
12:51:16 debug: ../git/src/network.c:current_operator_callback() 0x6f2440, 0x6f2fe8
12:51:16 debug: ../git/src/gprs.c:netreg_status_changed() 0 (unregistered) 12:51:16 debug: ../git/src/gprs.c:gprs_netreg_update() attach: 0,
driver_attached: 1
12:51:16 debug: ../git/src/gprs.c:netreg_status_changed() 0 (unregistered) 12:51:16 debug: ../git/src/gprs.c:gprs_netreg_update() attach: 0,
driver_attached: 0
12:51:16 info: Aux: > AT\r
12:51:16 info: Aux: < \r\n+CIEV: 7,0\r\n
12:51:16 info: Aux: < \r\nOK\r\n
12:51:16 info: Aux: Finally woke up the modem
12:51:16 info: Aux: > AT+CGATT=0\r
12:51:16 info: Aux: < \r\n+CGREG: 4\r\n
12:51:16 debug: ../git/src/gprs.c:ofono_gprs_status_notify() /ublox_0 status unknown (4)
12:51:16 info: Aux: < \r\n+UREG: 0\r\n
12:51:16 info: Aux: < \r\n+CIEV: 9,1\r\n
12:51:16 info: Aux: < \r\nOK\r\n
12:51:16 debug: ../git/src/gprs.c:gprs_attach_callback() /ublox_0 error = 0 12:51:16 info: Aux: > AT+CGREG?\r
12:51:16 info: Aux: < \r\n+CGREG: 2,4\r\n
12:51:16 info: Aux: < \r\nOK\r\n
12:51:16 debug: ../git/src/gprs.c:registration_status_cb() /ublox_0 error 0 status 4
12:51:16 debug: ../git/src/gprs.c:ofono_gprs_status_notify() /ublox_0 status unknown (4)
12:51:27 info: Aux: < \r\n+CREG: 0\r\n
12:51:27 debug: ../git/src/network.c:ofono_netreg_status_notify() /ublox_0 status 0 tech -1 lac -1 ci -1
12:51:27 debug: ../git/src/network.c:current_operator_callback() 0x6f2440, (nil)
12:51:27 debug: ../git/src/gprs.c:netreg_status_changed() 0 (unregistered) 12:51:27 debug: ../git/src/gprs.c:gprs_netreg_update() attach: 0,
driver_attached: 0
12:51:27 info: Aux: < \r\n+CIEV: 2,2\r\n
12:51:30 info: Aux: < \r\n+CTZE: +08,1,"19/09/03,14:51:29"\r\n 12:51:30 debug:
../git/drivers/ubloxmodem/network-registration.c:ctze_notify() tz +08 dst 1 time 19/09/03,14:51:29
12:51:30 debug: ../git/src/network.c:ofono_netreg_time_notify() net time

2019-09-03 14:51:29 utcoff 7200 dst 1

12:51:30 info: Aux: < \r\n+CREG: 5,"0080","00000006",2\r\n 12:51:30 debug: ../git/src/network.c:ofono_netreg_status_notify() /ublox_0 status 5 tech 2 lac 128 ci 6
12:51:30 debug: ../git/src/gprs.c:netreg_status_changed() 5 (roaming) 12:51:30 debug: ../git/src/gprs.c:gprs_netreg_update() attach: 1,
driver_attached: 0
12:51:30 info: Aux: > AT\r
12:51:30 info: Aux: < \r\n+CIEV: 7,1\r\n
12:51:30 info: Aux: < \r\nOK\r\n
12:51:30 info: Aux: Finally woke up the modem
12:51:30 info: Aux: > AT+COPS=3,2\r
12:51:30 info: Aux: < \r\nOK\r\n
12:51:30 info: Aux: > AT+COPS?\r
12:51:30 info: Aux: < \r\n+COPS: 0,2,"24002",2\r\n
12:51:30 info: Aux: < \r\nOK\r\n
12:51:30 debug:
../git/drivers/atmodem/network-registration.c:cops_numeric_cb() Cops numeric got mcc: 240, mnc: 02
12:51:30 info: Aux: > AT+CSQ\r
12:51:30 info: Aux: < \r\n+CSQ: 11,1\r\n
12:51:30 info: Aux: < \r\nOK\r\n
12:51:30 debug: ../git/drivers/atmodem/network-registration.c:csq_cb()
csq_cb: 11
12:51:30 debug: ../git/src/network.c:ofono_netreg_strength_notify() strength 35
12:51:30 info: Aux: > AT+CGATT=1\r
12:51:37 info: Aux: < \r\n+CME ERROR: 148\r\n
12:51:37 debug: ../git/src/gprs.c:gprs_attach_callback() /ublox_0 error = 1 12:51:37 info: Aux: > AT+COPS=3,0\r
12:51:37 info: Aux: < \r\n+CIEV: 2,3\r\n
12:51:37 info: Aux: < \r\n+CREG: 0\r\n
12:51:37 debug: ../git/src/network.c:ofono_netreg_status_notify() /ublox_0 status 0 tech -1 lac -1 ci -1
12:51:37 debug: ../git/src/network.c:current_operator_callback() 0x6f2440, (nil)
12:51:37 debug: ../git/src/gprs.c:netreg_status_changed() 0 (unregistered) 12:51:37 debug: ../git/src/gprs.c:gprs_netreg_update() attach: 0,
driver_attached: 0
12:51:37 info: Aux: < \r\n+CIEV: 7,0\r\n\r\n+CREG: 3\r\n 12:51:37 debug: ../git/src/network.c:ofono_netreg_status_notify() /ublox_0 status 3 tech -1 lac -1 ci -1
12:51:37 debug: ../git/src/network.c:current_operator_callback() 0x6f2440, (nil)
12:51:37 debug: ../git/src/gprs.c:netreg_status_changed() 3 (denied) 12:51:37 debug: ../git/src/gprs.c:gprs_netreg_update() attach: 0,
driver_attached: 0
12:51:37 info: Aux: < \r\nOK\r\n
12:51:37 info: Aux: > AT+COPS?\r
12:51:37 info: Aux: < \r\n+COPS: 0\r\n
12:51:37 info: Aux: < \r\nOK\r\n
12:51:37 debug: ../git/src/network.c:current_operator_callback() 0x6f2440, (nil)
12:51:37 info: Aux: > AT+CGREG?\r
12:51:37 info: Aux: < \r\n+CGREG: 2,3\r\n
12:51:37 info: Aux: < \r\nOK\r\n
12:51:37 debug: ../git/src/gprs.c:registration_status_cb() /ublox_0 error 0 status 3
12:51:37 debug: ../git/src/gprs.c:ofono_gprs_status_notify() /ublox_0 status denied (3)
12:51:47 info: Aux: < \r\n+CIEV: 2,1\r\n
12:51:48 info: Aux: < \r\n+CIEV: 2,2\r\n
12:51:49 info: Aux: < \r\n+CIEV: 2,1\r\n
12:51:50 info: Aux: < \r\n+CREG: 0\r\n
12:51:50 debug: ../git/src/network.c:ofono_netreg_status_notify() /ublox_0 status 0 tech -1 lac -1 ci -1
12:51:50 debug: ../git/src/network.c:current_operator_callback() 0x6f2440, (nil)
12:51:50 debug: ../git/src/gprs.c:netreg_status_changed() 0 (unregistered) 12:51:50 debug: ../git/src/gprs.c:gprs_netreg_update() attach: 0,
driver_attached: 0
12:51:50 info: Aux: < \r\n+CGREG: 5,"4E85","000003EA",2,"01"\r\n 12:51:50 debug: ../git/src/gprs.c:ofono_gprs_status_notify() /ublox_0 status roaming (5)
12:51:50 info: Aux: < \r\n+UREG: 3\r\n
12:51:50 info: Aux: < \r\n+CIEV: 9,2\r\n
12:51:50 info: Aux: < \r\n+CTZE: +08,1,"19/09/03,14:51:50"\r\n 12:51:50 debug:
../git/drivers/ubloxmodem/network-registration.c:ctze_notify() tz +08 dst 1 time 19/09/03,14:51:50
12:51:50 debug: ../git/src/network.c:ofono_netreg_time_notify() net time

2019-09-03 14:51:50 utcoff 7200 dst 1

12:51:50 info: Aux: < \r\n+CREG: 5,"0E63","8CD17D00",2\r\n 12:51:50 debug: ../git/src/network.c:ofono_netreg_status_notify() /ublox_0 status 5 tech 2 lac 3683 ci 2147483647
12:51:50 debug: ../git/src/gprs.c:netreg_status_changed() 5 (roaming) 12:51:50 debug: ../git/src/gprs.c:gprs_netreg_update() attach: 1,
driver_attached: 1
12:51:50 info: Aux: > AT\r
12:51:50 info: Aux: < \r\n+CIEV: 7,1\r\n
12:51:50 info: Aux: < \r\nOK\r\n
12:51:50 info: Aux: Finally woke up the modem
12:51:50 info: Aux: > AT+COPS=3,2\r
12:51:50 info: Aux: < \r\nOK\r\n
12:51:50 info: Aux: > AT+COPS?\r
12:51:50 info: Aux: < \r\n+COPS: 0,2,"24002",2\r\n
12:51:50 info: Aux: < \r\nOK\r\n
12:51:50 debug:
../git/drivers/atmodem/network-registration.c:cops_numeric_cb() Cops numeric got mcc: 240, mnc: 02
12:51:50 info: Aux: > AT+CSQ\r
12:51:50 info: Aux: < \r\n+CSQ: 8,1\r\n
12:51:50 info: Aux: < \r\nOK\r\n
12:51:50 debug: ../git/drivers/atmodem/network-registration.c:csq_cb()
csq_cb: 8
12:51:50 debug: ../git/src/network.c:ofono_netreg_strength_notify() strength 25
12:51:50 info: Aux: > AT+COPS=3,0\r
12:51:50 info: Aux: < \r\nOK\r\n
12:51:50 info: Aux: > AT+COPS?\r
12:51:50 info: Aux: < \r\n+COPS: 0,0,"3 SE",2\r\n
12:51:50 info: Aux: < \r\nOK\r\n
12:51:50 debug: ../git/drivers/atmodem/network-registration.c:cops_cb()
cops_cb: 3 SE, 240 02 2
12:51:50 debug: ../git/src/network.c:current_operator_callback() 0x6f2440, (nil)
12:51:50 debug: ../git/src/gprs.c:netreg_status_changed() 5 (roaming) 12:51:50 debug: ../git/src/gprs.c:gprs_netreg_update() attach: 1,
driver_attached: 1
12:51:52 info: Aux: < \r\n+CGEV: ME PDN DEACT 4\r\n
12:51:53 info: Aux: < \r\n+CIEV: 2,2\r\n
12:52:03 info: Aux: < \r\n+CIEV: 2,1\r\n
12:52:08 info: Aux: < \r\n+CIEV: 2,2\r\n
12:52:14 info: Aux: < \r\n+CIEV: 2,1\r\n

Den tis 3 sep. 2019 kl 16:06 skrev <[email protected]>:

Quoted 75 lines

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

In case a context get deactivated when a AT+CGACT=0 is not issued, indicate that to gprs core.
This can happen if the device has an auto activated LTE context and modem switches over to for instance UTRAN.

---
 drivers/ubloxmodem/gprs-context.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
drivers/ubloxmodem/gprs-context.c +5 -0
index ff78a42a..188c2c62 100644
@@ -40,6 +40,8 @@
 
 #include "ubloxmodem.h"
 
+#define UBLOX_FLAG_DEACTIVATING 0x01
+
 static const char *none_prefix[] = { NULL };
 static const char *cgcontrdp_prefix[] = { "+CGCONTRDP:", NULL };
 static const char *uipaddr_prefix[] = { "+UIPADDR:", NULL };
@@ -57,6 +59,7 @@ struct gprs_context_data {
        ofono_gprs_context_cb_t cb;
        void *cb_data;
        enum netmode networking_mode;
+       int flags;
 };
 
 static void uipaddr_cb(gboolean ok, GAtResult *result, gpointer user_data)
@@ -426,6 +429,8 @@ static void cgact_disable_cb(gboolean ok, GAtResult
 *result, gpointer user_data)
 
        DBG("ok %d", ok);
 
+       gcd->flags &= ~UBLOX_FLAG_DEACTIVATING;
+
        if (!ok) {
                CALLBACK_WITH_FAILURE(gcd->cb, gcd->cb_data);
                return;
drivers/ubloxmodem/gprs-context.c +2 -0
@@ -448,6 +453,8 @@ static void ublox_gprs_deactivate_primary(struct
 ofono_gprs_context *gc,
        gcd->cb = cb;
        gcd->cb_data = data;
 
+       gcd->flags |= UBLOX_FLAG_DEACTIVATING;
+
        snprintf(buf, sizeof(buf), "AT+CGACT=0,%u", gcd->active_context);
        g_at_chat_send(gcd->chat, buf, none_prefix,
                        cgact_disable_cb, gc, NULL);
drivers/ubloxmodem/gprs-context.c +7 -1
@@ -473,10 +480,16 @@ static void cgev_notify(GAtResult *result, gpointer
 user_data)
                sscanf(event, "%*s %*s %*s %u", &cid);
        else if (g_str_has_prefix(event, "NW DEACT"))
                sscanf(event, "%*s %*s %u", &cid);
+       else if (!(gcd->flags & UBLOX_FLAG_DEACTIVATING) &&
+                g_str_has_prefix(event, "ME PDN DEACT"))
+               /* The modem might consider the ME deactivating without
+                * an explicit CGACT=0 beeing sent
+                */
+               sscanf(event, "%*s %*s %*s %u", &cid);
        else
                return;
 
-       DBG("cid %d", cid);
+       DBG("cid %d, active cid: %d", cid, gcd->active_context);
 
        if ((unsigned int) cid != gcd->active_context)
                return;

--
2.20.1

#3 lore raw
Quoted 6 lines · On Tue, Sep 3, 2019, 16:11 Richard Röjfors <[email protected]> wrote:

Hi,

An example log when this happened. In this case ofono thought context 4 was still activated
even though it was deactivated

Yes, I've seen this, too, and have a similar patch that I never got around to sending. Please apply.

/Jonas

Quoted 258 lines

12:47:52 info: Aux: < \r\n+CIEV: 9,2\r\n
12:50:37 info: Aux: < \r\n+CIEV: 2,2\r\n
12:50:42 info: Aux: < \r\n+CIEV: 2,1\r\n
12:51:06 info: Aux: < \r\n+CIEV: 2,0\r\n
12:51:08 info: Aux: < \r\n+CGREG: 5,"004B","0000E404",6,"01"\r\n 12:51:08 debug: ../git/src/gprs.c:ofono_gprs_status_notify() /ublox_0 status roaming (5)
12:51:08 info: Aux: < \r\n+UREG: 6\r\n
12:51:08 info: Aux: < \r\n+CIEV: 9,2\r\n
12:51:08 info: Aux: < \r\n+CIEV: 9,1\r\n
12:51:09 info: Aux: < \r\n+CGEV: NW MODIFY 4,0,0\r\n
12:51:16 info: Aux: < \r\n+CREG: 0\r\n
12:51:16 debug: ../git/src/network.c:ofono_netreg_status_notify() /ublox_0 status 0 tech -1 lac -1 ci -1
12:51:16 debug: ../git/src/network.c:current_operator_callback() 0x6f2440, 0x6f2fe8
12:51:16 debug: ../git/src/gprs.c:netreg_status_changed() 0 (unregistered) 12:51:16 debug: ../git/src/gprs.c:gprs_netreg_update() attach: 0,
driver_attached: 1
12:51:16 debug: ../git/src/gprs.c:netreg_status_changed() 0 (unregistered) 12:51:16 debug: ../git/src/gprs.c:gprs_netreg_update() attach: 0,
driver_attached: 0
12:51:16 info: Aux: > AT\r
12:51:16 info: Aux: < \r\n+CIEV: 7,0\r\n
12:51:16 info: Aux: < \r\nOK\r\n
12:51:16 info: Aux: Finally woke up the modem
12:51:16 info: Aux: > AT+CGATT=0\r
12:51:16 info: Aux: < \r\n+CGREG: 4\r\n
12:51:16 debug: ../git/src/gprs.c:ofono_gprs_status_notify() /ublox_0 status unknown (4)
12:51:16 info: Aux: < \r\n+UREG: 0\r\n
12:51:16 info: Aux: < \r\n+CIEV: 9,1\r\n
12:51:16 info: Aux: < \r\nOK\r\n
12:51:16 debug: ../git/src/gprs.c:gprs_attach_callback() /ublox_0 error = 0 12:51:16 info: Aux: > AT+CGREG?\r
12:51:16 info: Aux: < \r\n+CGREG: 2,4\r\n
12:51:16 info: Aux: < \r\nOK\r\n
12:51:16 debug: ../git/src/gprs.c:registration_status_cb() /ublox_0 error 0 status 4
12:51:16 debug: ../git/src/gprs.c:ofono_gprs_status_notify() /ublox_0 status unknown (4)
12:51:27 info: Aux: < \r\n+CREG: 0\r\n
12:51:27 debug: ../git/src/network.c:ofono_netreg_status_notify() /ublox_0 status 0 tech -1 lac -1 ci -1
12:51:27 debug: ../git/src/network.c:current_operator_callback() 0x6f2440, (nil)
12:51:27 debug: ../git/src/gprs.c:netreg_status_changed() 0 (unregistered) 12:51:27 debug: ../git/src/gprs.c:gprs_netreg_update() attach: 0,
driver_attached: 0
12:51:27 info: Aux: < \r\n+CIEV: 2,2\r\n
12:51:30 info: Aux: < \r\n+CTZE: +08,1,"19/09/03,14:51:29"\r\n 12:51:30 debug:
../git/drivers/ubloxmodem/network-registration.c:ctze_notify() tz +08 dst 1 time 19/09/03,14:51:29
12:51:30 debug: ../git/src/network.c:ofono_netreg_time_notify() net time

2019-09-03 14:51:29 utcoff 7200 dst 1

12:51:30 info: Aux: < \r\n+CREG: 5,"0080","00000006",2\r\n 12:51:30 debug: ../git/src/network.c:ofono_netreg_status_notify() /ublox_0 status 5 tech 2 lac 128 ci 6
12:51:30 debug: ../git/src/gprs.c:netreg_status_changed() 5 (roaming) 12:51:30 debug: ../git/src/gprs.c:gprs_netreg_update() attach: 1,
driver_attached: 0
12:51:30 info: Aux: > AT\r
12:51:30 info: Aux: < \r\n+CIEV: 7,1\r\n
12:51:30 info: Aux: < \r\nOK\r\n
12:51:30 info: Aux: Finally woke up the modem
12:51:30 info: Aux: > AT+COPS=3,2\r
12:51:30 info: Aux: < \r\nOK\r\n
12:51:30 info: Aux: > AT+COPS?\r
12:51:30 info: Aux: < \r\n+COPS: 0,2,"24002",2\r\n
12:51:30 info: Aux: < \r\nOK\r\n
12:51:30 debug:
../git/drivers/atmodem/network-registration.c:cops_numeric_cb() Cops numeric got mcc: 240, mnc: 02
12:51:30 info: Aux: > AT+CSQ\r
12:51:30 info: Aux: < \r\n+CSQ: 11,1\r\n
12:51:30 info: Aux: < \r\nOK\r\n
12:51:30 debug: ../git/drivers/atmodem/network-registration.c:csq_cb()
csq_cb: 11
12:51:30 debug: ../git/src/network.c:ofono_netreg_strength_notify() strength 35
12:51:30 info: Aux: > AT+CGATT=1\r
12:51:37 info: Aux: < \r\n+CME ERROR: 148\r\n
12:51:37 debug: ../git/src/gprs.c:gprs_attach_callback() /ublox_0 error = 1 12:51:37 info: Aux: > AT+COPS=3,0\r
12:51:37 info: Aux: < \r\n+CIEV: 2,3\r\n
12:51:37 info: Aux: < \r\n+CREG: 0\r\n
12:51:37 debug: ../git/src/network.c:ofono_netreg_status_notify() /ublox_0 status 0 tech -1 lac -1 ci -1
12:51:37 debug: ../git/src/network.c:current_operator_callback() 0x6f2440, (nil)
12:51:37 debug: ../git/src/gprs.c:netreg_status_changed() 0 (unregistered) 12:51:37 debug: ../git/src/gprs.c:gprs_netreg_update() attach: 0,
driver_attached: 0
12:51:37 info: Aux: < \r\n+CIEV: 7,0\r\n\r\n+CREG: 3\r\n 12:51:37 debug: ../git/src/network.c:ofono_netreg_status_notify() /ublox_0 status 3 tech -1 lac -1 ci -1
12:51:37 debug: ../git/src/network.c:current_operator_callback() 0x6f2440, (nil)
12:51:37 debug: ../git/src/gprs.c:netreg_status_changed() 3 (denied) 12:51:37 debug: ../git/src/gprs.c:gprs_netreg_update() attach: 0,
driver_attached: 0
12:51:37 info: Aux: < \r\nOK\r\n
12:51:37 info: Aux: > AT+COPS?\r
12:51:37 info: Aux: < \r\n+COPS: 0\r\n
12:51:37 info: Aux: < \r\nOK\r\n
12:51:37 debug: ../git/src/network.c:current_operator_callback() 0x6f2440, (nil)
12:51:37 info: Aux: > AT+CGREG?\r
12:51:37 info: Aux: < \r\n+CGREG: 2,3\r\n
12:51:37 info: Aux: < \r\nOK\r\n
12:51:37 debug: ../git/src/gprs.c:registration_status_cb() /ublox_0 error 0 status 3
12:51:37 debug: ../git/src/gprs.c:ofono_gprs_status_notify() /ublox_0 status denied (3)
12:51:47 info: Aux: < \r\n+CIEV: 2,1\r\n
12:51:48 info: Aux: < \r\n+CIEV: 2,2\r\n
12:51:49 info: Aux: < \r\n+CIEV: 2,1\r\n
12:51:50 info: Aux: < \r\n+CREG: 0\r\n
12:51:50 debug: ../git/src/network.c:ofono_netreg_status_notify() /ublox_0 status 0 tech -1 lac -1 ci -1
12:51:50 debug: ../git/src/network.c:current_operator_callback() 0x6f2440, (nil)
12:51:50 debug: ../git/src/gprs.c:netreg_status_changed() 0 (unregistered) 12:51:50 debug: ../git/src/gprs.c:gprs_netreg_update() attach: 0,
driver_attached: 0
12:51:50 info: Aux: < \r\n+CGREG: 5,"4E85","000003EA",2,"01"\r\n 12:51:50 debug: ../git/src/gprs.c:ofono_gprs_status_notify() /ublox_0 status roaming (5)
12:51:50 info: Aux: < \r\n+UREG: 3\r\n
12:51:50 info: Aux: < \r\n+CIEV: 9,2\r\n
12:51:50 info: Aux: < \r\n+CTZE: +08,1,"19/09/03,14:51:50"\r\n 12:51:50 debug:
../git/drivers/ubloxmodem/network-registration.c:ctze_notify() tz +08 dst 1 time 19/09/03,14:51:50
12:51:50 debug: ../git/src/network.c:ofono_netreg_time_notify() net time

2019-09-03 14:51:50 utcoff 7200 dst 1

12:51:50 info: Aux: < \r\n+CREG: 5,"0E63","8CD17D00",2\r\n 12:51:50 debug: ../git/src/network.c:ofono_netreg_status_notify() /ublox_0 status 5 tech 2 lac 3683 ci 2147483647
12:51:50 debug: ../git/src/gprs.c:netreg_status_changed() 5 (roaming) 12:51:50 debug: ../git/src/gprs.c:gprs_netreg_update() attach: 1,
driver_attached: 1
12:51:50 info: Aux: > AT\r
12:51:50 info: Aux: < \r\n+CIEV: 7,1\r\n
12:51:50 info: Aux: < \r\nOK\r\n
12:51:50 info: Aux: Finally woke up the modem
12:51:50 info: Aux: > AT+COPS=3,2\r
12:51:50 info: Aux: < \r\nOK\r\n
12:51:50 info: Aux: > AT+COPS?\r
12:51:50 info: Aux: < \r\n+COPS: 0,2,"24002",2\r\n
12:51:50 info: Aux: < \r\nOK\r\n
12:51:50 debug:
../git/drivers/atmodem/network-registration.c:cops_numeric_cb() Cops numeric got mcc: 240, mnc: 02
12:51:50 info: Aux: > AT+CSQ\r
12:51:50 info: Aux: < \r\n+CSQ: 8,1\r\n
12:51:50 info: Aux: < \r\nOK\r\n
12:51:50 debug: ../git/drivers/atmodem/network-registration.c:csq_cb()
csq_cb: 8
12:51:50 debug: ../git/src/network.c:ofono_netreg_strength_notify() strength 25
12:51:50 info: Aux: > AT+COPS=3,0\r
12:51:50 info: Aux: < \r\nOK\r\n
12:51:50 info: Aux: > AT+COPS?\r
12:51:50 info: Aux: < \r\n+COPS: 0,0,"3 SE",2\r\n
12:51:50 info: Aux: < \r\nOK\r\n
12:51:50 debug: ../git/drivers/atmodem/network-registration.c:cops_cb()
cops_cb: 3 SE, 240 02 2
12:51:50 debug: ../git/src/network.c:current_operator_callback() 0x6f2440, (nil)
12:51:50 debug: ../git/src/gprs.c:netreg_status_changed() 5 (roaming) 12:51:50 debug: ../git/src/gprs.c:gprs_netreg_update() attach: 1,
driver_attached: 1
12:51:52 info: Aux: < \r\n+CGEV: ME PDN DEACT 4\r\n
12:51:53 info: Aux: < \r\n+CIEV: 2,2\r\n
12:52:03 info: Aux: < \r\n+CIEV: 2,1\r\n
12:52:08 info: Aux: < \r\n+CIEV: 2,2\r\n
12:52:14 info: Aux: < \r\n+CIEV: 2,1\r\n

Den tis 3 sep. 2019 kl 16:06 skrev <[email protected]>:

Quoted 76 lines

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

In case a context get deactivated when a AT+CGACT=0 is not issued, indicate that to gprs core.
This can happen if the device has an auto activated LTE context and modem switches over to for instance UTRAN.

---
 drivers/ubloxmodem/gprs-context.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
drivers/ubloxmodem/gprs-context.c +3 -0
index ff78a42a..188c2c62 100644
@@ -40,6 +40,8 @@
 
 #include "ubloxmodem.h"
 
+#define UBLOX_FLAG_DEACTIVATING 0x01
+
 static const char *none_prefix[] = { NULL };
 static const char *cgcontrdp_prefix[] = { "+CGCONTRDP:", NULL };
 static const char *uipaddr_prefix[] = { "+UIPADDR:", NULL };
@@ -57,6 +59,7 @@ struct gprs_context_data {
        ofono_gprs_context_cb_t cb;
        void *cb_data;
        enum netmode networking_mode;
+       int flags;
 };
 
 static void uipaddr_cb(gboolean ok, GAtResult *result, gpointer

user_data)

drivers/ubloxmodem/gprs-context.c +2 -0
@@ -426,6 +429,8 @@ static void cgact_disable_cb(gboolean ok, GAtResult
 *result, gpointer user_data)
 
        DBG("ok %d", ok);
 
+       gcd->flags &= ~UBLOX_FLAG_DEACTIVATING;
+
        if (!ok) {
                CALLBACK_WITH_FAILURE(gcd->cb, gcd->cb_data);
                return;
drivers/ubloxmodem/gprs-context.c +2 -0
@@ -448,6 +453,8 @@ static void ublox_gprs_deactivate_primary(struct
 ofono_gprs_context *gc,
        gcd->cb = cb;
        gcd->cb_data = data;
 
+       gcd->flags |= UBLOX_FLAG_DEACTIVATING;
+
        snprintf(buf, sizeof(buf), "AT+CGACT=0,%u", gcd->active_context);
        g_at_chat_send(gcd->chat, buf, none_prefix,
                        cgact_disable_cb, gc, NULL);
drivers/ubloxmodem/gprs-context.c +7 -1
@@ -473,10 +480,16 @@ static void cgev_notify(GAtResult *result, gpointer
 user_data)
                sscanf(event, "%*s %*s %*s %u", &cid);
        else if (g_str_has_prefix(event, "NW DEACT"))
                sscanf(event, "%*s %*s %u", &cid);
+       else if (!(gcd->flags & UBLOX_FLAG_DEACTIVATING) &&
+                g_str_has_prefix(event, "ME PDN DEACT"))
+               /* The modem might consider the ME deactivating without
+                * an explicit CGACT=0 beeing sent
+                */
+               sscanf(event, "%*s %*s %*s %u", &cid);
        else
                return;
 
-       DBG("cid %d", cid);
+       DBG("cid %d, active cid: %d", cid, gcd->active_context);
 
        if ((unsigned int) cid != gcd->active_context)
                return;

--
2.20.1