All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] ublox: gprs: React on context deactivation
  2019-09-03 14:06 [PATCH] ublox: gprs: React on context deactivation richard.rojfors
@ 2019-09-02 21:39 ` Denis Kenzior
  2019-09-03 14:10 ` Richard =?unknown-8bit?q?R=C3=B6jfors?=
  1 sibling, 0 replies; 4+ messages in thread
From: Denis Kenzior @ 2019-09-02 21:39 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 508 bytes --]

Hi Richard,

On 9/3/19 9:06 AM, richard.rojfors(a)gmail.com wrote:
> From: Richard Röjfors <richard@puffinpack.se>
> 
> 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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] ublox: gprs: React on context deactivation
@ 2019-09-03 14:06 richard.rojfors
  2019-09-02 21:39 ` Denis Kenzior
  2019-09-03 14:10 ` Richard =?unknown-8bit?q?R=C3=B6jfors?=
  0 siblings, 2 replies; 4+ messages in thread
From: richard.rojfors @ 2019-09-03 14:06 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 2308 bytes --]

From: Richard Röjfors <richard@puffinpack.se>

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(-)

diff --git a/drivers/ubloxmodem/gprs-context.c b/drivers/ubloxmodem/gprs-context.c
index ff78a42a..188c2c62 100644
--- a/drivers/ubloxmodem/gprs-context.c
+++ b/drivers/ubloxmodem/gprs-context.c
@@ -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;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ublox: gprs: React on context deactivation
  2019-09-03 14:06 [PATCH] ublox: gprs: React on context deactivation richard.rojfors
  2019-09-02 21:39 ` Denis Kenzior
@ 2019-09-03 14:10 ` Richard =?unknown-8bit?q?R=C3=B6jfors?=
  2019-09-03 19:49   ` Jonas Bonn
  1 sibling, 1 reply; 4+ messages in thread
From: Richard =?unknown-8bit?q?R=C3=B6jfors?= @ 2019-09-03 14:10 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 10990 bytes --]

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 <richard.rojfors@gmail.com>:

> From: Richard Röjfors <richard@puffinpack.se>
>
> 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(-)
>
> diff --git a/drivers/ubloxmodem/gprs-context.c
> b/drivers/ubloxmodem/gprs-context.c
> index ff78a42a..188c2c62 100644
> --- a/drivers/ubloxmodem/gprs-context.c
> +++ b/drivers/ubloxmodem/gprs-context.c
> @@ -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;
> --
> 2.20.1
>
>

[-- Attachment #2: attachment.html --]
[-- Type: text/html, Size: 12409 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ublox: gprs: React on context deactivation
  2019-09-03 14:10 ` Richard =?unknown-8bit?q?R=C3=B6jfors?=
@ 2019-09-03 19:49   ` Jonas Bonn
  0 siblings, 0 replies; 4+ messages in thread
From: Jonas Bonn @ 2019-09-03 19:49 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 11643 bytes --]

On Tue, Sep 3, 2019, 16:11 Richard Röjfors <richard.rojfors@gmail.com>
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


> 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 <richard.rojfors@gmail.com>:
>
>> From: Richard Röjfors <richard@puffinpack.se>
>>
>> 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(-)
>>
>> diff --git a/drivers/ubloxmodem/gprs-context.c
>> b/drivers/ubloxmodem/gprs-context.c
>> index ff78a42a..188c2c62 100644
>> --- a/drivers/ubloxmodem/gprs-context.c
>> +++ b/drivers/ubloxmodem/gprs-context.c
>> @@ -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;
>> --
>> 2.20.1
>>
>>

[-- Attachment #2: attachment.html --]
[-- Type: text/html, Size: 13258 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-09-03 19:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-03 14:06 [PATCH] ublox: gprs: React on context deactivation richard.rojfors
2019-09-02 21:39 ` Denis Kenzior
2019-09-03 14:10 ` Richard =?unknown-8bit?q?R=C3=B6jfors?=
2019-09-03 19:49   ` Jonas Bonn

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.