huawei: only flag GPS source as enabled if it was successful

This commit is contained in:
Aleksander Morgado
2020-06-29 08:53:00 +00:00
parent af8afcc6c9
commit 70b7218b7b
+14 -8
View File
@@ -3960,14 +3960,15 @@ enable_location_gathering_finish (MMIfaceModemLocation *self,
}
static void
gps_startup_ready (MMBaseModem *self,
gps_startup_ready (MMBaseModem *_self,
GAsyncResult *res,
GTask *task)
{
MMModemLocationSource source;
GError *error = NULL;
MMBroadbandModemHuawei *self = MM_BROADBAND_MODEM_HUAWEI (_self);
MMModemLocationSource source;
GError *error = NULL;
mm_base_modem_at_sequence_finish (self, res, NULL, &error);
mm_base_modem_at_sequence_finish (_self, res, NULL, &error);
if (error) {
g_task_return_error (task, error);
g_object_unref (task);
@@ -3989,10 +3990,16 @@ gps_startup_ready (MMBaseModem *self,
MM_CORE_ERROR,
MM_CORE_ERROR_FAILED,
"Couldn't open raw GPS serial port");
} else
} else {
/* GPS port was successfully opened */
self->priv->enabled_sources |= source;
g_task_return_boolean (task, TRUE);
} else
}
} else {
/* No need to open GPS port */
self->priv->enabled_sources |= source;
g_task_return_boolean (task, TRUE);
}
g_object_unref (task);
}
@@ -4025,8 +4032,6 @@ parent_enable_location_gathering_ready (MMIfaceModemLocation *_self,
MM_MODEM_LOCATION_SOURCE_GPS_RAW |
MM_MODEM_LOCATION_SOURCE_GPS_UNMANAGED)));
self->priv->enabled_sources |= source;
if (start_gps) {
mm_base_modem_at_sequence (
MM_BASE_MODEM (self),
@@ -4039,6 +4044,7 @@ parent_enable_location_gathering_ready (MMIfaceModemLocation *_self,
}
/* For any other location (e.g. 3GPP), or if GPS already running just return */
self->priv->enabled_sources |= source;
g_task_return_boolean (task, TRUE);
g_object_unref (task);
}