Among the tons of fixes done here, we now generate some per-service .sections
file which we then concatenate to build the final libqmi-glib-sections.txt file.
Some architectures require that the value of a pointer is aligned in memory.
Given that we're reading from a raw buffer, the integers in it may not end up
aligned so we cannot safely cast any address to a valid 16/32/64 bit integer
value. Handle this by copying the integer from the raw buffer directly into the
output variable, which is of course properly aligned. Also added new test cases
to check this.
Thanks to:
Shawn J. Goff <shawnjgoff@gmail.com>
for reporting the issue and his endless tests.
Can be run e.g. like:
$> sudo qmicli -d /dev/cdc-wdm0 --dms-delete-stored-image="pri2"
The passed index is the one given by a previous `--dms-list-stored-images'
action. Please note that if you delete a given image, the listed indexes will
change, so if you want to delete multiple images you'll need to first list
stored images and grab the index and then use that bew index to delete the new
image.
Also, don't try this command many times or you'll run out of images to delete!
When an array is required to be passed in an input TLV, the user who created it
is responsible for freeing it. Therefore, we should not dump the static array
element clear function in these cases, or these unused methods will end up
breaking the compilation.
We make sure that every `QmiMessage' object out there is valid according to our
now internal message_check(). Therefore, it's pointless to run the validity
checks in getters, so remove those.
Passing a modifiable `GByteArray' allows us to run the validity check as soon as
we create the `QmiMessage', given that we can remove the read chunk of data from
the input buffer directly. This removal takes place both when the QMI message is
valid and invalid.
Also swapped length and buffer variables; it no longer follows the 'TLV' name
(type,length,value), but it's more consistent with other interfaces where
buffer is given first and then the length.
The contents of the input buffer are never modified when reading variables from
it, so better use a constant pointer in the methods doing it.
What it does change is the pointer to the current position in the constant
buffer.
The compiler doesn't know the type of literals and may try to fit it
into a slot that is too small. This adds suffixes to the long long and
unsigned long long literals.
The buffer must contain *at least* the initial 1-byte marker plus the length
reported by the QMUX header. The minimum size check was wrong for 2 bytes, which
could cause errors when trying to decode a message without all bytes.
Can easily be triggered using 1 for the BUFFER_SIZE in QmiDevice.
This mode is not just used for notiying a transition, it can also be used to
wake up the modem from an 'offline' state:
$ sudo qmicli -d /dev/cdc-wdm0 --dms-set-operating-mode=offline
[/dev/cdc-wdm0] Operating mode set successfully
$ sudo qmicli -d /dev/cdc-wdm0 --dms-get-operating-mode
[/dev/cdc-wdm0] Operating mode retrieved:
Mode: 'offline'
Reason: 'unknown'
HW restricted: 'no'
$ sudo qmicli -d /dev/cdc-wdm0 --dms-set-operating-mode=reset
[/dev/cdc-wdm0] Operating mode set successfully
$ sudo qmicli -d /dev/cdc-wdm0 --dms-get-operating-mode
[/dev/cdc-wdm0] Operating mode retrieved:
Mode: 'online'
HW restricted: 'no'
If we get an error parsing a JSON file we really want to have the exact line
number where the error happened, so don't just skip the comment lines and
substitute them with an empty line instead so that the line numbers don't
change.
For those variables which are containers of other variables (struct, sequence
and array), ensure we call `emit_helper_methods()' in order to generate variable
specific dispose() helpers and such.
This fixes the case of nested arrays of structs (arrays of structs with arrays of
structs whithin).
The build system sets up this variable for us, so use it rather than
hardcoding "pkg-config" which might be the wrong one.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Use the new 'size-prefix-format' property to specify whether the length prefix
variable is a 'guint8' or a 'guint16'.
We therefore consolidate the way how this length prefix variable is specified in
both arrays and strings.
So, instead of:
"length-prefix-size" : "16"
We now just do:
"size-prefix-format" : "guint16"
The 'array-size' property was used to define an implicit variable to be found at
the beginning of every array. This property expected a dictionary with one
single 'format' key.
Instead of this setup, create a new 'size-prefix-format' property which directly
expects the format string of the variable to be used as array-length indicator.
So, instead of:
"array-size" : { "format" : "guint16" }
We can now just use:
"size-prefix-format" : "guint16"
Also, remove the explicit size definitions when the format is "guint8", as that
is the default already when none specified and the array is not of fixed size.
The GPS module can give us already processed information in addition to the raw
NMEA traces, including GPS/UTC date, latitude/longitude, DOPs...
Add a TODO task to process these additional TLVs, which will require changes in
the codegen in order to handle single-precision and double-precision float
number reading.