xmm: prefer port flagged as AT_GPS_CONTROL to manage the GNSS engine

Use the new AT_GPS_CONTROL udev tag to decide which is the best port
to manage the GNSS engine.
This commit is contained in:
Aleksander Morgado
2022-02-09 15:42:53 +01:00
parent 343f27a5e7
commit f3e885e067

View File

@@ -1018,14 +1018,18 @@ gps_engine_start (GTask *task)
/* Look for an AT port to use for GPS. Prefer secondary port if there is one,
* otherwise use primary */
g_assert (!priv->gps_port);
priv->gps_port = mm_base_modem_get_port_secondary (MM_BASE_MODEM (self));
priv->gps_port = mm_base_modem_get_port_gps_control (MM_BASE_MODEM (self));
if (!priv->gps_port) {
priv->gps_port = mm_base_modem_get_port_primary (MM_BASE_MODEM (self));
priv->gps_port = mm_base_modem_get_port_secondary (MM_BASE_MODEM (self));
if (!priv->gps_port) {
g_task_return_new_error (task, MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
"No valid port found to control GPS");
g_object_unref (task);
return;
priv->gps_port = mm_base_modem_get_port_primary (MM_BASE_MODEM (self));
if (!priv->gps_port) {
g_task_return_new_error (task, MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
"No valid port found to control GPS");
g_object_unref (task);
return;
}
}
}