aboutsummaryrefslogtreecommitdiff
path: root/src/mm-iface-modem-location.c
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2019-03-03 22:39:36 +0100
committerAleksander Morgado <aleksander@gnu.org>2019-04-02 08:40:26 +0000
commita0cb8b4dd56d4127f27854e5d58d9eccee5e2c8b (patch)
treefbd1bc298dea63400760700b71c8c20d929547a9 /src/mm-iface-modem-location.c
parent5bbcfa831818f12cba77679ca7bbe4d8ca0a5f7d (diff)
iface-modem-location: allow enabling unmanaged gps even if raw/nmea enabled
But only if the plugin implementation allows to do so.
Diffstat (limited to 'src/mm-iface-modem-location.c')
-rw-r--r--src/mm-iface-modem-location.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/src/mm-iface-modem-location.c b/src/mm-iface-modem-location.c
index 2ccb6434..2168140b 100644
--- a/src/mm-iface-modem-location.c
+++ b/src/mm-iface-modem-location.c
@@ -692,6 +692,7 @@ setup_gathering (MMIfaceModemLocation *self,
MMModemLocationSource currently_enabled;
MMModemLocationSource source;
gchar *str;
+ gboolean allow_gps_unmanaged_always = FALSE;
ctx = g_new (SetupGatheringContext, 1);
@@ -699,7 +700,8 @@ setup_gathering (MMIfaceModemLocation *self,
g_task_set_task_data (task, ctx, (GDestroyNotify)setup_gathering_context_free);
g_object_get (self,
- MM_IFACE_MODEM_LOCATION_DBUS_SKELETON, &ctx->skeleton,
+ MM_IFACE_MODEM_LOCATION_DBUS_SKELETON, &ctx->skeleton,
+ MM_IFACE_MODEM_LOCATION_ALLOW_GPS_UNMANAGED_ALWAYS, &allow_gps_unmanaged_always,
NULL);
if (!ctx->skeleton) {
g_task_return_new_error (task,
@@ -745,13 +747,16 @@ setup_gathering (MMIfaceModemLocation *self,
}
/* When standard GPS retrieval (RAW/NMEA) is enabled, we cannot enable the
- * UNMANAGED setup, and viceversa. */
- if ((ctx->to_enable & MM_MODEM_LOCATION_SOURCE_GPS_UNMANAGED &&
- currently_enabled & (MM_MODEM_LOCATION_SOURCE_GPS_RAW | MM_MODEM_LOCATION_SOURCE_GPS_NMEA)) ||
- (ctx->to_enable & (MM_MODEM_LOCATION_SOURCE_GPS_RAW | MM_MODEM_LOCATION_SOURCE_GPS_NMEA) &&
- currently_enabled & MM_MODEM_LOCATION_SOURCE_GPS_UNMANAGED) ||
- (ctx->to_enable & (MM_MODEM_LOCATION_SOURCE_GPS_RAW | MM_MODEM_LOCATION_SOURCE_GPS_NMEA) &&
- ctx->to_enable & MM_MODEM_LOCATION_SOURCE_GPS_UNMANAGED)) {
+ * UNMANAGED setup, and viceversa, unless explicitly allowed to do so by the
+ * plugin implementation (e.g. if the RAW/NMEA sources don't use the same TTY
+ * as the GPS UNMANAGED setup. */
+ if (!allow_gps_unmanaged_always &&
+ ((ctx->to_enable & MM_MODEM_LOCATION_SOURCE_GPS_UNMANAGED &&
+ currently_enabled & (MM_MODEM_LOCATION_SOURCE_GPS_RAW | MM_MODEM_LOCATION_SOURCE_GPS_NMEA)) ||
+ (ctx->to_enable & (MM_MODEM_LOCATION_SOURCE_GPS_RAW | MM_MODEM_LOCATION_SOURCE_GPS_NMEA) &&
+ currently_enabled & MM_MODEM_LOCATION_SOURCE_GPS_UNMANAGED) ||
+ (ctx->to_enable & (MM_MODEM_LOCATION_SOURCE_GPS_RAW | MM_MODEM_LOCATION_SOURCE_GPS_NMEA) &&
+ ctx->to_enable & MM_MODEM_LOCATION_SOURCE_GPS_UNMANAGED))) {
g_task_return_new_error (task,
MM_CORE_ERROR,
MM_CORE_ERROR_FAILED,
@@ -1887,6 +1892,14 @@ iface_modem_location_init (gpointer g_iface)
MM_GDBUS_TYPE_MODEM_LOCATION_SKELETON,
G_PARAM_READWRITE));
+ g_object_interface_install_property
+ (g_iface,
+ g_param_spec_boolean (MM_IFACE_MODEM_LOCATION_ALLOW_GPS_UNMANAGED_ALWAYS,
+ "Allow unmanaged GPS always",
+ "Whether to always allow GPS unmanaged, even when raw/nmea GPS sources are enabled",
+ FALSE,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+
initialized = TRUE;
}