[PATCH] qmicli: fix --dms-get-band-capabilities output on 32-bit platforms

Reinhard Speyerer rspmn at arcor.de
Sat Mar 19 20:42:06 UTC 2016


The @enum_name at _build_string_from_mask template in
qmi-flags64-types-template.c uses a local gulong number variable.
On platforms where sizeof(gulong) < sizeof(Qmi*BandCapability) this
may cause bands to be missing from qmicli output or incorrect bands
to be contained in the output. Replace gulong number with guint64
number to fix this.

Signed-off-by: Reinhard Speyerer <rspmn at arcor.de>
---
With the patch the qmicli -v --dms-get-band-capabilities output for a
Sierra Wireless MC7430 changes from
...
>>>>>> TLV:
>>>>>>   type       = "LTE Band Capability" (0x10)
>>>>>>   length     = 8
>>>>>>   value      = D5:00:16:08:E0:01:00:00
>>>>>>   translated = 1, 3, 5, 7, 8, 18, 19, 21
>>>>>> TLV:
>>>>>>   type       = "Band Capability" (0x01)
>>>>>>   length     = 8
>>>>>>   value      = 00:00:40:0C:00:00:06:10
>>>>>>   translated = wcdma-2100, wcdma-850-us, wcdma-800, bc-15
...
to
...
>>>>>> TLV:
>>>>>>   type       = "LTE Band Capability" (0x10)
>>>>>>   length     = 8
>>>>>>   value      = D5:00:16:08:E0:01:00:00
>>>>>>   translated = 1, 3, 5, 7, 8, 18, 19, 21, 38, 39, 40, 41
>>>>>> TLV:
>>>>>>   type       = "Band Capability" (0x01)
>>>>>>   length     = 8
>>>>>>   value      = 00:00:40:0C:00:00:06:10
>>>>>>   translated = wcdma-2100, wcdma-850-us, wcdma-800, wcdma-900, wcdma-1700-japan, wcdma-850-japan
...
.

(LTE band 28 is missing from the output in both cases since the corresponding
bit is listed as reserved in enum QmiDmsLteBandCapability and the Gobi API.)

Reinhard

diff --git a/build-aux/templates/qmi-flags64-types-template.c b/build-aux/templates/qmi-flags64-types-template.c
index c1c5491..a92824c 100644
--- a/build-aux/templates/qmi-flags64-types-template.c
+++ b/build-aux/templates/qmi-flags64-types-template.c
@@ -49,7 +49,7 @@ gchar *
         /* Build list with single-bit masks */
         if (mask & @enum_name at _values[i].value) {
             guint c;
-            gulong number = @enum_name at _values[i].value;
+            guint64 number = @enum_name at _values[i].value;
 
             for (c = 0; number; c++)
                 number &= number - 1;


More information about the libqmi-devel mailing list