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
>From ec0798643cad94c5f337c891fe7447003613ca54 Mon Sep 17 00:00:00 2001
From: Denis Kenzior <[email protected]>
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
_______________________________________________
ofono mailing list
[email protected]
http://lists.ofono.org/listinfo/ofono