aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2019-05-28 22:56:54 +0200
committerAleksander Morgado <aleksander@aleksander.es>2019-05-28 22:56:54 +0200
commit7f822fbc50fa7acc2d9358f461e8a56882dd817e (patch)
treed46ffb1580d43556caae5e1d93b2681be8de5897
parentfd1a26fc36df005d66627109875631264d2f8e19 (diff)
xmm,shared: don't assume parent object implements location support
E.g. when MM is built without QMI support, the MBIM modem won't have any location support, as the only location implementation is based on QMI over MBIM. https://gitlab.freedesktop.org/mobile-broadband/ModemManager/issues/125
-rw-r--r--plugins/xmm/mm-shared-xmm.c37
1 files changed, 24 insertions, 13 deletions
diff --git a/plugins/xmm/mm-shared-xmm.c b/plugins/xmm/mm-shared-xmm.c
index 847884f8..d23a657f 100644
--- a/plugins/xmm/mm-shared-xmm.c
+++ b/plugins/xmm/mm-shared-xmm.c
@@ -871,6 +871,18 @@ xlcslsr_test_ready (MMBaseModem *self,
}
static void
+run_xlcslsr_test (GTask *task)
+{
+ mm_base_modem_at_command (
+ MM_BASE_MODEM (g_task_get_source_object (task)),
+ "+XLCSLSR=?",
+ 3,
+ TRUE, /* allow caching */
+ (GAsyncReadyCallback)xlcslsr_test_ready,
+ task);
+}
+
+static void
parent_load_capabilities_ready (MMIfaceModemLocation *self,
GAsyncResult *res,
GTask *task)
@@ -898,14 +910,7 @@ parent_load_capabilities_ready (MMIfaceModemLocation *self,
/* Cache sources supported by the parent */
g_task_set_task_data (task, GUINT_TO_POINTER (sources), NULL);
-
- mm_base_modem_at_command (
- MM_BASE_MODEM (g_task_get_source_object (task)),
- "+XLCSLSR=?",
- 3,
- TRUE, /* allow caching */
- (GAsyncReadyCallback)xlcslsr_test_ready,
- task);
+ run_xlcslsr_test (task);
}
void
@@ -920,8 +925,14 @@ mm_shared_xmm_location_load_capabilities (MMIfaceModemLocation *self,
task = g_task_new (self, NULL, callback, user_data);
g_assert (priv->iface_modem_location_parent);
- g_assert (priv->iface_modem_location_parent->load_capabilities);
- g_assert (priv->iface_modem_location_parent->load_capabilities_finish);
+
+ if (!priv->iface_modem_location_parent->load_capabilities ||
+ !priv->iface_modem_location_parent->load_capabilities_finish) {
+ /* no parent capabilities */
+ g_task_set_task_data (task, GUINT_TO_POINTER (MM_MODEM_LOCATION_SOURCE_NONE), NULL);
+ run_xlcslsr_test (task);
+ return;
+ }
priv->iface_modem_location_parent->load_capabilities (self,
(GAsyncReadyCallback)parent_load_capabilities_ready,
@@ -1375,12 +1386,12 @@ mm_shared_xmm_enable_location_gathering (MMIfaceModemLocation *self,
priv = get_private (MM_SHARED_XMM (self));
g_assert (priv->iface_modem_location_parent);
- g_assert (priv->iface_modem_location_parent->enable_location_gathering);
- g_assert (priv->iface_modem_location_parent->enable_location_gathering_finish);
/* Only consider request if it applies to one of the sources we are
* supporting, otherwise run parent enable */
- if (!(priv->supported_sources & source)) {
+ if (priv->iface_modem_location_parent->enable_location_gathering &&
+ priv->iface_modem_location_parent->enable_location_gathering_finish &&
+ !(priv->supported_sources & source)) {
priv->iface_modem_location_parent->enable_location_gathering (self,
source,
(GAsyncReadyCallback)parent_enable_location_gathering_ready,