aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2020-06-29 10:23:37 +0200
committerAleksander Morgado <aleksander@aleksander.es>2020-06-29 08:53:00 +0000
commit70b7218b7b303ba01f0be20ee14f1e4186884f79 (patch)
tree0f103259d6c7d19acbb55e2f8ecd435319720c60
parentaf8afcc6c9fd6eb6b88d43c88dee013d4a02c0cf (diff)
huawei: only flag GPS source as enabled if it was successful
-rw-r--r--plugins/huawei/mm-broadband-modem-huawei.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/plugins/huawei/mm-broadband-modem-huawei.c b/plugins/huawei/mm-broadband-modem-huawei.c
index cecfa6d4..023b58fa 100644
--- a/plugins/huawei/mm-broadband-modem-huawei.c
+++ b/plugins/huawei/mm-broadband-modem-huawei.c
@@ -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);
}