Age | Commit message (Collapse) | Author | Files | Lines |
|
We want to support non-standard messages that may be encoded with
different TLVs depending on how the vendor implemented them.
Anyway, right now this is really just to support the correct translation
of TLVs and message contents in the get_printable() methods.
The support is only included for QMI request/responses, and not for QMI
indications. This is because the library knows in which moment the
requests are created (and can apply the same rules to the matched
response when it is received). For the indications, though, there is no
such context configurable yet.
|
|
|
|
We want to mark some TLV fields as reserved and not exposed through the
public API due to alignment or other issues.
|
|
|
|
The @enum_name@_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@arcor.de>
|
|
Found by John.
https://bugs.freedesktop.org/show_bug.cgi?id=94083
|
|
For C++ compatibility, we should not generate variables with the names of
protected C++ keywords, like 'new'. Currently this was happening in the "DMS Set
Service Programming Code" method, where we had a TLV named "New". Instead of
renaming the TLV, which would change the name of the getter method as well, we
will force prepending the "value_" string to the variable names of the getter
and setter methods.
https://bugs.freedesktop.org/show_bug.cgi?id=91479
|
|
|
|
|
|
Commit b9c3701e337198 introduced an API break, where we would change a pointer
to a heap allocated string and instead use a fixed size char array. This commit
will instead recover the pointer to the string when used in a public struct, so
that API isn't broken w.r.t. previous stable libqmi versions.
The string is now properly allocated before reading and deallocated as part of
the struct deallocation.
|
|
If the fixed sized string contains no characters or is shorter than the explicit
size, NUL bytes will be included. If we try to append exactly the size of the
string, we'll end up with embedded NULs in our string to print, so the actual
output will be cut, even if the string is longer after the embedded NUL bytes.
E.g.:
>>>>>> TLV:
>>>>>> type = "GERAN Info" (0x10)
>>>>>> length = 61
>>>>>> value = 00:00:00:00:00:00:00:00:00:00:00:00:FF:FF:FF:FF:28:00:03:7D:6F:00:00:32:F4:51:B3:00:4D:00:11:2A:00:8A:3C:00:00:32:F4:51:B3:00:63:00:30:14:00:89:3C:00:00:32:F4:51:B3:00:59:00:11:0D:00
>>>>>> translated = [ cell_id = '0' plmn = '
With this fix, we avoid this by explicitly finishing ourselves the fixed sized
string with a NUL byte, and then adding the C string as the non-fixed sized
ones, i.e. until the first NUL byte is found.
E.g.:
>>>>>> TLV:
>>>>>> type = "GERAN Info" (0x10)
>>>>>> length = 61
>>>>>> value = 00:00:00:00:00:00:00:00:00:00:00:00:FF:FF:FF:FF:28:00:03:7D:6F:00:00:32:F4:51:B3:00:4D:00:11:2A:00:8A:3C:00:00:32:F4:51:B3:00:63:00:30:14:00:89:3C:00:00:32:F4:51:B3:00:59:00:11:0D:00
>>>>>> translated = [ cell_id = '0' plmn = '' lac = '0' geran_absolute_rf_channel_number = '0' base_station_identity_code = '0' timing_advance = '4294967295' rx_level = '40' cell = '{ [0] = '[ cell_id = '28541' plmn = '2\xf4Q' lac = '179' geran_absolute_rf_channel_number = '77' base_station_identity_code = '17' rx_level = '42' ] ' [1] = '[ cell_id = '15498' plmn = '2\xf4Q' lac = '179' geran_absolute_rf_channel_number = '99' base_station_identity_code = '48' rx_level = '20' ] ' [2] = '[ cell_id = '15497' plmn = '2\xf4Q' lac = '179' geran_absolute_rf_channel_number = '89' base_station_identity_code = '17' rx_level = '13' ] '}' ]
|
|
This change triggers an API break.
When building structs to be included in the public header, we were just relying
on using the 'public_format' of each variable. This is an error, as the variable
may be more complex than just public/private. E.g. could be another struct, or
an array, or a fixed sized string, as in the example.
In particular, this bug currently affects one public type, where one of its
elements changes from being just a pointer to a string to a fixed sized array of
4 bytes.
The following type is changed from:
typedef struct _QmiMessageNasGetCellLocationInfoOutputGeranInfoCellElement {
guint32 cell_id;
gchar * plmn;
guint16 lac;
guint16 geran_absolute_rf_channel_number;
guint8 base_station_identity_code;
guint16 rx_level;
} QmiMessageNasGetCellLocationInfoOutputGeranInfoCellElement;
To:
typedef struct _QmiMessageNasGetCellLocationInfoOutputGeranInfoCellElement {
guint32 cell_id;
gchar plmn[4];
guint16 lac;
guint16 geran_absolute_rf_channel_number;
guint8 base_station_identity_code;
guint16 rx_level;
} QmiMessageNasGetCellLocationInfoOutputGeranInfoCellElement;
Thanks to Joseba Sanjuan <joseba.sanjuan@gmail.com> for finding the bug.
|
|
In the optional TLV case, 'tlv_error' was never set to TRUE
when the optional TLV was missing, because the return value of
qmi_message_tlv_read_init() was ignored. This caused
"self->arg_*_set" to always be TRUE and NULL strings to be
returned to callers requesting the TLV value later.
Also prevent incorrect "Left X bytes unread when getting..."
messages caused when the TLV is missing.
This bug was found when probing a modem that does not return
an MEID TLV to DMSGetIds (because it is GSM/UMTS/LTE only),
but qmi_message_dms_get_ids_output_get_meid() returned TRUE
and a NULL 'str':
if (qmi_message_dms_get_ids_output_get_meid (output, &str, NULL) &&
--> str[0] != '\0' && str[0] != '0') {
Bug introduced in b143b7f6 (qmi-codegen: use the new TLV reader API).
Before:
=======
gsize offset = 0;
gsize init_offset;
gboolean tlv_error = FALSE;
init_offset = qmi_message_tlv_read_init (message, QMI_INDICATION_DMS_EVENT_REPORT_OUTPUT_TLV_POWER_STATE, NULL, NULL);
<<<snip>>>
/* The remaining size of the buffer needs to be 0 if we successfully read the TLV */
if ((offset = __qmi_message_tlv_read_remaining_size (message, init_offset, offset)) > 0) {
g_warning ("Left '%" G_GSIZE_FORMAT "' bytes unread when getting the 'Power State' TLV", offset);
}
qmi_indication_dms_event_report_output_power_state_out:
if (!tlv_error)
self->arg_power_state_set = TRUE;
After:
======
gsize offset = 0;
gsize init_offset;
if ((init_offset = qmi_message_tlv_read_init (message, QMI_INDICATION_DMS_EVENT_REPORT_OUTPUT_TLV_POWER_STATE, NULL, NULL)) == 0) {
goto qmi_indication_dms_event_report_output_power_state_out;
}
<<<snip>>>
/* The remaining size of the buffer needs to be 0 if we successfully read the TLV */
if ((offset = __qmi_message_tlv_read_remaining_size (message, init_offset, offset)) > 0) {
g_warning ("Left '%" G_GSIZE_FORMAT "' bytes unread when getting the 'Power State' TLV", offset);
}
self->arg_power_state_set = TRUE;
qmi_indication_dms_event_report_output_power_state_out:
;
|
|
|
|
|
|
Suggested by Thomas Haller <thaller@redhat.com>.
|
|
Suggested by Thomas Haller <thaller@redhat.com>.
|
|
https://bugzilla.redhat.com/show_bug.cgi?id=1031738
Reported-by: Florian Weimer <fweimer@redhat.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
|
|
Code generation via emit_size_read() creates the _validate() functions.
The generated code for strings and arrays used to read the length prefix
without checking that the provided buffer is large enough.
https://bugzilla.redhat.com/show_bug.cgi?id=1031738
Patch based on a patch from Thomas Haller <thaller@redhat.com>
Reported-by: Florian Weimer <fweimer@redhat.com>
|
|
|
|
|
|
... not the other way around.
|
|
|
|
Also implement "Reset" and "Read Record" request/response.
|
|
TLVs are really limited in size, so if you want to have truly long data passed
between host and modem, you may end up needing multiple QMI messages where the
long TLV is split in segments. Currently support this by handling a built-in
sequence number expected to be found between the array size prefix and the array
itself (see e.g. TLV 0x13 (PRL) in 'DMS Activate Manual'). This sequence number
can be enabled with the new 'sequence-prefix-format' keyword in the array
definition.
|
|
Only 'Indication Register' message for now.
|
|
Reported by Arman Uguray <armansito@google.com>
|
|
These caused problems for deb packaging, as their content depends on the Python
version used.
|
|
The string.lower(str) class method is no longer available.
sed regex:
s/string\.lower(\(.*\))/\1.lower()/
|
|
Python 3 no longer supports the has_key() method.
sed regex:
s/\([^ ]\+\)\.has_key(\([^)]*\))/\2 in \1/g
|
|
str.replace() instance method
Python 3 doesn't support the replace class method; it's now an instance method only.
string.replace(object, old, new) changes to object.replace(old, new)
sed:
s/string\.replace(\([^,]*\), /\1.replace(/
|
|
Simple methods are no longer in the string module.
|
|
|
|
|
|
Try to handle buggy firmware, or just make the library more robust, by
validating the read TLV before really reading it. If a TLV is not considered
valid, we just skip it for now.
E.g.: the "Detailed Service Status" TLV (0x21) in the "NAS Get Serving System"
message is supposed to be a sequence of 5 bytes, but some models (e.g. ZTE MF683)
end up sending only the first 4 bytes.
|
|
|
|
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.
|
|
We allow passing a GCancellable to every async operation with the clients. Now,
if the cancellable gets cancelled and the operation can be ABORT-ed, then we
do it.
|
|
Messages can now be tagged with a special 'abort' keyword, so that whenever the
message times out we issue a new ABORT command to cancel the specific timed out
request.
This support is currently only available for the NAS and WDS services, which are
the ones supporting ABORT for their long-running operations.
|
|
|
|
These methods are (should only be) used only by the library.
|
|
|
|
|
|
|
|
|
|
|
|
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.
|
|
|
|
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.
|
|
|