public inbox for ofono@lists.linux.dev
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: Sean Nyekjaer <sean@geanix.com>, ofono@lists.linux.dev
Subject: Re: [PATCH 2/3] drivers: simcommodem: query modem for available rat modes
Date: Wed, 9 Oct 2024 10:27:03 -0500	[thread overview]
Message-ID: <8fbd4cf7-ef82-4a44-8cbb-76ee26cf0591@gmail.com> (raw)
In-Reply-To: <20241008091038.1567406-2-sean@geanix.com>

Hi Sean,

On 10/8/24 4:10 AM, Sean Nyekjaer wrote:
> ---
> Should we default to gsm, umts + lte if the call fails?
> 
>   drivers/simcommodem/radio-settings.c | 53 +++++++++++++++++++++++++---
>   1 file changed, 49 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/simcommodem/radio-settings.c b/drivers/simcommodem/radio-settings.c
> index 2a9dbaa2..2bb0d148 100644
> --- a/drivers/simcommodem/radio-settings.c
> +++ b/drivers/simcommodem/radio-settings.c
> @@ -97,6 +97,46 @@ error:
>   	CALLBACK_WITH_FAILURE(cb, -1, cbd->data);
>   }
>   
> +static void cnmp_rat_support_cb(gboolean ok, GAtResult *result, gpointer user_data)
> +{
> +	struct cb_data *cbd = user_data;
> +	ofono_radio_settings_rat_mode_query_cb_t cb = cbd->cb;
> +	struct ofono_error error;
> +	int index;
> +	GAtResultIter iter;
> +	unsigned int available_rats = 0;
> +
> +	DBG("ok %d", ok);
> +
> +	decode_at_error(&error, g_at_result_final_response(result));
> +
> +	if (!ok) {
> +		goto error;
> +	}

No {} if not needed please

> +
> +	g_at_result_iter_init(&iter, result);
> +
> +	while (g_at_result_iter_next(&iter, "+CNMP:")) {
> +		if (!g_at_result_iter_open_list(&iter))
> +			break;

doc/coding-style.txt item M1

> +		while (1) {
> +			if (!g_at_result_iter_next_number(&iter, &index))
> +				break;
> +			available_rats |= r_mode_to_radio_access_mode(index);

as above

> +
> +		}
> +	}
> +
> +	DBG("available_rats %d", available_rats);
> +
> +	cb(&error, available_rats, cbd->data);
> +
> +	return;
> +
> +error:
> +	CALLBACK_WITH_FAILURE(cb, -1, cbd->data);
> +}
> +
>   static void simcom_query_rat_mode(struct ofono_radio_settings *rs,
>   				ofono_radio_settings_rat_mode_query_cb_t cb,
>   				void *data)
> @@ -169,11 +209,16 @@ static void simcom_query_available_rats(struct ofono_radio_settings *rs,
>   			ofono_radio_settings_available_rats_query_cb_t cb,
>   			void *data)
>   {
> -	unsigned int available_rats = OFONO_RADIO_ACCESS_MODE_GSM
> -				| OFONO_RADIO_ACCESS_MODE_UMTS
> -				| OFONO_RADIO_ACCESS_MODE_LTE;
> +	struct radio_settings_data *rsd = ofono_radio_settings_get_data(rs);
> +	struct cb_data *cbd = cb_data_new(cb, data);
> +
> +	DBG("");
>   
> -	CALLBACK_WITH_SUCCESS(cb, available_rats, data);
> +	if (g_at_chat_send(rsd->chat, "AT+CNMP=?", cnmp_prefix,
> +				cnmp_rat_support_cb, cbd, g_free) == 0) {
> +		CALLBACK_WITH_FAILURE(cb, -1, data);
> +		g_free(cbd);
> +	}
>   }
>   
>   static void cnmp_support_cb(gboolean ok, GAtResult *result, gpointer user_data)


Regards,
-Denis

  reply	other threads:[~2024-10-09 15:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-08  9:10 [PATCH 1/3] drivers: simcommodem: create rat to radio_access_mode function Sean Nyekjaer
2024-10-08  9:10 ` [PATCH 2/3] drivers: simcommodem: query modem for available rat modes Sean Nyekjaer
2024-10-09 15:27   ` Denis Kenzior [this message]
2024-10-08  9:10 ` [PATCH 3/3] sim7100: create lte atom in post_sim() Sean Nyekjaer
2024-10-09 15:20 ` [PATCH 1/3] drivers: simcommodem: create rat to radio_access_mode function Denis Kenzior

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=8fbd4cf7-ef82-4a44-8cbb-76ee26cf0591@gmail.com \
    --to=denkenz@gmail.com \
    --cc=ofono@lists.linux.dev \
    --cc=sean@geanix.com \
    /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