From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: context activation quickly after context deactivation fails
Date: Wed, 05 Sep 2012 14:41:31 -0500 [thread overview]
Message-ID: <5047AAEB.8080203@gmail.com> (raw)
In-Reply-To: <CABvLYuD17J3urLnbzDuzM95BPbRDs1Y6Mgi9=6yX3wPunxz6LA@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 3347 bytes --]
Hi Cedric,
On 09/03/2012 07:50 AM, Cedric Jehasse wrote:
> Hi,
>
> When i want to change a Property (eg. APN) of an Active
> ConnectionContext. I first deactivate the context, wait for a reply
> then set the property and re-activate the context.
> The problem is i'm already trying to re-activate the context, before
> oFono gets a "NO CARRIER" from the modem. oFono tries to send
> AT+CGDCONT, but get's a "NO CARRIER" response and fails to activate
> the context.
> Is there a way to tell if it's ready to re-activate? Should oFono wait
> for the "NO CARRIER" before it sends a reply to the deactivation?
>
> Here's a log of the problem
> Jan 4 22:14:38 ofonod[3022]:
> drivers/atmodem/gprs-context.c:at_gprs_deactivate_primary() cid 1
> Jan 4 22:14:38 ofonod[3022]: PPP: lcp: pppcp_generate_event: current
> state 9:OPENED
> Jan 4 22:14:38 ofonod[3022]: PPP: event: 3 (Close), action: 8224,
> new_state: 4 (CLOSING)
> Jan 4 22:14:38 ofonod[3022]: PPP: lcp:
> pppcp_initialize_restart_count: current state 9:OPENED
> Jan 4 22:14:38 ofonod[3022]: PPP: lcp: pppcp_send_terminate_request:
> current state 9:OPENED
> Jan 4 22:14:38 ofonod[3022]: PPP: ipcp: pppcp_generate_event: current
> state 9:OPENED
> Jan 4 22:14:38 ofonod[3022]: PPP: event: 1 (Down), action: 201,
> new_state: 1 (STARTING)
> Jan 4 22:14:38 ofonod[3022]: PPP: gatchat/gatppp.c:ppp_enter_phase() 5
> Jan 4 22:14:38 ofonod[3022]: plugins/udevng.c:remove_device()
> /sys/devices/virtual/net/ppp0
> Jan 4 22:14:38 ofonod[3022]: plugins/udev.c:udev_event() subsystem net remove
> Jan 4 22:14:38 ofonod[3022]: plugins/udev.c:remove_modem()
> /devices/virtual/net/ppp0
> Jan 4 22:14:38 ofonod[3022]: plugins/udev.c:udev_event() subsystem net finished
> Jan 4 22:14:38 ofonod[3022]: PPP: lcp: pppcp_process_terminate_ack:
> current state 4:CLOSING
> Jan 4 22:14:38 ofonod[3022]: PPP: lcp: pppcp_generate_event: current
> state 4:CLOSING
> Jan 4 22:14:38 ofonod[3022]: PPP: event: 11 (RTA), action: 802,
> new_state: 2 (CLOSED)
> Jan 4 22:14:38 ofonod[3022]: PPP: lcp: pppcp_this_layer_finished:
> current state 2:CLOSED
> Jan 4 22:14:38 ofonod[3022]: PPP: gatchat/gatppp.c:ppp_enter_phase() 0
> Jan 4 22:14:38 ofonod[3022]: PPP: gatchat/gatppp.c:ppp_dead()
> Jan 4 22:14:38 ofonod[3022]: src/gprs.c:assign_context()
> Jan 4 22:14:38 ofonod[3022]: src/gprs.c:assign_context()
> gprs[0x557f80] context_driver[0x556a40]
> Jan 4 22:14:38 ofonod[3022]:
> drivers/atmodem/gprs-context.c:at_gprs_activate_primary() cid 1
> Jan 4 22:14:38 ofonod[3022]: Modem:> AT+CGDCONT=1,"IP","test"\r
> Jan 4 22:14:39 ofonod[3022]: PCUI:< \r\n^RSSI:17\r\n
> Jan 4 22:14:40 ofonod[3022]: PCUI:< \r\n^MODE:5,4\r\n
> Jan 4 22:14:40 ofonod[3022]: Modem:< \r\nNO CARRIER\r\n
> Jan 4 22:14:40 ofonod[3022]:
> drivers/atmodem/gprs-context.c:at_cgdcont_cb() ok 0
> Jan 4 22:14:40 ofonod[3022]: src/gprs.c:pri_activate_callback() 0x55dc88
> Jan 4 22:14:40 ofonod[3022]: src/gprs.c:pri_activate_callback()
> Activating context failed with error: Unknown error type
>
It does indeed sound like oFono is not waiting for the final response,
in this case a 'NO CARRIER'. Can you try a highly experimental patch
(attached) and tell me if something along these lines would work for
your case?
Regards,
-Denis
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gprs-experimental-no-carrier-fix.patch --]
[-- Type: text/x-patch, Size: 1789 bytes --]
>From ec0798643cad94c5f337c891fe7447003613ca54 Mon Sep 17 00:00:00 2001
From: Denis Kenzior <denkenz@gmail.com>
Date: Wed, 5 Sep 2012 14:40:06 -0500
Subject: [PATCH] gprs: experimental no carrier fix
---
drivers/atmodem/gprs-context.c | 21 +++++++++++++++------
1 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/drivers/atmodem/gprs-context.c b/drivers/atmodem/gprs-context.c
index 3694c27..4d5ed91 100644
--- a/drivers/atmodem/gprs-context.c
+++ b/drivers/atmodem/gprs-context.c
@@ -110,6 +110,19 @@ static void ppp_disconnect(GAtPPPDisconnectReason reason, gpointer user_data)
g_at_ppp_unref(gcd->ppp);
gcd->ppp = NULL;
+ /*
+ * If the channel of gcd->chat is NULL, it might cause
+ * gprs_context_remove get called and the gprs context will be
+ * removed.
+ */
+ g_at_chat_resume(gcd->chat);
+}
+
+static void no_carrier_notify(GAtResult *result, gpointer user_data)
+{
+ struct ofono_gprs_context *gc = user_data;
+ struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc);
+
switch (gcd->state) {
case STATE_ENABLING:
CALLBACK_WITH_FAILURE(gcd->cb, gcd->cb_data);
@@ -124,12 +137,6 @@ static void ppp_disconnect(GAtPPPDisconnectReason reason, gpointer user_data)
gcd->active_context = 0;
gcd->state = STATE_IDLE;
- /*
- * If the channel of gcd->chat is NULL, it might cause
- * gprs_context_remove get called and the gprs context will be
- * removed.
- */
- g_at_chat_resume(gcd->chat);
}
static gboolean setup_ppp(struct ofono_gprs_context *gc)
@@ -363,6 +370,8 @@ static int at_gprs_context_probe(struct ofono_gprs_context *gc,
return 0;
g_at_chat_register(chat, "+CGEV:", cgev_notify, FALSE, gc, NULL);
+ g_at_chat_register(chat, "NO CARRIER", no_carrier_notify,
+ FALSE, gc, NULL);
return 0;
}
--
1.7.8.6
next prev parent reply other threads:[~2012-09-05 19:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-03 12:50 context activation quickly after context deactivation fails Cedric Jehasse
2012-09-05 19:41 ` Denis Kenzior [this message]
2012-09-06 14:09 ` Cedric Jehasse
2012-09-06 15:13 ` Denis Kenzior
2012-09-07 9:27 ` Cedric Jehasse
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5047AAEB.8080203@gmail.com \
--to=denkenz@gmail.com \
--cc=ofono@ofono.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox