summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2018-06-27 17:35:31 +0200
committerAleksander Morgado <aleksander@aleksander.es>2018-08-10 15:11:45 +0200
commitb390c5389aa8ffbca20da190ae56edb3c780a651 (patch)
tree6439bb37fb3c1a5cb29d940d4a16ebb5450dfc28
parent106db4cff70f536c63a5df9cac1a7050446ad07f (diff)
downloadModemManager-b390c5389aa8ffbca20da190ae56edb3c780a651.tar.gz
broadband-modem-mbim: support for QMI PDS based GPS location
-rw-r--r--src/mm-broadband-modem-mbim.c90
1 files changed, 60 insertions, 30 deletions
diff --git a/src/mm-broadband-modem-mbim.c b/src/mm-broadband-modem-mbim.c
index 4731ac6e3..79558b622 100644
--- a/src/mm-broadband-modem-mbim.c
+++ b/src/mm-broadband-modem-mbim.c
@@ -40,8 +40,9 @@
#include "mm-iface-modem-signal.h"
#include "mm-sms-part-3gpp.h"
-#if defined WITH_QMI
+#if defined WITH_QMI && QMI_MBIM_QMUX_SUPPORTED
# include <libqmi-glib.h>
+# include "mm-shared-qmi.h"
#endif
static void iface_modem_init (MMIfaceModem *iface);
@@ -49,6 +50,9 @@ static void iface_modem_3gpp_init (MMIfaceModem3gpp *iface);
static void iface_modem_location_init (MMIfaceModemLocation *iface);
static void iface_modem_messaging_init (MMIfaceModemMessaging *iface);
static void iface_modem_signal_init (MMIfaceModemSignal *iface);
+#if defined WITH_QMI && QMI_MBIM_QMUX_SUPPORTED
+static void shared_qmi_init (MMSharedQmi *iface);
+#endif
static MMIfaceModemSignal *iface_modem_signal_parent;
@@ -57,7 +61,11 @@ G_DEFINE_TYPE_EXTENDED (MMBroadbandModemMbim, mm_broadband_modem_mbim, MM_TYPE_B
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_3GPP, iface_modem_3gpp_init)
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_LOCATION, iface_modem_location_init)
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_MESSAGING, iface_modem_messaging_init)
- G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_SIGNAL, iface_modem_signal_init))
+ G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_SIGNAL, iface_modem_signal_init)
+#if defined WITH_QMI && QMI_MBIM_QMUX_SUPPORTED
+ G_IMPLEMENT_INTERFACE (MM_TYPE_SHARED_QMI, shared_qmi_init)
+#endif
+)
typedef enum {
PROCESS_NOTIFICATION_FLAG_NONE = 0,
@@ -133,31 +141,35 @@ peek_device (gpointer self,
#if defined WITH_QMI && QMI_MBIM_QMUX_SUPPORTED
-static gboolean
-peek_device_full (gpointer self,
- MbimDevice **o_device,
- QmiClient **o_dms,
- GAsyncReadyCallback callback,
- gpointer user_data)
+static QmiClient *
+shared_qmi_peek_client (MMSharedQmi *self,
+ QmiService service,
+ MMPortQmiFlag flag,
+ GError **error)
{
MMPortMbim *port;
+ QmiClient *client;
+
+ g_assert (flag == MM_PORT_QMI_FLAG_DEFAULT);
port = mm_base_modem_peek_port_mbim (MM_BASE_MODEM (self));
if (!port) {
- g_task_report_new_error (self,
- callback,
- user_data,
- peek_device,
- MM_CORE_ERROR,
- MM_CORE_ERROR_FAILED,
- "Couldn't peek MBIM port");
- return FALSE;
+ g_set_error (error,
+ MM_CORE_ERROR,
+ MM_CORE_ERROR_FAILED,
+ "Couldn't peek MBIM port");
+ return NULL;
}
- *o_device = mm_port_mbim_peek_device (port);
- if (o_dms)
- *o_dms = mm_port_mbim_peek_qmi_client (port, QMI_SERVICE_DMS);
- return TRUE;
+ client = mm_port_mbim_peek_qmi_client (port, service);
+ if (!client)
+ g_set_error (error,
+ MM_CORE_ERROR,
+ MM_CORE_ERROR_FAILED,
+ "Couldn't peek client for service '%s'",
+ qmi_service_get_string (service));
+
+ return client;
}
#endif
@@ -1231,22 +1243,20 @@ modem_power_up (MMIfaceModem *self,
MbimDevice *device;
GTask *task;
-#if defined WITH_QMI && QMI_MBIM_QMUX_SUPPORTED
- QmiClient *qmi_client_dms;
-
- if (!peek_device_full (self, &device, &qmi_client_dms, callback, user_data))
- return;
-#else
- if (!peek_device (self, &device, NULL, callback, user_data))
+ if (!peek_device (self, &device, callback, user_data))
return;
-#endif
ctx = g_slice_new0 (PowerUpContext);
ctx->device = g_object_ref (device);
ctx->step = POWER_UP_CONTEXT_STEP_FIRST;
#if defined WITH_QMI && QMI_MBIM_QMUX_SUPPORTED
- ctx->qmi_client_dms = g_object_ref (qmi_client_dms);
+ ctx->qmi_client_dms = mm_shared_qmi_peek_client (MM_SHARED_QMI (self),
+ QMI_SERVICE_DMS,
+ MM_PORT_QMI_FLAG_DEFAULT,
+ NULL);
+ if (ctx->qmi_client_dms)
+ g_object_ref (ctx->qmi_client_dms);
#endif
task = g_task_new (self, NULL, callback, user_data);
@@ -1868,7 +1878,8 @@ initialization_started (MMBroadbandModem *self,
#if WITH_QMI && QMI_MBIM_QMUX_SUPPORTED
/* Setup services to open */
ctx->qmi_services[0] = QMI_SERVICE_DMS;
- ctx->qmi_services[1] = QMI_SERVICE_UNKNOWN;
+ ctx->qmi_services[1] = QMI_SERVICE_PDS;
+ ctx->qmi_services[2] = QMI_SERVICE_UNKNOWN;
#endif
/* Now open our MBIM port */
@@ -3917,10 +3928,23 @@ iface_modem_3gpp_init (MMIfaceModem3gpp *iface)
static void
iface_modem_location_init (MMIfaceModemLocation *iface)
{
+#if defined WITH_QMI && QMI_MBIM_QMUX_SUPPORTED
+ iface->load_capabilities = mm_shared_qmi_location_load_capabilities;
+ iface->load_capabilities_finish = mm_shared_qmi_location_load_capabilities_finish;
+ iface->enable_location_gathering = mm_shared_qmi_enable_location_gathering;
+ iface->enable_location_gathering_finish = mm_shared_qmi_enable_location_gathering_finish;
+ iface->disable_location_gathering = mm_shared_qmi_disable_location_gathering;
+ iface->disable_location_gathering_finish = mm_shared_qmi_disable_location_gathering_finish;
+ iface->load_supl_server = mm_shared_qmi_location_load_supl_server;
+ iface->load_supl_server_finish = mm_shared_qmi_location_load_supl_server_finish;
+ iface->set_supl_server = mm_shared_qmi_location_set_supl_server;
+ iface->set_supl_server_finish = mm_shared_qmi_location_set_supl_server_finish;
+#else
iface->load_capabilities = NULL;
iface->load_capabilities_finish = NULL;
iface->enable_location_gathering = NULL;
iface->enable_location_gathering_finish = NULL;
+#endif
}
static void
@@ -3959,6 +3983,12 @@ iface_modem_signal_init (MMIfaceModemSignal *iface)
}
static void
+shared_qmi_init (MMSharedQmi *iface)
+{
+ iface->peek_client = shared_qmi_peek_client;
+}
+
+static void
mm_broadband_modem_mbim_class_init (MMBroadbandModemMbimClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);