summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2013-03-06 20:42:35 +0100
committerAleksander Morgado <aleksander@lanedo.com>2013-03-07 09:09:54 +0100
commit8045711f3c4985b5fb85c5359a6cb516af09fe06 (patch)
tree7882faa8d9bbeb689497e3c49303f4d839145eb3
parent9e0a53e697ff704df3c7db53412488ec27b04d43 (diff)
dms: activation code string needs explicit 1-byte length prefix
Reported by Arman Uguray <armansito@google.com>
-rw-r--r--build-aux/qmi-codegen/VariableString.py10
-rw-r--r--data/qmi-service-dms.json11
2 files changed, 11 insertions, 10 deletions
diff --git a/build-aux/qmi-codegen/VariableString.py b/build-aux/qmi-codegen/VariableString.py
index a127eb7..faa2085 100644
--- a/build-aux/qmi-codegen/VariableString.py
+++ b/build-aux/qmi-codegen/VariableString.py
@@ -49,17 +49,17 @@ class VariableString(Variable):
self.is_fixed_size = False
# Variable-length strings in heap
self.needs_dispose = True
- # Strings which are given as the full value of a TLV will NOT have a
- # length prefix
- if 'type' in dictionary and dictionary['type'] == 'TLV':
- self.length_prefix_size = 0
- elif 'size-prefix-format' in dictionary:
+ if 'size-prefix-format' in dictionary:
if dictionary['size-prefix-format'] == 'guint8':
self.length_prefix_size = 8
elif dictionary['size-prefix-format'] == 'guint16':
self.length_prefix_size = 16
else:
raise ValueError('Invalid size prefix format (%s): not guint8 or guint16' % dictionary['size-prefix-format'])
+ # Strings which are given as the full value of a TLV and which don't have
+ # a explicit 'size-prefix-format' will NOT have a length prefix
+ elif 'type' in dictionary and dictionary['type'] == 'TLV':
+ self.length_prefix_size = 0
else:
# Default to UINT8
self.length_prefix_size = 8
diff --git a/data/qmi-service-dms.json b/data/qmi-service-dms.json
index 39cde82..2f8a186 100644
--- a/data/qmi-service-dms.json
+++ b/data/qmi-service-dms.json
@@ -564,11 +564,12 @@
"service" : "DMS",
"id" : "0x0032",
"version" : "1.3",
- "input" : [ { "name" : "Activation Code",
- "id" : "0x01",
- "mandatory" : "yes",
- "type" : "TLV",
- "format" : "string" } ],
+ "input" : [ { "name" : "Activation Code",
+ "id" : "0x01",
+ "mandatory" : "yes",
+ "type" : "TLV",
+ "format" : "string",
+ "size-prefix-format" : "guint8" } ],
"output" : [ { "common-ref" : "Operation Result" } ] },
// *********************************************************************************