From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCH] fix can't attach gprs issue
Date: Sun, 08 May 2011 10:58:22 -0500 [thread overview]
Message-ID: <4DC6BD9E.40507@gmail.com> (raw)
In-Reply-To: <1304929336-14558-1-git-send-email-caiwen.zhang@windriver.com>
[-- Attachment #1: Type: text/plain, Size: 4733 bytes --]
Hi Caiwen,
On 05/09/2011 03:22 AM, caiwen.zhang(a)windriver.com wrote:
> 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);
> -
You are changing semantics of attached here. Attached property is set
to TRUE only when a CGATT=1 has been issued _and_ CGREG goes to
registered or 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;
>
Regards,
-Denis
prev parent reply other threads:[~2011-05-08 15:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-09 8:22 [PATCH] fix can't attach gprs issue caiwen.zhang
2011-05-08 15:58 ` Denis Kenzior [this message]
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=4DC6BD9E.40507@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