summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2009-07-28 15:26:37 -0500
committerDenis Kenzior <denkenz@gmail.com>2009-07-29 12:26:03 -0500
commit48d46f11362dee85926a6dd21c06458cbebf9e09 (patch)
treee7583a4b38abc00f21db94056e86e49c0aa03604 /drivers
parentaa9212ca0fcc0b7265ba481f2794444964bfc778 (diff)
downloadofono-48d46f11362dee85926a6dd21c06458cbebf9e09.tar.bz2
Experimental support for modems with no UCS2/UTF8
Some modems, like the G1 do not support UCS2/UTF8. However, we can still attempt to export some phonebook entries which are probably going to be simple Latin1 characters (e.g. 411, etc)
Diffstat (limited to 'drivers')
-rw-r--r--drivers/atmodem/phonebook.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/drivers/atmodem/phonebook.c b/drivers/atmodem/phonebook.c
index 71b89212..d880c551 100644
--- a/drivers/atmodem/phonebook.c
+++ b/drivers/atmodem/phonebook.c
@@ -43,6 +43,7 @@
#define CHARSET_UTF8 1
#define CHARSET_UCS2 2
+#define CHARSET_IRA 4
#define CHARSET_SUPPORT (CHARSET_UTF8 | CHARSET_UCS2)
static const char *none_prefix[] = { NULL };
@@ -85,6 +86,9 @@ static const char *best_charset(int supported)
{
const char *charset = "Invalid";
+ if (supported & CHARSET_IRA)
+ charset = "IRA";
+
if (supported & CHARSET_UCS2)
charset = "UCS2";
@@ -104,6 +108,9 @@ static void at_cpbr_notify(GAtResult *result, gpointer user_data)
dump_response("at_cbpr_notify", 1, result);
+ if (at->pb->supported & CHARSET_IRA)
+ current = CHARSET_IRA;
+
if (at->pb->supported & CHARSET_UCS2)
current = CHARSET_UCS2;
@@ -180,6 +187,9 @@ static void at_cpbr_notify(GAtResult *result, gpointer user_data)
g_free(sip_uri_utf8);
g_free(tel_uri_utf8);
} else {
+ /* In the case of IRA charset, assume these are Latin1
+ * characters, same as in UTF8
+ */
ofono_phonebook_entry(cbd->modem, index, number, type,
text, hidden, group, adnumber,
adtype, secondtext, email,
@@ -472,13 +482,29 @@ static void at_list_charsets_cb(gboolean ok, GAtResult *result,
at->pb->supported |= CHARSET_UTF8;
else if (!strcmp(charset, "UCS2"))
at->pb->supported |= CHARSET_UCS2;
+ else if (!strcmp(charset, "IRA"))
+ at->pb->supported |= CHARSET_IRA;
}
if (in_list && !g_at_result_iter_close_list(&iter))
goto error;
- if (!(at->pb->supported & CHARSET_SUPPORT))
- goto error;
+ if (!(at->pb->supported & CHARSET_SUPPORT)) {
+ /* Some modems, like the Google G1, do not support UCS2 or UTF8
+ * Such modems are effectively junk, but we can still get some
+ * useful information out of them by using IRA charset, which
+ * is essentially Latin1. Still, all bets are off if a SIM
+ * with UCS2 encoded entries is present.
+ */
+ if (at->pb->supported & CHARSET_IRA) {
+ ofono_error("This modem does not support UCS2 or UTF8 "
+ "character sets. This means no i18n "
+ "phonebook is possible on this modem,"
+ " if this is in error, submit patches "
+ "to properly support this hardware");
+ } else
+ goto error;
+ }
if (g_at_chat_send(at->parser, "AT+CPBS=?", cpbs_prefix,
at_list_storages_cb, modem, NULL) > 0)