All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix can't attach gprs issue
@ 2011-05-09  8:22 caiwen.zhang
  2011-05-08 15:58 ` Denis Kenzior
  0 siblings, 1 reply; 2+ messages in thread
From: caiwen.zhang @ 2011-05-09  8:22 UTC (permalink / raw)
  To: ofono

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

From: Caiwen Zhang <caiwen.zhang@windriver.com>

This patch is to fix the issue that can't attach GPRS after detach it. 

Cause:
  When start detaching GPRS, driver_attched value is set to FALSE, if
device registered to GPRS network during GPRS detaching, driver_attched is set to TURE.
After that, GPRS attaching will always be ignored because driver_attched is always TURE.

Scenario:
  When device is unregistered(+CREG: 2), GPRS is detached. During GPRS detaching, device
registered to network again(+CREG: 1, xxx, xxx).

Log:
ofonod[619]: PCUI: < \r\n^SRVST:1\r\n\r\n+CREG: 2\r\n\r\n+CGREG: 2\r\n\r\n^SRVST:2\r\n\r\n+CREG: 1, A807, A72B71\r\n\r\n+CGREG: 0\r\n
ofonod[619]: src/network.c:current_operator_callback() 0xa046ea0, 0xa0476e8
ofonod[619]: src/gprs.c:netreg_status_changed() 2     //driver_attched = FALSE
ofonod[619]: src/cbs.c:cbs_location_changed() 2, -1, -1, -1, (null)(null)
ofonod[619]: src/cbs.c:cbs_location_changed() 1, 0, 0
ofonod[619]: src/gprs.c:netreg_status_changed() 2
ofonod[619]: src/cbs.c:cbs_location_changed() 2, -1, -1, -1, (null)(null)
ofonod[619]: src/gprs.c:ofono_gprs_status_notify() /huawei0 status 2
ofonod[619]: src/gprs.c:netreg_status_changed() 1
ofonod[619]: src/cbs.c:cbs_location_changed() 1, 43015, 10955633, -1, (null)(null)
ofonod[619]: src/gprs.c:ofono_gprs_status_notify() /huawei0 status 0
ofonod[619]: PCUI: > AT+CSCB=0,"0,25,38,50,100,136,256,4352-4356"\r
ofonod[619]: PCUI: < \r\nOK\r\n
ofonod[619]: PCUI: > AT+CRSM=192,28437,0,0,255\r
ofonod[619]: PCUI: < \r\n+CREG: 1, A807, A72B71\r\n\r\n+CGREG: 1, A807, A72B71\r\n
ofonod[619]: src/gprs.c:netreg_status_changed() 1
ofonod[619]: src/cbs.c:cbs_location_changed() 1, 43015, 10955633, -1, (null)(null)
ofonod[619]: src/gprs.c:ofono_gprs_status_notify() /huawei0 status 1  //driver_attched = TRUE
ofonod[619]: PCUI: < \r\n+CRSM: 106,130,""\r\n\r\nOK\r\n
ofonod[619]: PCUI: > AT+CGATT=0\r

---
 src/gprs.c |   19 +++++++------------
 1 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/src/gprs.c b/src/gprs.c
index deffeb8..d80e7ab 100644
--- a/src/gprs.c
+++ b/src/gprs.c
@@ -1429,17 +1429,12 @@ void ofono_gprs_resume_notify(struct ofono_gprs *gprs)
 	update_suspended_property(gprs, FALSE);
 }
 
-static void gprs_attached_update(struct ofono_gprs *gprs)
+static void gprs_attached_update(struct ofono_gprs *gprs, ofono_bool_t attached)
 {
 	DBusConnection *conn = ofono_dbus_get_connection();
 	const char *path;
-	ofono_bool_t attached;
 	dbus_bool_t value;
 
-	attached = gprs->driver_attached &&
-		(gprs->status == NETWORK_REGISTRATION_STATUS_REGISTERED ||
-			gprs->status == NETWORK_REGISTRATION_STATUS_ROAMING);
-
 	if (attached == gprs->attached)
 		return;
 
@@ -1508,7 +1503,7 @@ static void gprs_attach_callback(const struct ofono_error *error, void *data)
 		return;
 	}
 
-	gprs_attached_update(gprs);
+	gprs_attached_update(gprs, gprs->driver_attached);
 
 	if (gprs->flags & GPRS_FLAG_RECHECK) {
 		gprs->flags &= ~GPRS_FLAG_RECHECK;
@@ -1525,7 +1520,7 @@ static void gprs_netreg_removed(struct ofono_gprs *gprs)
 	gprs->netreg_status = NETWORK_REGISTRATION_STATUS_NOT_REGISTERED;
 	gprs->driver_attached = FALSE;
 
-	gprs_attached_update(gprs);
+	gprs_attached_update(gprs, FALSE);
 }
 
 static void gprs_netreg_update(struct ofono_gprs *gprs)
@@ -2074,7 +2069,8 @@ void ofono_gprs_detached_notify(struct ofono_gprs *gprs)
 	DBG("%s", __ofono_atom_get_path(gprs->atom));
 
 	gprs->driver_attached = FALSE;
-	gprs_attached_update(gprs);
+
+	gprs_attached_update(gprs, FALSE);
 
 	/*
 	 * TODO: The network forced a detach, we should wait for some time
@@ -2091,7 +2087,7 @@ void ofono_gprs_status_notify(struct ofono_gprs *gprs, int status)
 
 	if (status != NETWORK_REGISTRATION_STATUS_REGISTERED &&
 			status != NETWORK_REGISTRATION_STATUS_ROAMING) {
-		gprs_attached_update(gprs);
+		gprs_attached_update(gprs, FALSE);
 		return;
 	}
 
@@ -2103,8 +2099,7 @@ void ofono_gprs_status_notify(struct ofono_gprs *gprs, int status)
 			status == NETWORK_REGISTRATION_STATUS_ROAMING)
 		goto detach;
 
-	gprs->driver_attached = TRUE;
-	gprs_attached_update(gprs);
+	gprs_attached_update(gprs, TRUE);
 
 	return;
 
-- 
1.7.0.4


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

end of thread, other threads:[~2011-05-09  8:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-09  8:22 [PATCH] fix can't attach gprs issue caiwen.zhang
2011-05-08 15:58 ` Denis Kenzior

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.