gnokii-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] libgnokii and core programs branch, master, updated. rel_0_6_28-16


From: Daniele Forsi
Subject: [SCM] libgnokii and core programs branch, master, updated. rel_0_6_28-163-gd6f3113
Date: Mon, 28 Dec 2009 17:21:51 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "libgnokii and core programs".

The branch, master has been updated
       via  d6f3113a19959e61d270096a4d5217570a11f0a7 (commit)
      from  1f10bbacad1fd917c18c610c8d34ffd5299c2421 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/gnokii.git/commit/?id=d6f3113a19959e61d270096a4d5217570a11f0a7


commit d6f3113a19959e61d270096a4d5217570a11f0a7
Author: Daniele Forsi <address@hidden>
Date:   Mon Dec 28 18:14:29 2009 +0100

    Make --identify show Service Provider Name if different from network name
    
    If available show contents of EF SPN in addition to network and country 
names;
    this can be the name of the virtual operator who issued the SIM card.

diff --git a/ChangeLog b/ChangeLog
index 7d3fe61..91ddd50 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -82,6 +82,8 @@
       multipart messages                          (Paulius Bulotas)
  * at driver updates
     o support Samsung SMS encoding                      (Paweł Kot)
+ * pcsc driver updates
+    o show name of virtual operator in --identify   (Daniele Forsi)
 
 0.6.28
 ======
diff --git a/common/phones/pcsc.c b/common/phones/pcsc.c
index acdd6a7..9b6f9f0 100644
--- a/common/phones/pcsc.c
+++ b/common/phones/pcsc.c
@@ -434,6 +434,26 @@ static gn_error get_phase(const char **phase)
        return error;
 }
 
+/* read SPN and convert it into an ASCII string in the provided buffer (at 
least GN_PCSC_SPN_MAX_LENGTH bytes long)
+according to subclause 10.3.11 and Annex B
+*/
+static gn_error get_spn(char *result)
+{
+       LONG ret;
+       BYTE *buf;
+       gn_error error;
+
+       ret = pcsc_read_file(&IoStruct, GN_PCSC_FILE_DF_GSM, 
GN_PCSC_FILE_EF_SPN);
+       error = get_gn_error(&IoStruct, ret);
+       if (error != GN_ERR_NONE) return error;
+
+       /* Skip first byte (it's a bit field) */
+       buf = IoStruct.pbRecvBuffer + 1;
+       alpha_tag_decode(result, buf, GN_PCSC_SPN_MAX_LENGTH);
+
+       return GN_ERR_NONE;
+}
+
 /* functions for libgnokii stuff */
 
 static gn_error functions(gn_operation op, gn_data *data, struct 
gn_statemachine *state)
@@ -533,6 +553,7 @@ static gn_error Identify(gn_data *data, struct 
gn_statemachine *state)
 {
        gn_error error;
        char imsi[GN_PCSC_IMSI_MAX_LENGTH], iccid[GN_PCSC_ICCID_MAX_LENGTH];
+       char spn[GN_PCSC_SPN_MAX_LENGTH] = "";
        const char *phase = "??";
 
        /* read ICCID */
@@ -542,10 +563,13 @@ static gn_error Identify(gn_data *data, struct 
gn_statemachine *state)
                dprintf("ICCID = %s\n", iccid);
        }
 
+       /* read Service Provider Name */
+       (void) get_spn(spn);
+
        /* read IMSI */
        error = get_imsi(imsi);
        if (error == GN_ERR_NONE) {
-               char mcc[4], mnc[4], net_code[8];
+               char mcc[4], mnc[4], net_code[8], *network_name;
                int mnc_len = 2;
 
                /* extract MCC and MNC */
@@ -556,7 +580,11 @@ static gn_error Identify(gn_data *data, struct 
gn_statemachine *state)
                dprintf("IMSI = %s Home PLMN = MCC %s MNC %s\n", imsi, mcc, 
mnc);
                snprintf(net_code, sizeof(net_code), "%s %s", mcc, mnc);
                /* get operator and country names as strings from libgnokii */
-               snprintf(data->manufacturer, GN_MANUFACTURER_MAX_LENGTH, "%s 
(%s)", gn_network_name_get(net_code), gn_country_name_get(mcc));
+               network_name = gn_network_name_get(net_code);
+               if (*spn && strcmp(spn, network_name))
+                       snprintf(data->manufacturer, 
GN_MANUFACTURER_MAX_LENGTH, "%s, %s (%s)", spn, network_name, 
gn_country_name_get(mcc));
+               else
+                       snprintf(data->manufacturer, 
GN_MANUFACTURER_MAX_LENGTH, "%s (%s)", network_name, gn_country_name_get(mcc));
        }
 
        snprintf(data->model, GN_MODEL_MAX_LENGTH, "%s", "APDU");
diff --git a/include/phones/pcsc.h b/include/phones/pcsc.h
index b487130..832d43b 100644
--- a/include/phones/pcsc.h
+++ b/include/phones/pcsc.h
@@ -89,6 +89,7 @@ subclause : command
 /* misc defines */
 #define GN_PCSC_ICCID_MAX_LENGTH 21
 #define GN_PCSC_IMSI_MAX_LENGTH 16
+#define GN_PCSC_SPN_MAX_LENGTH 17
 
 /* some file identifiers (full list is in subclause 10.7) */
 
@@ -114,6 +115,8 @@ subclause : command
 #define GN_PCSC_FILE_EF_SMSP 0x6f42
 /* Last Numbers Dialed */
 #define GN_PCSC_FILE_EF_LND 0x6F44
+/* Service Provider Name */
+#define GN_PCSC_FILE_EF_SPN 0x6F46
 /* Service Dialing Numbers */
 #define GN_PCSC_FILE_EF_SDN 0x6F49
 /* Location Information */

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog             |    2 ++
 common/phones/pcsc.c  |   32 ++++++++++++++++++++++++++++++--
 include/phones/pcsc.h |    3 +++
 3 files changed, 35 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
libgnokii and core programs




reply via email to

[Prev in Thread] Current Thread [Next in Thread]