aboutsummaryrefslogtreecommitdiffstats
path: root/build-aux/qmi-codegen/Variable.py
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2012-10-19 19:26:15 -0500
committerAleksander Morgado <aleksander@lanedo.com>2012-10-23 17:25:05 +0200
commitcb5851e7000d063bf8ff8917d15f9882d2612473 (patch)
treed803b88ffd5313feccee826b212cb1bd7ba8e977 /build-aux/qmi-codegen/Variable.py
parent51eff87f79262c9e9c4321a2517331959bfd04c6 (diff)
downloadexternal_libqmi-cb5851e7000d063bf8ff8917d15f9882d2612473.zip
external_libqmi-cb5851e7000d063bf8ff8917d15f9882d2612473.tar.gz
external_libqmi-cb5851e7000d063bf8ff8917d15f9882d2612473.tar.bz2
libqmi-glib,qmi-codegen: add endian-ness annotation capability
Some values are sent by the firmware in big endian byte order, specifically IP addresses, which are sent in network byte order (ie, big endian). Add the ability to specify the byte order the firmware handles the value as, and convert that to host byte order when reading/writing QMI buffers.
Diffstat (limited to 'build-aux/qmi-codegen/Variable.py')
-rw-r--r--build-aux/qmi-codegen/Variable.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/build-aux/qmi-codegen/Variable.py b/build-aux/qmi-codegen/Variable.py
index 6eb65d6..3f3fcec 100644
--- a/build-aux/qmi-codegen/Variable.py
+++ b/build-aux/qmi-codegen/Variable.py
@@ -44,6 +44,15 @@ class Variable:
"""
self.needs_dispose = False
+ self.endian = "QMI_ENDIAN_LITTLE"
+ if dictionary.has_key('endian'):
+ endian = dictionary['endian']
+ if endian == 'network' or endian == 'big':
+ self.endian = "QMI_ENDIAN_BIG"
+ elif endian == 'little':
+ pass
+ else:
+ raise ValueError("Invalid endian value %s" % endian)
"""
Emits the code to declare specific new types required by the variable.