aboutsummaryrefslogtreecommitdiff
path: root/src/mm-port-qmi.c
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2020-01-24 12:27:07 +0100
committerAleksander Morgado <aleksander@aleksander.es>2020-02-01 12:52:30 +0100
commita8fd33ebaa80a0844c375fdb39173736d18f71cb (patch)
tree5af3cbde1f49b3df0d692ef78d907bf7b9745ca3 /src/mm-port-qmi.c
parent280363e0d639a77a4072f26b9ec499de6575c0f2 (diff)
port-qmi: fallback to raw-ip if WDA Get Data Format requests arguments
New devices return a "Missing Argument" error in WDA Get Data Format, requiring the use of the "Endpoint info" TLV. Given that all these new devices are raw-ip only anyway, let's use this error to right away fallback to require raw-ip in the interface. Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/issues/177
Diffstat (limited to 'src/mm-port-qmi.c')
-rw-r--r--src/mm-port-qmi.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/mm-port-qmi.c b/src/mm-port-qmi.c
index efaa3d15..75d3ee48 100644
--- a/src/mm-port-qmi.c
+++ b/src/mm-port-qmi.c
@@ -304,15 +304,26 @@ get_data_format_ready (QmiClientWda *client,
{
PortOpenContext *ctx;
QmiMessageWdaGetDataFormatOutput *output;
+ g_autoptr(GError) error = NULL;
ctx = g_task_get_task_data (task);
output = qmi_client_wda_get_data_format_finish (client, res, NULL);
if (!output ||
- !qmi_message_wda_get_data_format_output_get_result (output, NULL) ||
- !qmi_message_wda_get_data_format_output_get_link_layer_protocol (output, &ctx->llp, NULL))
- /* If loading WDA data format fails, fallback to 802.3 requested via CTL */
- ctx->step = PORT_OPEN_STEP_CLOSE_BEFORE_OPEN_WITH_DATA_FORMAT;
- else
+ !qmi_message_wda_get_data_format_output_get_result (output, &error) ||
+ !qmi_message_wda_get_data_format_output_get_link_layer_protocol (output, &ctx->llp, NULL)) {
+ /* A 'missing argument' error when querying data format is seen in new
+ * devices like the Quectel RM500Q, requiring the 'endpoint info' TLV.
+ * When this happens, assume the device supports only raw-ip and be done
+ * with it. */
+ if (error && g_error_matches (error, QMI_PROTOCOL_ERROR, QMI_PROTOCOL_ERROR_MISSING_ARGUMENT)) {
+ mm_dbg ("Querying data format failed: '%s', assuming raw-ip is only supported", error->message);
+ ctx->llp = QMI_WDA_LINK_LAYER_PROTOCOL_RAW_IP;
+ ctx->step++;
+ } else {
+ /* If loading WDA data format fails, fallback to 802.3 requested via CTL */
+ ctx->step = PORT_OPEN_STEP_CLOSE_BEFORE_OPEN_WITH_DATA_FORMAT;
+ }
+ } else
/* Go on to next step */
ctx->step++;