From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCH 02/12] atgen changes for setting TE character set
Date: Thu, 09 Sep 2010 09:50:27 -0500 [thread overview]
Message-ID: <4C88F433.6070106@gmail.com> (raw)
In-Reply-To: <1284035516-21359-3-git-send-email-jeevaka.badrappan@elektrobit.com>
[-- Attachment #1: Type: text/plain, Size: 2982 bytes --]
Hi Jeevaka,
On 09/09/2010 07:31 AM, Jeevaka Badrappan wrote:
> ---
> plugins/atgen.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 59 insertions(+), 0 deletions(-)
>
> diff --git a/plugins/atgen.c b/plugins/atgen.c
> index 1ce2467..a8ca177 100644
> --- a/plugins/atgen.c
> +++ b/plugins/atgen.c
> @@ -25,6 +25,8 @@
>
> #include <errno.h>
> #include <stdlib.h>
> +#include <string.h>
> +#include <stdio.h>
>
> #include <glib.h>
> #include <gatchat.h>
> @@ -55,6 +57,9 @@
> #include <ofono/gprs.h>
> #include <ofono/gprs-context.h>
>
> +static const char *none_prefix[] = { NULL };
> +static const char *cscs_prefix[] = { "+CSCS:", NULL };
> +
> static const char *tty_opts[] = {
> "Baud",
> "Read",
> @@ -67,6 +72,58 @@ static const char *tty_opts[] = {
> NULL,
> };
>
> +static const char *best_charset(int supported)
> +{
> + const char *charset = "Invalid";
> +
> + if (supported & AT_UTIL_CHARSET_GSM)
> + charset = "GSM";
> +
> + if (supported & AT_UTIL_CHARSET_UTF8)
> + charset = "UTF-8";
> +
> + return charset;
> +}
> +
> +static void set_charset_cb(gboolean ok, GAtResult *result,
> + gpointer user_data)
> +{
> + if (!ok)
> + ofono_error("Setting character set failed");
Use of functions that do nothing is discouraged. If CSCS fails, it can
be easily seen from the AT command trace.
> +}
> +
> +static void list_charsets_cb(gboolean ok, GAtResult *result,
> + gpointer user_data)
> +{
> + struct ofono_modem *modem = user_data;
> + GAtChat *chat = ofono_modem_get_data(modem);
> + const char *charset;
> + int supported = 0;
> + char buf[32];
> +
> + if (!ok)
> + return;
> +
> + if (!at_util_parse_cscs_supported(result, &supported))
> + return;
> +
> + charset = best_charset(supported);
> + snprintf(buf, sizeof(buf), "AT+CSCS=\"%s\"", charset);
> +
> + if (!g_at_chat_send(chat, buf, none_prefix, set_charset_cb, modem,
> + NULL))
> + ofono_error("AT+CSCS=%s request failed", charset);
In general oFono plugins do not check for errors on g_at_chat_send.
There are two reasons:
- There's nothing that can be done anyway, and printing the error is not
really helpful
- The plugin just setup the device, so any errors are most likely
programmer errors.
> +}
> +
> +static void list_charsets(struct ofono_modem *modem)
> +{
> + GAtChat *chat = ofono_modem_get_data(modem);
> +
> + if (!g_at_chat_send(chat, "AT+CSCS=?", cscs_prefix,
> + list_charsets_cb, modem, NULL))
> + ofono_error("AT+CSCS=? request failed");
Same comment as above..
> +}
> +
> static int atgen_probe(struct ofono_modem *modem)
> {
> return 0;
> @@ -207,6 +264,8 @@ static void atgen_pre_sim(struct ofono_modem *modem)
>
> if (sim)
> ofono_sim_inserted_notify(sim, TRUE);
> +
> + list_charsets(modem);
> }
>
> static void atgen_post_sim(struct ofono_modem *modem)
Regards,
-Denis
next prev parent reply other threads:[~2010-09-09 14:50 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-09 12:31 Add support for Send USSD proactive command handling Jeevaka Badrappan
2010-09-09 12:31 ` [PATCH 01/12] atutil changes for parsing cscs query and cscs support Jeevaka Badrappan
2010-09-09 14:45 ` Denis Kenzior
2010-09-09 18:56 ` Jeevaka Badrappan
2010-09-09 18:56 ` [PATCH 01/13] " Jeevaka Badrappan
2010-09-10 17:27 ` Denis Kenzior
2010-09-09 12:31 ` [PATCH 02/12] atgen changes for setting TE character set Jeevaka Badrappan
2010-09-09 14:50 ` Denis Kenzior [this message]
2010-09-09 19:00 ` [PATCH 02/13] " Jeevaka Badrappan
2010-09-09 12:31 ` [PATCH 03/12] phonesim " Jeevaka Badrappan
2010-09-09 19:01 ` [PATCH 03/13] " Jeevaka Badrappan
2010-09-10 17:07 ` Denis Kenzior
2010-09-10 20:29 ` [PATCH 2/7] " Jeevaka Badrappan
2010-09-09 12:31 ` [PATCH 04/12] USSD atom driver changes to read current character setting Jeevaka Badrappan
2010-09-09 19:02 ` [PATCH 04/13] " Jeevaka Badrappan
2010-09-09 12:31 ` [PATCH 05/12] Add internal api __ofono_call_barring_is_busy Jeevaka Badrappan
2010-09-09 15:06 ` Denis Kenzior
2010-09-09 12:31 ` [PATCH 06/12] Add internal api __ofono_call_forwarding_is_busy Jeevaka Badrappan
2010-09-09 15:07 ` Denis Kenzior
2010-09-09 12:31 ` [PATCH 07/12] Add internal api __ofono_call_settings_is_busy Jeevaka Badrappan
2010-09-09 15:07 ` Denis Kenzior
2010-09-09 12:31 ` [PATCH 08/12] Add Send USSD command specific result codes Jeevaka Badrappan
2010-09-09 15:09 ` Denis Kenzior
2010-09-09 12:31 ` [PATCH 09/12] Add Send USSD terminal response data structures Jeevaka Badrappan
2010-09-09 15:20 ` Denis Kenzior
2010-09-09 12:31 ` [PATCH 10/12] Add build_dataobj_ussd_text for ussd specific text string handling Jeevaka Badrappan
2010-09-09 15:31 ` Denis Kenzior
2010-09-09 19:06 ` [PATCH 10/13] " Jeevaka Badrappan
2010-09-10 17:29 ` Denis Kenzior
2010-09-10 20:19 ` [PATCH 4/7] " Jeevaka Badrappan
2010-09-10 20:22 ` Denis Kenzior
2010-09-09 12:31 ` [PATCH 11/12] Internal and Driver api changes for Send USSD proactive command Jeevaka Badrappan
2010-09-09 15:59 ` Denis Kenzior
2010-09-09 20:25 ` [PATCH 6/8] " Jeevaka Badrappan
2010-09-09 20:25 ` [PATCH 7/8] Add __ofono_ussd_initiate internal api for Sending USSD Jeevaka Badrappan
2010-09-09 12:31 ` [PATCH 12/12] Handling of Send USSD proactive command Jeevaka Badrappan
2010-09-09 15:37 ` Denis Kenzior
2010-09-09 19:42 ` [PATCH 8/8] " Jeevaka Badrappan
2010-09-13 23:00 ` Added UCS2 handling and review comments incorporated Jeevaka Badrappan
2010-09-13 23:00 ` [PATCH 1/8] smsutil: Add USSD encoding function Jeevaka Badrappan
2010-09-13 23:00 ` [PATCH 2/8] util: Add UCS2 to GSM 7bit converion function Jeevaka Badrappan
2010-09-13 23:00 ` [PATCH 3/8] test-util: Add function for validating UCS2 to GSM bit conversion Jeevaka Badrappan
2010-09-13 23:00 ` [PATCH 4/8] USSD atom driver changes to read current character setting Jeevaka Badrappan
2010-09-13 23:00 ` [PATCH 5/8] Internal and Driver API changes for Send USSD Jeevaka Badrappan
2010-09-13 23:00 ` [PATCH 6/8] Add __ofono_ussd_initiate internal api for Sending USSD Jeevaka Badrappan
2010-09-13 23:00 ` [PATCH 7/8] stk: Handling of Send USSD proactive command Jeevaka Badrappan
2010-09-13 23:00 ` [PATCH 8/8] stkutil: Add handling of error case scenario in build USSD data object Jeevaka Badrappan
2010-09-14 21:49 ` [PATCH 3/4] stk: Handling of Send USSD proactive command Jeevaka Badrappan
2010-09-15 17:15 ` Denis Kenzior
2010-09-14 17:45 ` [PATCH 6/8] Add __ofono_ussd_initiate internal api for Sending USSD Denis Kenzior
2010-09-14 21:31 ` [PATCH 2/4] " Jeevaka Badrappan
2010-09-15 17:13 ` Denis Kenzior
2010-09-14 17:24 ` [PATCH 5/8] Internal and Driver API changes for Send USSD Denis Kenzior
2010-09-14 21:23 ` [PATCH 1/4] " Jeevaka Badrappan
2010-09-15 17:13 ` Denis Kenzior
2010-09-14 17:01 ` [PATCH 4/8] USSD atom driver changes to read current character setting Denis Kenzior
2010-09-14 17:01 ` [PATCH 3/8] test-util: Add function for validating UCS2 to GSM bit conversion Denis Kenzior
2010-09-14 17:01 ` [PATCH 2/8] util: Add UCS2 to GSM 7bit converion function Denis Kenzior
2010-09-14 16:58 ` [PATCH 1/8] smsutil: Add USSD encoding 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=4C88F433.6070106@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