[PATCH 3/3] nas: new 'Extended LTE Band Preference' TLV in "Set/Get SSP"

Aleksander Morgado aleksander at aleksander.es
Thu Nov 9 07:32:30 UTC 2017


The "LTE Band Preference" TLV is defined as a 64bit mask, and
therefore it can only report up to 64 bands (1-64).

The new 'Extended LTE Band Preference' TLV is defined as a sequence of
four 64-bit masks, allowing up to 256 bands reported.

    <<<<<< TLV:
    <<<<<<   type       = "Extended LTE Band Preference" (0x23)
    <<<<<<   length     = 32
    <<<<<<   value      = DF:18:09:3B:A0:01:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00
    <<<<<<   translated = { [0] = '1787696847071 ' [1] = '0 ' [2] = '0 ' [3] = '0 '}

Based on a patch from Wolfgang Tolkien <wtolkien at cypress.bc.ca>
---
 data/qmi-service-nas.json | 32 ++++++++++++++++++++++++++++++--
 src/qmicli/qmicli-nas.c   | 33 ++++++++++++++++++++++++++++++++-
 2 files changed, 62 insertions(+), 3 deletions(-)

diff --git a/data/qmi-service-nas.json b/data/qmi-service-nas.json
index dcdd03d..24d4ff0 100644
--- a/data/qmi-service-nas.json
+++ b/data/qmi-service-nas.json
@@ -1413,7 +1413,21 @@
                       "type"          : "TLV",
                       "since"         : "1.0",
                       "format"        : "guint64",
-                      "public-format" : "QmiNasTdScdmaBandPreference" } ],
+                      "public-format" : "QmiNasTdScdmaBandPreference" },
+                    { "name"          : "Extended LTE Band Preference",
+                      "id"            : "0x24",
+                      "mandatory"     : "no",
+                      "type"          : "TLV",
+                      "since"         : "1.20",
+                      "format"        : "sequence",
+                      "contents"      : [ { "name"   : "Mask Low",
+                                            "format" : "guint64" },
+                                          { "name"   : "Mask Mid Low",
+                                            "format" : "guint64" },
+                                          { "name"   : "Mask Mid High",
+                                            "format" : "guint64" },
+                                          { "name"   : "Mask High",
+                                            "format" : "guint64" } ] } ],
      "output"  : [  { "common-ref" : "Operation Result" } ] },
 
   // *********************************************************************************
@@ -1506,7 +1520,21 @@
                                         "format" : "guint16" },
                                       { "name"          : "Includes PCS Digit",
                                         "format"        : "guint8",
-                                        "public-format" : "gboolean" } ] } ] },
+                                        "public-format" : "gboolean" } ] },
+                    { "name"          : "Extended LTE Band Preference",
+                      "id"            : "0x23",
+                      "mandatory"     : "no",
+                      "type"          : "TLV",
+                      "since"         : "1.20",
+                      "format"        : "sequence",
+                      "contents"      : [ { "name"   : "Mask Low",
+                                            "format" : "guint64" },
+                                          { "name"   : "Mask Mid Low",
+                                            "format" : "guint64" },
+                                          { "name"   : "Mask Mid High",
+                                            "format" : "guint64" },
+                                          { "name"   : "Mask High",
+                                            "format" : "guint64" } ] } ] },
 
   // *********************************************************************************
   {  "name"    : "Get Operator Name",
diff --git a/src/qmicli/qmicli-nas.c b/src/qmicli/qmicli-nas.c
index 3ee9653..4cca61b 100644
--- a/src/qmicli/qmicli-nas.c
+++ b/src/qmicli/qmicli-nas.c
@@ -1953,7 +1953,7 @@ get_technology_preference_ready (QmiClientNas *client,
 
 static void
 get_system_selection_preference_ready (QmiClientNas *client,
-                                 GAsyncResult *res)
+                                       GAsyncResult *res)
 {
     QmiMessageNasGetSystemSelectionPreferenceOutput *output;
     GError *error = NULL;
@@ -1969,6 +1969,7 @@ get_system_selection_preference_ready (QmiClientNas *client,
     QmiNasGsmWcdmaAcquisitionOrderPreference gsm_wcdma_acquisition_order_preference;
     guint16 mcc;
     guint16 mnc;
+    guint64 extended_lte_band_preference[4];
     gboolean has_pcs_digit;
 
     output = qmi_client_nas_get_system_selection_preference_finish (client, res, &error);
@@ -2031,6 +2032,36 @@ get_system_selection_preference_ready (QmiClientNas *client,
         g_free (str);
     }
 
+    if (qmi_message_nas_get_system_selection_preference_output_get_extended_lte_band_preference (
+            output,
+            &extended_lte_band_preference[0],
+            &extended_lte_band_preference[1],
+            &extended_lte_band_preference[2],
+            &extended_lte_band_preference[3],
+            NULL)) {
+        guint    i;
+        gboolean first = TRUE;
+
+        g_print ("\tLTE band preference (extended): '");
+        for (i = 0; i < G_N_ELEMENTS (extended_lte_band_preference); i++) {
+            guint j;
+
+            for (j = 0; j < 64; j++) {
+                guint band;
+
+                if (!(extended_lte_band_preference[i] & (((guint64) 1) << j)))
+                    continue;
+                band = 1 + j + (i * 64);
+                if (first) {
+                    g_print ("%u", band);
+                    first = FALSE;
+                } else
+                    g_print (", %u", band);
+            }
+        }
+        g_print ("'\n");
+    }
+
     if (qmi_message_nas_get_system_selection_preference_output_get_td_scdma_band_preference (
             output,
             &td_scdma_band_preference,
-- 
2.15.0



More information about the libqmi-devel mailing list