Open Source Telephony
 help / color / mirror / Atom feed
From: Tony Espy <espy@canonical.com>
To: ofono@ofono.org
Subject: Re: [PATCH] rilmodem: Fix GPRS feature inavailable issue
Date: Wed, 13 Jan 2016 16:10:52 -0500	[thread overview]
Message-ID: <5696BD5C.40805@canonical.com> (raw)
In-Reply-To: <1452570148-15685-1-git-send-email-caiwen.zhang@intel.com>

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

On 01/11/2016 10:42 PM, caiwen.zhang(a)intel.com wrote:
> From: Caiwen Zhang <caiwen.zhang@intel.com>
>
> When query max cid if rild radio status isn't RADIO_STATUS_ON, it may
> fail, gprs atom will be removed, gprs feature will always be inavailable.
> ---
>   drivers/rilmodem/gprs.c | 43 ++++++++++++++++++++++++++++++++++++++++++-
>   1 file changed, 42 insertions(+), 1 deletion(-)

Thanks for the patch Caiwen!

That said instead of extending the gprs atom to listen to radio state 
changes ( which may not reliably work on all rild-based devices ), it 
probably makes more sense to defer the creation of the gprs atom in the 
ril device plugin till the post_online phase ( vs. post_sim ).

Regards,
/tony


> diff --git a/drivers/rilmodem/gprs.c b/drivers/rilmodem/gprs.c
> index 0ec9d5f..f3bdc86 100644
> --- a/drivers/rilmodem/gprs.c
> +++ b/drivers/rilmodem/gprs.c
> @@ -54,8 +54,11 @@ struct ril_gprs_data {
>   	gboolean ofono_attached;
>   	int rild_status;
>   	int pending_deact_req;
> +	gboolean registered;
>   };
>
> +static void query_max_cids(struct ofono_gprs *gprs);
> +
>   /*
>    * This module is the ofono_gprs_driver implementation for rilmodem.
>    *
> @@ -300,6 +303,34 @@ static void ril_gprs_registration_status(struct ofono_gprs *gprs,
>   	}
>   }
>
> +static void ril_radio_state_changed(struct ril_msg *message,
> +							gpointer user_data)
> +{
> +	struct ofono_gprs *gprs = user_data;
> +	struct ril_gprs_data *gd = ofono_gprs_get_data(gprs);
> +	struct parcel rilp;
> +	int radio_state;
> +
> +	if (gd->registered)
> +		return;
> +
> +	g_ril_init_parcel(message, &rilp);
> +	radio_state = parcel_r_int32(&rilp);
> +
> +	if (rilp.malformed) {
> +		ofono_error("%s: malformed parcel received", __func__);
> +		return;
> +	}
> +
> +	g_ril_append_print_buf(gd->ril, "(state: %s)",
> +				ril_radio_state_to_string(radio_state));
> +	g_ril_print_unsol(gd->ril, message);
> +
> +	if (radio_state == RADIO_STATE_ON) {
> +		query_max_cids(gprs);
> +	}
> +}
> +
>   static void query_max_cids_cb(struct ril_msg *message, gpointer user_data)
>   {
>   	struct ofono_gprs *gprs = user_data;
> @@ -315,7 +346,14 @@ static void query_max_cids_cb(struct ril_msg *message, gpointer user_data)
>   		ofono_error("%s: DATA_REGISTRATION_STATE reply failure: %s",
>   				__func__,
>   				ril_error_to_string(message->error));
> -		goto error;
> +
> +		if (message->error != RIL_E_RADIO_NOT_AVAILABLE)
> +			goto error;
> +		else {
> +		  g_ril_register(gd->ril, RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED,
> +					ril_radio_state_changed, gprs);
> +			return;
> +		}
>   	}
>
>   	g_ril_init_parcel(message, &rilp);
> @@ -341,6 +379,7 @@ reg_atom:
>   	g_strfreev(strv);
>   	ofono_gprs_set_cid_range(gprs, 1, max_calls);
>   	ofono_gprs_register(gprs);
> +	gd->registered = TRUE;
>   	return;
>
>   error_free:
> @@ -380,6 +419,7 @@ static void query_max_cids(struct ofono_gprs *gprs)
>   	if (g_ril_vendor(gd->ril) == OFONO_RIL_VENDOR_MTK) {
>   		ofono_gprs_set_cid_range(gprs, 1, 3);
>   		ofono_gprs_register(gprs);
> +		gd->registered = TRUE;
>   		return;
>   	}
>
> @@ -495,6 +535,7 @@ static int ril_gprs_probe(struct ofono_gprs *gprs, unsigned int vendor,
>   	gd->ril = g_ril_clone(ril);
>   	gd->ofono_attached = FALSE;
>   	gd->rild_status = -1;
> +	gd->registered = FALSE;
>
>   	ofono_gprs_set_data(gprs, gd);
>
>


  reply	other threads:[~2016-01-13 21:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-12  3:42 [PATCH] rilmodem: Fix GPRS feature inavailable issue caiwen.zhang
2016-01-13 21:10 ` Tony Espy [this message]
2016-01-14  6:14   ` Zhang, Caiwen
2016-01-14 15:52     ` Denis Kenzior
2016-01-14 18:52     ` Tony Espy

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=5696BD5C.40805@canonical.com \
    --to=espy@canonical.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