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
This commit is contained in:
@@ -304,15 +304,26 @@ get_data_format_ready (QmiClientWda *client,
|
|||||||
{
|
{
|
||||||
PortOpenContext *ctx;
|
PortOpenContext *ctx;
|
||||||
QmiMessageWdaGetDataFormatOutput *output;
|
QmiMessageWdaGetDataFormatOutput *output;
|
||||||
|
g_autoptr(GError) error = NULL;
|
||||||
|
|
||||||
ctx = g_task_get_task_data (task);
|
ctx = g_task_get_task_data (task);
|
||||||
output = qmi_client_wda_get_data_format_finish (client, res, NULL);
|
output = qmi_client_wda_get_data_format_finish (client, res, NULL);
|
||||||
if (!output ||
|
if (!output ||
|
||||||
!qmi_message_wda_get_data_format_output_get_result (output, NULL) ||
|
!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))
|
!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 */
|
/* If loading WDA data format fails, fallback to 802.3 requested via CTL */
|
||||||
ctx->step = PORT_OPEN_STEP_CLOSE_BEFORE_OPEN_WITH_DATA_FORMAT;
|
ctx->step = PORT_OPEN_STEP_CLOSE_BEFORE_OPEN_WITH_DATA_FORMAT;
|
||||||
else
|
}
|
||||||
|
} else
|
||||||
/* Go on to next step */
|
/* Go on to next step */
|
||||||
ctx->step++;
|
ctx->step++;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user