From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [RFC online/offline atoms PATCH 3/4] gprs: watch modem state
Date: Wed, 13 Oct 2010 15:53:01 -0500 [thread overview]
Message-ID: <4CB61C2D.7080104@gmail.com> (raw)
In-Reply-To: <1286278512-3529-4-git-send-email-Pekka.Pessi@nokia.com>
[-- Attachment #1: Type: text/plain, Size: 2647 bytes --]
Hi Pekka,
On 10/05/2010 06:35 AM, Pekka.Pessi(a)nokia.com wrote:
> From: Pekka Pessi <Pekka.Pessi@nokia.com>
>
> Indicate detach when modem is in offline state.
> ---
> src/gprs.c | 26 ++++++++++++++++++++++++++
> 1 files changed, 26 insertions(+), 0 deletions(-)
>
> diff --git a/src/gprs.c b/src/gprs.c
> index 3f085ed..431275c 100644
> --- a/src/gprs.c
> +++ b/src/gprs.c
> @@ -76,6 +76,7 @@ struct ofono_gprs {
> struct ofono_netreg *netreg;
> unsigned int netreg_watch;
> unsigned int status_watch;
> + unsigned int online_watch;
> GKeyFile *settings;
> char *imsi;
> DBusMessage *pending;
> @@ -1048,8 +1049,17 @@ static void gprs_attach_callback(const struct ofono_error *error, void *data)
>
> static void gprs_netreg_update(struct ofono_gprs *gprs)
> {
> + struct ofono_modem *modem = __ofono_atom_get_modem(gprs->atom);
> ofono_bool_t attach;
>
> + if (!ofono_modem_get_online(modem)) {
> + gprs->flags &= ~(GPRS_FLAG_RECHECK | GPRS_FLAG_ATTACHING);
> + gprs->netreg_status = NETWORK_REGISTRATION_STATUS_UNKNOWN;
> + gprs->driver_attached = FALSE;
> + gprs_attached_update(gprs);
> + return;
> + }
> +
> attach = gprs->netreg_status == NETWORK_REGISTRATION_STATUS_REGISTERED;
>
> attach = attach || (gprs->roaming_allowed &&
> @@ -1740,6 +1750,11 @@ static void gprs_unregister(struct ofono_atom *atom)
> gprs->cid_map = NULL;
> }
>
> + if (gprs->online_watch) {
> + __ofono_modem_remove_state_watch(modem, gprs->online_watch);
> + gprs->online_watch = 0;
> + }
> +
> if (gprs->netreg_watch) {
> if (gprs->status_watch) {
> __ofono_netreg_remove_status_watch(gprs->netreg,
> @@ -1844,6 +1859,14 @@ static void netreg_watch(struct ofono_atom *atom,
> gprs_netreg_update(gprs);
> }
>
> +static void online_watch(enum ofono_modem_state modem_state, void *data)
> +{
> + struct ofono_gprs *gprs = data;
> +
> + if (modem_state != MODEM_STATE_ONLINE)
> + gprs_netreg_update(gprs);
So again, the question is whether it is better to watch for the netreg
atom going away instead of using an online/offline watch...
> +}
> +
> static gboolean load_context(struct ofono_gprs *gprs, const char *group)
> {
> char *name = NULL;
> @@ -2041,6 +2064,9 @@ void ofono_gprs_register(struct ofono_gprs *gprs)
> ofono_modem_add_interface(modem,
> OFONO_CONNECTION_MANAGER_INTERFACE);
>
> + gprs->online_watch = __ofono_modem_add_state_watch(modem,
> + online_watch, gprs, NULL);
> +
> sim_atom = __ofono_modem_find_atom(modem, OFONO_ATOM_TYPE_SIM);
>
> if (sim_atom) {
Regards,
-Denis
next prev parent reply other threads:[~2010-10-13 20:53 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-05 11:35 [RFC online/offline atoms PATCH 0/4] modem: add modem state watch Pekka.Pessi
2010-10-05 11:35 ` [RFC online/offline atoms PATCH 1/4] " Pekka.Pessi
2010-10-05 11:35 ` [RFC online/offline atoms PATCH 2/4] sms: watch modem state Pekka.Pessi
2010-10-05 11:35 ` [RFC online/offline atoms PATCH 3/4] gprs: " Pekka.Pessi
2010-10-05 11:35 ` [RFC online/offline atoms PATCH 4/4] isigen: create sms and gprs in post_sim Pekka.Pessi
2010-10-05 12:04 ` Marcel Holtmann
2010-10-06 0:40 ` Denis Kenzior
2010-10-06 8:55 ` Marcel Holtmann
2010-10-13 20:53 ` Denis Kenzior [this message]
2010-10-05 11:59 ` [RFC online/offline atoms PATCH 2/4] sms: watch modem state Marcel Holtmann
2010-10-06 0:38 ` Denis Kenzior
2010-10-06 8:54 ` Marcel Holtmann
2010-10-13 20:45 ` Denis Kenzior
2010-10-05 11:56 ` [RFC online/offline atoms PATCH 1/4] modem: add modem state watch Marcel Holtmann
2010-10-13 20:39 ` Denis Kenzior
2010-10-14 7:21 ` Pekka Pessi
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=4CB61C2D.7080104@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