[PATCH] Present list of preferred languages on SimManager interface.

Andrzej Zaborowski andrew.zaborowski at intel.com
Mon Sep 14 10:33:24 PDT 2009


Hi Denis,

2009/9/14 Denis Kenzior <denkenz at gmail.com>:
>> +static int parse_language_list(char **out_list, const unsigned char
>> *sim_list, +                          int length)
>> +{
>> +     unsigned char code[3];
>> +     int count, i;
>> +     long written;
>> +
>> +     count = 0;
>> +     length--;
>> +
>> +     for (i = 0; i < length; i += 2) {
>> +             code[0] = sim_list[i + 0];
>> +             code[1] = sim_list[i + 1];
>> +             code[2] = 0;
>> +
>> +             if (code[0] == 0xff || code[1] == 0xff)
>> +                     continue;
>> +
>> +             out_list[count] = convert_gsm_to_utf8(code, 2,
>> +                                                     NULL, &written, 0);
>
> Lets skip the gsm conversion.  The ISO639 standard only uses latin characters
> which are guaranteed to be the same between utf8 / gsm.

Ok, I was considering doing that but decided there wasn't any gain
from not doing the conversion.

>
>> +static void sim_efpl_read_cb(int ok,
>> +                             enum ofono_sim_file_structure structure,
>> +                             int length, int record,
>> +                             const unsigned char *data,
>> +                             int record_length, void *userdata)
>> +{
>> +     struct ofono_sim *sim = userdata;
>> +     unsigned char *efli = sim->efli;
>> +     const unsigned char *efpl = data;
>> +     int efli_length = sim->efli_length;
>> +     int efpl_length = length;
>> +     int count;
>> +     const char *path = __ofono_atom_get_path(sim->atom);
>> +     DBusConnection *conn = ofono_dbus_get_connection();
>> +
>> +     if (!ok || structure != OFONO_SIM_FILE_STRUCTURE_TRANSPARENT)
>> +             efpl = NULL;
>> +
>> +     if (length < 2)
>> +             efpl = NULL;
>> +
>> +     sim->language_prefs = g_malloc(((efli_length + efpl_length) / 2 + 1) *
>> +                     sizeof(char *));
>> +
>> +     count = 0;
>> +
>> +     /* Make a list of languages in both files in order of preferences
>> +      * following 31.102.
>> +      */
>> +
>> +     if (efli && efpl && efli[0] == 0xff && efli[1] == 0xff) {
>> +             count += parse_language_list(sim->language_prefs + count,
>> +                                             efpl, efpl_length);
>> +             efpl = NULL;
>> +     }
>> +
>> +     if (efli) {
>> +             count += parse_language_list(sim->language_prefs + count,
>> +                                             efli, efli_length);
>> +             g_free(efli);
>> +             sim->efli = NULL;
>> +     }
>> +
>> +     if (efpl)
>> +             count += parse_language_list(sim->language_prefs + count,
>> +                                             efpl, efpl_length);
>
> If we're going down the path of preserving both EFli and EFpl, then you should
> make sure no duplicates exist. Alternatively we can assume that oFono/UI will
> support all languages and simply not read EFpl if there is useable information
> in EFli.

Let's present the full list, I added checking for duplicates.

>
>> +static void sim_retrieve_efli(struct ofono_sim *sim)
>> +{
>> +     /* According to 31.102 the EFli is read first and EFpl is then
>> +      * only read if none of the EFli languages are supported by user
>> +      * interface.  51.011 mandates the exact opposite, making EFpl/EFelp
>> +      * preferred over EFlp (same ID as EFli, different format).
>> +      * However we don't depend on the user interface and so
>> +      * need to read both files now.
>> +      */
>> +     ofono_sim_read(sim, SIM_EFLI_FILEID, sim_efli_read_cb, sim);
>> +     ofono_sim_read(sim, SIM_EFPL_FILEID, sim_efpl_read_cb, sim);
>
> Strictly speaking 31.101 & 31.102 supersede 51.011.

I think that was the plan but apparently they don't have all contents
51.011 has, and 31.102 even explicitely refers to 51.011 for the EFpl
format (which 51.011 only says is defined by ETSI).

Also the card I tested has a 5 byte EFli / EFlp, filled with 0xff
bytes, which means it must be in the 51.011 format so the document is
not obsolete.

Regards
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Present-list-of-preferred-languages-on-SimManager-in.patch
Type: text/x-patch
Size: 5267 bytes
Desc: not available
URL: <http://lists.ofono.org/pipermail/ofono/attachments/20090914/07dc3c38/attachment.bin>


More information about the ofono mailing list