All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Tony Lindgren <tony@atomide.com>
Cc: Dan Williams <dcbw@redhat.com>,
	Merlijn Wajer <merlijn@wizzup.org>,
	Sebastian Reichel <sebastian.reichel@collabora.co.uk>,
	Mark Brown <broonie@kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Rob Herring <robh+dt@kernel.org>,
	Lee Jones <lee.jones@linaro.org>,
	Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	alsa-devel@alsa-project.org, linux-omap@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel@collabora.com
Subject: Re: simultaneous voice/data works (was Re: call/normal switch was Re: omap4-droid4: voice call support was)
Date: Tue, 10 Apr 2018 12:58:40 +0200	[thread overview]
Message-ID: <20180410105840.GA13697@amd> (raw)
In-Reply-To: <20180409140847.GP5700@atomide.com>

[-- Attachment #1: Type: text/plain, Size: 14650 bytes --]

On Mon 2018-04-09 07:08:47, Tony Lindgren wrote:
> * Dan Williams <dcbw@redhat.com> [180408 02:46]:
> > On Sat, 2018-04-07 at 14:22 +0200, Pavel Machek wrote:
> > > I tried --location-enable-gps-unmanaged , but that did not work for
> > > me.
> > 
> > That requires a TTY that would spit out the GPS data; in this mode MM
> > only sends the start/stop commands, and what comes out the GPS TTY is
> > undefined (at least by MM).
> > 
> > So unless you know that one of the 6600's TTYs does GPS and in what
> > format it does GPS, then no.
> 
> There should be a NMEA port within the unknown port range ttyUSB[123].
> 
> Is there some easy way to enable --location-enable-gps-unmanaged for
> testing so I can check if GPS gets enabled for one of the ports?

This should be userful for testing:

Just pass --pds-start-gps and you should get NMEA on stdout.

Cleanup does _not_ work properly, so it will fail if you run it too
many times.

								Pavel

diff --git a/src/qmicli/Makefile.am b/src/qmicli/Makefile.am
index eb63fa7..2c5e935 100644
--- a/src/qmicli/Makefile.am
+++ b/src/qmicli/Makefile.am
@@ -42,6 +42,7 @@ qmicli_SOURCES = \
 	qmicli-pdc.c \
 	qmicli-uim.c \
 	qmicli-wms.c \
+	qmicli-pds.c \
 	qmicli-wda.c \
 	qmicli-voice.c \
 	qmicli-charsets.c \
diff --git a/src/qmicli/qmicli-loc.c b/src/qmicli/qmicli-loc.c
new file mode 100644
index 0000000..e69de29
diff --git a/src/qmicli/qmicli-pds.c b/src/qmicli/qmicli-pds.c
new file mode 100644
index 0000000..f21ba2e
--- /dev/null
+++ b/src/qmicli/qmicli-pds.c
@@ -0,0 +1,315 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * qmicli -- Command line interface to control QMI devices
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Copyright (C) 2015-2017 Aleksander Morgado <aleksander@aleksander.es>
+ */
+
+#include "config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <locale.h>
+#include <string.h>
+
+#include <glib.h>
+#include <gio/gio.h>
+
+#include <libqmi-glib.h>
+
+#include "qmicli.h"
+#include "qmicli-helpers.h"
+
+/* Context */
+typedef struct {
+    QmiDevice *device;
+    QmiClientPds *client;
+    GCancellable *cancellable;
+} Context;
+static Context *ctx;
+
+/* Options */
+static gboolean get_supported_messages_flag;
+static gboolean reset_flag;
+static gboolean noop_flag;
+static gboolean start_flag;
+
+static GOptionEntry entries[] = {
+    { "pds-start-gps", 0, 0, G_OPTION_ARG_NONE, &start_flag,
+      "Start gps",
+      NULL
+    },
+
+    { NULL }
+};
+
+GOptionGroup *
+qmicli_pds_get_option_group (void)
+{
+	GOptionGroup *group;
+
+	group = g_option_group_new ("pds",
+	                            "PDS options",
+	                            "Show Wireless Messaging Service options",
+	                            NULL,
+	                            NULL);
+	g_option_group_add_entries (group, entries);
+
+	return group;
+}
+
+gboolean
+qmicli_pds_options_enabled (void)
+{
+    static guint n_actions = 0;
+    static gboolean checked = FALSE;
+
+    if (checked)
+        return !!n_actions;
+
+    n_actions = (get_supported_messages_flag +
+                 reset_flag +
+                 noop_flag +
+                 start_flag);
+
+    if (n_actions > 1) {
+        g_printerr ("error: too many PDS actions requested\n");
+        exit (EXIT_FAILURE);
+    }
+
+    checked = TRUE;
+    return !!n_actions;
+}
+
+#if 0
+static void
+context_free (Context *context)
+{
+    if (!context)
+        return;
+
+    if (context->client)
+        g_object_unref (context->client);
+    g_object_unref (context->cancellable);
+    g_object_unref (context->device);
+    g_slice_free (Context, context);
+}
+
+static void
+operation_shutdown (gboolean operation_status)
+{
+    /* Cleanup context and finish async operation */
+    context_free (ctx);
+    qmicli_async_operation_done (operation_status, FALSE);
+}
+#endif
+
+static void
+ser_location_ready (QmiClientPds *client,
+                    GAsyncResult *res,
+                    GTask *task);
+
+static void
+location_event_report_indication_cb (QmiClientPds *client,
+                                     QmiIndicationPdsEventReportOutput *output,
+                                     void *self)
+{
+    QmiPdsPositionSessionStatus session_status;
+    const gchar *nmea;
+
+    if (qmi_indication_pds_event_report_output_get_position_session_status (
+                                                                            output,
+                                                                            &session_status,
+                                                                            NULL)) {
+        printf ("[GPS] session status changed: '%s'",
+                qmi_pds_position_session_status_get_string (session_status));
+    }
+
+    if (qmi_indication_pds_event_report_output_get_nmea_position (
+                                                                  output,
+                                                                  &nmea,
+                                                                  NULL)) {
+        printf ("%s", nmea);
+    }
+}
+
+static void
+gather_nmea(GTask *task)
+{
+    QmiMessagePdsSetEventReportInput *input;
+    
+    /* Only gather standard NMEA traces */
+    input = qmi_message_pds_set_event_report_input_new ();
+    qmi_message_pds_set_event_report_input_set_nmea_position_reporting (input, TRUE, NULL);
+    qmi_client_pds_set_event_report (
+                                     ctx->client,
+                                     input,
+                                     5,
+                                     NULL,
+                                     (GAsyncReadyCallback)ser_location_ready,
+                                     task);
+    qmi_message_pds_set_event_report_input_unref (input);
+
+}
+
+static void
+ser_location_ready (QmiClientPds *client,
+                    GAsyncResult *res,
+                    GTask *task)
+{
+    QmiMessagePdsSetEventReportOutput *output = NULL;
+    GError *error = NULL;
+
+    output = qmi_client_pds_set_event_report_finish (client, res, &error);
+    if (!output) {
+        g_prefix_error (&error, "QMI operation failed: ");
+        g_task_return_error (task, error);
+        g_object_unref (task);
+        return;
+    }
+
+    if (!qmi_message_pds_set_event_report_output_get_result (output, &error)) {
+        g_prefix_error (&error, "Couldn't set event report: ");
+        g_task_return_error (task, error);
+        g_object_unref (task);
+        qmi_message_pds_set_event_report_output_unref (output);
+        return;
+    }
+
+    qmi_message_pds_set_event_report_output_unref (output);
+
+    g_signal_connect (client,
+                      "event-report",
+                      G_CALLBACK (location_event_report_indication_cb),
+                      NULL);
+}
+
+static void
+auto_tracking_state_start_ready (QmiClientPds *client,
+                                 GAsyncResult *res,
+                                 GTask *task)
+{
+    QmiMessagePdsSetAutoTrackingStateOutput *output = NULL;
+    GError *error = NULL;
+
+    output = qmi_client_pds_set_auto_tracking_state_finish (client, res, &error);
+    if (!output) {
+        g_prefix_error (&error, "QMI operation failed: ");
+        g_task_return_error (task, error);
+        g_object_unref (task);
+        return;
+    }
+
+    if (!qmi_message_pds_set_auto_tracking_state_output_get_result (output, &error)) {
+        if (!g_error_matches (error,
+                              QMI_PROTOCOL_ERROR,
+                              QMI_PROTOCOL_ERROR_NO_EFFECT)) {
+            g_prefix_error (&error, "Couldn't set auto-tracking state: ");
+            g_task_return_error (task, error);
+            g_object_unref (task);
+            qmi_message_pds_set_auto_tracking_state_output_unref (output);
+            return;
+        }
+        g_error_free (error);
+        printf("no matches: was already enabled?\n");
+    }
+    qmi_message_pds_set_auto_tracking_state_output_unref (output);
+    gather_nmea(task);
+}
+
+
+static void
+gps_service_state_start_ready (QmiClientPds *client,
+                               GAsyncResult *res,
+                               GTask *task)
+{
+    QmiMessagePdsSetAutoTrackingStateInput *input;
+    QmiMessagePdsSetGpsServiceStateOutput *output = NULL;
+    GError *error = NULL;
+
+    output = qmi_client_pds_set_gps_service_state_finish (client, res, &error);
+    if (!output) {
+        g_prefix_error (&error, "QMI operation failed: ");
+        g_task_return_error (task, error);
+        g_object_unref (task);
+        return;
+    }
+
+    if (!qmi_message_pds_set_gps_service_state_output_get_result (output, &error)) {
+        if (!g_error_matches (error,
+                              QMI_PROTOCOL_ERROR,
+                              QMI_PROTOCOL_ERROR_NO_EFFECT)) {
+            g_prefix_error (&error, "Couldn't set GPS service state: ");
+            g_task_return_error (task, error);
+            g_object_unref (task);
+            qmi_message_pds_set_gps_service_state_output_unref (output);
+            return;
+        }
+        g_error_free (error);
+    }
+    qmi_message_pds_set_gps_service_state_output_unref (output);
+
+    /* Enable auto-tracking for a continuous fix */
+    input = qmi_message_pds_set_auto_tracking_state_input_new ();
+    qmi_message_pds_set_auto_tracking_state_input_set_state (input, TRUE, NULL);
+    qmi_client_pds_set_auto_tracking_state (
+                                            ctx->client,
+                                            input,
+                                            10,
+                                            NULL, /* cancellable */
+                                            (GAsyncReadyCallback)auto_tracking_state_start_ready,
+                                            task);
+    qmi_message_pds_set_auto_tracking_state_input_unref (input);
+}
+
+
+void
+qmicli_pds_run (QmiDevice *device,
+                QmiClientPds *client,
+                GCancellable *cancellable)
+{
+    /* Initialize context */
+    ctx = g_slice_new (Context);
+    ctx->device = g_object_ref (device);
+    ctx->client = g_object_ref (client);
+    ctx->cancellable = g_object_ref (cancellable);
+
+    if (start_flag) {
+        QmiMessagePdsSetGpsServiceStateInput *input;
+
+        input = qmi_message_pds_set_gps_service_state_input_new ();
+        qmi_message_pds_set_gps_service_state_input_set_state (input, TRUE, NULL);
+        qmi_client_pds_set_gps_service_state (
+                                              ctx->client,
+                                              input,
+                                              10,
+                                              NULL, /* cancellable */
+                                              (GAsyncReadyCallback)gps_service_state_start_ready,
+                                              ctx);
+        qmi_message_pds_set_gps_service_state_input_unref (input);
+        printf("GPS started?\n");
+        return;
+    }
+
+    if (1) { // run_flag)
+        g_signal_connect (client,
+                          "event-report",
+                          G_CALLBACK (location_event_report_indication_cb),
+                          NULL);
+    }
+
+    g_warn_if_reached ();
+}
diff --git a/src/qmicli/qmicli.c b/src/qmicli/qmicli.c
index fecae8d..32d1052 100644
--- a/src/qmicli/qmicli.c
+++ b/src/qmicli/qmicli.c
@@ -366,6 +366,9 @@ allocate_client_ready (QmiDevice *dev,
     case QMI_SERVICE_WMS:
         qmicli_wms_run (dev, QMI_CLIENT_WMS (client), cancellable);
         return;
+    case QMI_SERVICE_PDS:
+        qmicli_pds_run (dev, QMI_CLIENT_PDS (client), cancellable);
+        return;
     case QMI_SERVICE_WDA:
         qmicli_wda_run (dev, QMI_CLIENT_WDA (client), cancellable);
         return;
@@ -719,6 +722,12 @@ parse_actions (void)
         actions_enabled++;
     }
 
+    /* PDS options? */
+    if (qmicli_pds_options_enabled ()) {
+        service = QMI_SERVICE_PDS;
+        actions_enabled++;
+    }
+
     /* WDA options? */
     if (qmicli_wda_options_enabled ()) {
         service = QMI_SERVICE_WDA;
@@ -769,6 +778,8 @@ int main (int argc, char **argv)
     g_option_context_add_group (context,
                                 qmicli_uim_get_option_group ());
     g_option_context_add_group (context,
+                                qmicli_pds_get_option_group ());
+    g_option_context_add_group (context,
                                 qmicli_wms_get_option_group ());
     g_option_context_add_group (context,
                                 qmicli_wda_get_option_group ());
diff --git a/src/qmicli/qmicli.h b/src/qmicli/qmicli.h
index 7db7905..0986b66 100644
--- a/src/qmicli/qmicli.h
+++ b/src/qmicli/qmicli.h
@@ -69,6 +69,14 @@ void          qmicli_uim_run              (QmiDevice *device,
                                            QmiClientUim *client,
                                            GCancellable *cancellable);
 
+
+/* PDS group */
+GOptionGroup *qmicli_pds_get_option_group (void);
+gboolean      qmicli_pds_options_enabled  (void);
+void          qmicli_pds_run              (QmiDevice *device,
+                                           QmiClientPds *client,
+                                           GCancellable *cancellable);
+
 /* WMS group */
 GOptionGroup *qmicli_wms_get_option_group (void);
 gboolean      qmicli_wms_options_enabled  (void);

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Pavel Machek <pavel@ucw.cz>
To: Tony Lindgren <tony@atomide.com>
Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org,
	kernel@collabora.com, Dan Williams <dcbw@redhat.com>,
	linux-kernel@vger.kernel.org, Merlijn Wajer <merlijn@wizzup.org>,
	Takashi Iwai <tiwai@suse.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Rob Herring <robh+dt@kernel.org>, Mark Brown <broonie@kernel.org>,
	Sebastian Reichel <sebastian.reichel@collabora.co.uk>,
	linux-omap@vger.kernel.org, Lee Jones <lee.jones@linaro.org>
Subject: Re: simultaneous voice/data works (was Re: call/normal switch was Re: omap4-droid4: voice call support was)
Date: Tue, 10 Apr 2018 12:58:40 +0200	[thread overview]
Message-ID: <20180410105840.GA13697@amd> (raw)
In-Reply-To: <20180409140847.GP5700@atomide.com>


[-- Attachment #1.1: Type: text/plain, Size: 14650 bytes --]

On Mon 2018-04-09 07:08:47, Tony Lindgren wrote:
> * Dan Williams <dcbw@redhat.com> [180408 02:46]:
> > On Sat, 2018-04-07 at 14:22 +0200, Pavel Machek wrote:
> > > I tried --location-enable-gps-unmanaged , but that did not work for
> > > me.
> > 
> > That requires a TTY that would spit out the GPS data; in this mode MM
> > only sends the start/stop commands, and what comes out the GPS TTY is
> > undefined (at least by MM).
> > 
> > So unless you know that one of the 6600's TTYs does GPS and in what
> > format it does GPS, then no.
> 
> There should be a NMEA port within the unknown port range ttyUSB[123].
> 
> Is there some easy way to enable --location-enable-gps-unmanaged for
> testing so I can check if GPS gets enabled for one of the ports?

This should be userful for testing:

Just pass --pds-start-gps and you should get NMEA on stdout.

Cleanup does _not_ work properly, so it will fail if you run it too
many times.

								Pavel

diff --git a/src/qmicli/Makefile.am b/src/qmicli/Makefile.am
index eb63fa7..2c5e935 100644
--- a/src/qmicli/Makefile.am
+++ b/src/qmicli/Makefile.am
@@ -42,6 +42,7 @@ qmicli_SOURCES = \
 	qmicli-pdc.c \
 	qmicli-uim.c \
 	qmicli-wms.c \
+	qmicli-pds.c \
 	qmicli-wda.c \
 	qmicli-voice.c \
 	qmicli-charsets.c \
diff --git a/src/qmicli/qmicli-loc.c b/src/qmicli/qmicli-loc.c
new file mode 100644
index 0000000..e69de29
diff --git a/src/qmicli/qmicli-pds.c b/src/qmicli/qmicli-pds.c
new file mode 100644
index 0000000..f21ba2e
--- /dev/null
+++ b/src/qmicli/qmicli-pds.c
@@ -0,0 +1,315 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * qmicli -- Command line interface to control QMI devices
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Copyright (C) 2015-2017 Aleksander Morgado <aleksander@aleksander.es>
+ */
+
+#include "config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <locale.h>
+#include <string.h>
+
+#include <glib.h>
+#include <gio/gio.h>
+
+#include <libqmi-glib.h>
+
+#include "qmicli.h"
+#include "qmicli-helpers.h"
+
+/* Context */
+typedef struct {
+    QmiDevice *device;
+    QmiClientPds *client;
+    GCancellable *cancellable;
+} Context;
+static Context *ctx;
+
+/* Options */
+static gboolean get_supported_messages_flag;
+static gboolean reset_flag;
+static gboolean noop_flag;
+static gboolean start_flag;
+
+static GOptionEntry entries[] = {
+    { "pds-start-gps", 0, 0, G_OPTION_ARG_NONE, &start_flag,
+      "Start gps",
+      NULL
+    },
+
+    { NULL }
+};
+
+GOptionGroup *
+qmicli_pds_get_option_group (void)
+{
+	GOptionGroup *group;
+
+	group = g_option_group_new ("pds",
+	                            "PDS options",
+	                            "Show Wireless Messaging Service options",
+	                            NULL,
+	                            NULL);
+	g_option_group_add_entries (group, entries);
+
+	return group;
+}
+
+gboolean
+qmicli_pds_options_enabled (void)
+{
+    static guint n_actions = 0;
+    static gboolean checked = FALSE;
+
+    if (checked)
+        return !!n_actions;
+
+    n_actions = (get_supported_messages_flag +
+                 reset_flag +
+                 noop_flag +
+                 start_flag);
+
+    if (n_actions > 1) {
+        g_printerr ("error: too many PDS actions requested\n");
+        exit (EXIT_FAILURE);
+    }
+
+    checked = TRUE;
+    return !!n_actions;
+}
+
+#if 0
+static void
+context_free (Context *context)
+{
+    if (!context)
+        return;
+
+    if (context->client)
+        g_object_unref (context->client);
+    g_object_unref (context->cancellable);
+    g_object_unref (context->device);
+    g_slice_free (Context, context);
+}
+
+static void
+operation_shutdown (gboolean operation_status)
+{
+    /* Cleanup context and finish async operation */
+    context_free (ctx);
+    qmicli_async_operation_done (operation_status, FALSE);
+}
+#endif
+
+static void
+ser_location_ready (QmiClientPds *client,
+                    GAsyncResult *res,
+                    GTask *task);
+
+static void
+location_event_report_indication_cb (QmiClientPds *client,
+                                     QmiIndicationPdsEventReportOutput *output,
+                                     void *self)
+{
+    QmiPdsPositionSessionStatus session_status;
+    const gchar *nmea;
+
+    if (qmi_indication_pds_event_report_output_get_position_session_status (
+                                                                            output,
+                                                                            &session_status,
+                                                                            NULL)) {
+        printf ("[GPS] session status changed: '%s'",
+                qmi_pds_position_session_status_get_string (session_status));
+    }
+
+    if (qmi_indication_pds_event_report_output_get_nmea_position (
+                                                                  output,
+                                                                  &nmea,
+                                                                  NULL)) {
+        printf ("%s", nmea);
+    }
+}
+
+static void
+gather_nmea(GTask *task)
+{
+    QmiMessagePdsSetEventReportInput *input;
+    
+    /* Only gather standard NMEA traces */
+    input = qmi_message_pds_set_event_report_input_new ();
+    qmi_message_pds_set_event_report_input_set_nmea_position_reporting (input, TRUE, NULL);
+    qmi_client_pds_set_event_report (
+                                     ctx->client,
+                                     input,
+                                     5,
+                                     NULL,
+                                     (GAsyncReadyCallback)ser_location_ready,
+                                     task);
+    qmi_message_pds_set_event_report_input_unref (input);
+
+}
+
+static void
+ser_location_ready (QmiClientPds *client,
+                    GAsyncResult *res,
+                    GTask *task)
+{
+    QmiMessagePdsSetEventReportOutput *output = NULL;
+    GError *error = NULL;
+
+    output = qmi_client_pds_set_event_report_finish (client, res, &error);
+    if (!output) {
+        g_prefix_error (&error, "QMI operation failed: ");
+        g_task_return_error (task, error);
+        g_object_unref (task);
+        return;
+    }
+
+    if (!qmi_message_pds_set_event_report_output_get_result (output, &error)) {
+        g_prefix_error (&error, "Couldn't set event report: ");
+        g_task_return_error (task, error);
+        g_object_unref (task);
+        qmi_message_pds_set_event_report_output_unref (output);
+        return;
+    }
+
+    qmi_message_pds_set_event_report_output_unref (output);
+
+    g_signal_connect (client,
+                      "event-report",
+                      G_CALLBACK (location_event_report_indication_cb),
+                      NULL);
+}
+
+static void
+auto_tracking_state_start_ready (QmiClientPds *client,
+                                 GAsyncResult *res,
+                                 GTask *task)
+{
+    QmiMessagePdsSetAutoTrackingStateOutput *output = NULL;
+    GError *error = NULL;
+
+    output = qmi_client_pds_set_auto_tracking_state_finish (client, res, &error);
+    if (!output) {
+        g_prefix_error (&error, "QMI operation failed: ");
+        g_task_return_error (task, error);
+        g_object_unref (task);
+        return;
+    }
+
+    if (!qmi_message_pds_set_auto_tracking_state_output_get_result (output, &error)) {
+        if (!g_error_matches (error,
+                              QMI_PROTOCOL_ERROR,
+                              QMI_PROTOCOL_ERROR_NO_EFFECT)) {
+            g_prefix_error (&error, "Couldn't set auto-tracking state: ");
+            g_task_return_error (task, error);
+            g_object_unref (task);
+            qmi_message_pds_set_auto_tracking_state_output_unref (output);
+            return;
+        }
+        g_error_free (error);
+        printf("no matches: was already enabled?\n");
+    }
+    qmi_message_pds_set_auto_tracking_state_output_unref (output);
+    gather_nmea(task);
+}
+
+
+static void
+gps_service_state_start_ready (QmiClientPds *client,
+                               GAsyncResult *res,
+                               GTask *task)
+{
+    QmiMessagePdsSetAutoTrackingStateInput *input;
+    QmiMessagePdsSetGpsServiceStateOutput *output = NULL;
+    GError *error = NULL;
+
+    output = qmi_client_pds_set_gps_service_state_finish (client, res, &error);
+    if (!output) {
+        g_prefix_error (&error, "QMI operation failed: ");
+        g_task_return_error (task, error);
+        g_object_unref (task);
+        return;
+    }
+
+    if (!qmi_message_pds_set_gps_service_state_output_get_result (output, &error)) {
+        if (!g_error_matches (error,
+                              QMI_PROTOCOL_ERROR,
+                              QMI_PROTOCOL_ERROR_NO_EFFECT)) {
+            g_prefix_error (&error, "Couldn't set GPS service state: ");
+            g_task_return_error (task, error);
+            g_object_unref (task);
+            qmi_message_pds_set_gps_service_state_output_unref (output);
+            return;
+        }
+        g_error_free (error);
+    }
+    qmi_message_pds_set_gps_service_state_output_unref (output);
+
+    /* Enable auto-tracking for a continuous fix */
+    input = qmi_message_pds_set_auto_tracking_state_input_new ();
+    qmi_message_pds_set_auto_tracking_state_input_set_state (input, TRUE, NULL);
+    qmi_client_pds_set_auto_tracking_state (
+                                            ctx->client,
+                                            input,
+                                            10,
+                                            NULL, /* cancellable */
+                                            (GAsyncReadyCallback)auto_tracking_state_start_ready,
+                                            task);
+    qmi_message_pds_set_auto_tracking_state_input_unref (input);
+}
+
+
+void
+qmicli_pds_run (QmiDevice *device,
+                QmiClientPds *client,
+                GCancellable *cancellable)
+{
+    /* Initialize context */
+    ctx = g_slice_new (Context);
+    ctx->device = g_object_ref (device);
+    ctx->client = g_object_ref (client);
+    ctx->cancellable = g_object_ref (cancellable);
+
+    if (start_flag) {
+        QmiMessagePdsSetGpsServiceStateInput *input;
+
+        input = qmi_message_pds_set_gps_service_state_input_new ();
+        qmi_message_pds_set_gps_service_state_input_set_state (input, TRUE, NULL);
+        qmi_client_pds_set_gps_service_state (
+                                              ctx->client,
+                                              input,
+                                              10,
+                                              NULL, /* cancellable */
+                                              (GAsyncReadyCallback)gps_service_state_start_ready,
+                                              ctx);
+        qmi_message_pds_set_gps_service_state_input_unref (input);
+        printf("GPS started?\n");
+        return;
+    }
+
+    if (1) { // run_flag)
+        g_signal_connect (client,
+                          "event-report",
+                          G_CALLBACK (location_event_report_indication_cb),
+                          NULL);
+    }
+
+    g_warn_if_reached ();
+}
diff --git a/src/qmicli/qmicli.c b/src/qmicli/qmicli.c
index fecae8d..32d1052 100644
--- a/src/qmicli/qmicli.c
+++ b/src/qmicli/qmicli.c
@@ -366,6 +366,9 @@ allocate_client_ready (QmiDevice *dev,
     case QMI_SERVICE_WMS:
         qmicli_wms_run (dev, QMI_CLIENT_WMS (client), cancellable);
         return;
+    case QMI_SERVICE_PDS:
+        qmicli_pds_run (dev, QMI_CLIENT_PDS (client), cancellable);
+        return;
     case QMI_SERVICE_WDA:
         qmicli_wda_run (dev, QMI_CLIENT_WDA (client), cancellable);
         return;
@@ -719,6 +722,12 @@ parse_actions (void)
         actions_enabled++;
     }
 
+    /* PDS options? */
+    if (qmicli_pds_options_enabled ()) {
+        service = QMI_SERVICE_PDS;
+        actions_enabled++;
+    }
+
     /* WDA options? */
     if (qmicli_wda_options_enabled ()) {
         service = QMI_SERVICE_WDA;
@@ -769,6 +778,8 @@ int main (int argc, char **argv)
     g_option_context_add_group (context,
                                 qmicli_uim_get_option_group ());
     g_option_context_add_group (context,
+                                qmicli_pds_get_option_group ());
+    g_option_context_add_group (context,
                                 qmicli_wms_get_option_group ());
     g_option_context_add_group (context,
                                 qmicli_wda_get_option_group ());
diff --git a/src/qmicli/qmicli.h b/src/qmicli/qmicli.h
index 7db7905..0986b66 100644
--- a/src/qmicli/qmicli.h
+++ b/src/qmicli/qmicli.h
@@ -69,6 +69,14 @@ void          qmicli_uim_run              (QmiDevice *device,
                                            QmiClientUim *client,
                                            GCancellable *cancellable);
 
+
+/* PDS group */
+GOptionGroup *qmicli_pds_get_option_group (void);
+gboolean      qmicli_pds_options_enabled  (void);
+void          qmicli_pds_run              (QmiDevice *device,
+                                           QmiClientPds *client,
+                                           GCancellable *cancellable);
+
 /* WMS group */
 GOptionGroup *qmicli_wms_get_option_group (void);
 gboolean      qmicli_wms_options_enabled  (void);

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



  parent reply	other threads:[~2018-04-10 10:58 UTC|newest]

Thread overview: 173+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-23 20:02 [PATCHv5 0/5] Motorola Droid 4 Audio Support Sebastian Reichel
2018-02-23 20:02 ` Sebastian Reichel
2018-02-23 20:02 ` [PATCHv5 1/5] dt-bindings: mfd: motorola-cpcap: document audio-codec Sebastian Reichel
2018-02-23 20:02   ` Sebastian Reichel
2018-02-26 10:08   ` Mark Brown
2018-02-26 10:08     ` Mark Brown
2018-03-02 19:07   ` Rob Herring
2018-03-02 19:07     ` Rob Herring
2018-03-07 16:30   ` Lee Jones
2018-03-07 16:30     ` Lee Jones
2018-02-23 20:02 ` [PATCHv5 2/5] ASoC: codec: cpcap: new codec Sebastian Reichel
2018-02-23 20:02   ` Sebastian Reichel
2018-02-26  1:36   ` [alsa-devel] " kbuild test robot
2018-02-26  1:36     ` kbuild test robot
2018-02-27 11:03   ` Mark Brown
2018-02-28 11:06   ` Applied "ASoC: cpcap: new codec" to the asoc tree Mark Brown
2018-02-28 11:06     ` Mark Brown
2018-02-23 20:02 ` [PATCHv5 3/5] mfd: motorola-cpcap: Add audio-codec support Sebastian Reichel
2018-02-23 20:02   ` Sebastian Reichel
2018-03-07 16:32   ` Lee Jones
2018-03-07 16:32     ` Lee Jones
2018-03-08  9:46     ` Sebastian Reichel
2018-03-08  9:53       ` Lee Jones
2018-03-08  9:53         ` Lee Jones
2018-03-08 10:27         ` Sebastian Reichel
2018-03-08 10:48           ` Lee Jones
2018-03-08 10:48             ` Lee Jones
2018-03-08 11:25             ` Mark Brown
2018-03-08 11:25               ` Mark Brown
2018-03-09  8:34               ` Lee Jones
2018-03-09 11:19                 ` Sebastian Reichel
2018-03-09 11:19                   ` Sebastian Reichel
2018-03-09 12:40                 ` Mark Brown
2018-03-09 12:40                   ` Mark Brown
2018-03-09 15:11                   ` Tony Lindgren
2018-03-09 16:48                     ` Sebastian Reichel
2018-03-09 16:48                       ` Sebastian Reichel
2018-03-08 12:54             ` Sebastian Reichel
2018-03-08 17:07       ` Tony Lindgren
2018-03-09 11:29         ` Sebastian Reichel
2018-03-12  9:08           ` Lee Jones
2018-03-12  9:08             ` Lee Jones
2018-02-23 20:02 ` [PATCHv5 4/5] ARM: dts: motorola-cpcap-mapphone: add audio-codec Sebastian Reichel
2018-02-23 20:02   ` Sebastian Reichel
2018-02-23 20:02 ` [PATCHv5 5/5] ARM: dts: omap4-droid4: add soundcard Sebastian Reichel
2018-02-23 20:02   ` Sebastian Reichel
2018-03-22 20:48   ` [PATCHv5,5/5] " Pavel Machek
2018-03-22 20:48     ` [PATCHv5, 5/5] " Pavel Machek
2018-03-22 23:48     ` [PATCHv5,5/5] " Sebastian Reichel
2018-03-23 10:09       ` Pavel Machek
2018-03-23 10:09         ` [PATCHv5, 5/5] " Pavel Machek
2018-03-23 10:30         ` [PATCHv5,5/5] " Sebastian Reichel
2018-03-23 10:30           ` [PATCHv5, 5/5] " Sebastian Reichel
2018-03-23 11:06           ` [PATCHv5,5/5] " Pavel Machek
2018-03-23 11:06             ` [PATCHv5, 5/5] " Pavel Machek
2018-03-23 11:08           ` [PATCHv5,5/5] " Pavel Machek
2018-03-23 11:08             ` [PATCHv5, 5/5] " Pavel Machek
2018-03-23 14:09           ` [PATCHv5,5/5] " Pavel Machek
2018-03-23 14:11           ` Pavel Machek
2018-03-23 14:11             ` [PATCHv5, 5/5] " Pavel Machek
2018-03-26 14:16           ` omap4-droid4: voice call support was Re: [PATCHv5,5/5] " Pavel Machek
2018-03-26 15:58             ` Sebastian Reichel
2018-03-26 20:31               ` Pavel Machek
2018-03-26 23:10                 ` Sebastian Reichel
2018-03-27 20:41                   ` Pavel Machek
2018-03-27 20:41                     ` omap4-droid4: voice call support was Re: [PATCHv5, 5/5] " Pavel Machek
2018-03-27 20:51                     ` omap4-droid4: voice call support was Re: [PATCHv5,5/5] " Tony Lindgren
2018-03-27 12:14               ` Mark Brown
2018-03-27 12:14                 ` omap4-droid4: voice call support was Re: [PATCHv5, 5/5] " Mark Brown
2018-03-27 22:22                 ` omap4-droid4: voice call support was Re: [PATCHv5,5/5] " Sebastian Reichel
2018-03-27 22:22                   ` omap4-droid4: voice call support was Re: [PATCHv5, 5/5] " Sebastian Reichel
2018-03-28  2:29                   ` omap4-droid4: voice call support was Re: [PATCHv5,5/5] " Mark Brown
2018-03-28  2:29                     ` omap4-droid4: voice call support was Re: [PATCHv5, 5/5] " Mark Brown
2018-03-28 14:02                     ` omap4-droid4: voice call support was Re: [PATCHv5,5/5] " Sebastian Reichel
2018-03-28 14:02                       ` omap4-droid4: voice call support was Re: [PATCHv5, 5/5] " Sebastian Reichel
2018-03-29  1:45                       ` omap4-droid4: voice call support was Re: [PATCHv5,5/5] " Tony Lindgren
2018-03-29 13:36                         ` Sebastian Reichel
2018-03-29 13:59                           ` Tony Lindgren
2018-03-29 15:46                             ` Sebastian Reichel
2018-03-29 16:06                               ` Tony Lindgren
2018-03-30 10:57                                 ` Sebastian Reichel
2018-03-30 10:57                                   ` omap4-droid4: voice call support was Re: [PATCHv5, 5/5] " Sebastian Reichel
2018-03-30 22:31                                 ` omap4-droid4: voice call support was Re: [PATCHv5,5/5] " Pavel Machek
2018-03-29 16:37                               ` Pavel Machek
2018-03-29 16:41                                 ` Tony Lindgren
2018-03-29 18:40                                   ` Pavel Machek
2018-03-29 18:40                                     ` omap4-droid4: voice call support was Re: [PATCHv5, 5/5] " Pavel Machek
2018-03-29 21:56                                     ` omap4-droid4: voice call support was Re: [PATCHv5,5/5] " Tony Lindgren
2018-03-30 10:37                                       ` Pavel Machek
2018-03-30 13:07                                         ` Merlijn Wajer
2018-03-30 15:22                                           ` Tony Lindgren
2018-03-30 15:25                                             ` omap4-droid4: voice call support was Re: [PATCHv5, 5/5] " Michael Nazzareno Trimarchi
2018-03-30 15:44                                               ` [alsa-devel] " Tony Lindgren
2018-03-30 15:44                                                 ` Tony Lindgren
2018-03-30 17:46                                                 ` [alsa-devel] " Tony Lindgren
2018-03-30 15:34                                             ` omap4-droid4: voice call support was Re: [PATCHv5,5/5] " Pavel Machek
2018-03-30 15:34                                               ` omap4-droid4: voice call support was Re: [PATCHv5, 5/5] " Pavel Machek
2018-03-30 17:50                                           ` omap4-droid4: voice call support was Re: [PATCHv5,5/5] " Pavel Machek
2018-03-30 18:01                                             ` Pavel Machek
2018-03-30 18:01                                               ` omap4-droid4: voice call support was Re: [PATCHv5, 5/5] " Pavel Machek
2018-03-30 20:46                                               ` omap4-droid4: voice call support was Re: [PATCHv5,5/5] " Pavel Machek
2018-03-29 14:09                         ` Pavel Machek
2018-03-29 14:21                           ` Tony Lindgren
2018-03-29 16:08                         ` Pavel Machek
2018-03-29 16:08                           ` omap4-droid4: voice call support was Re: [PATCHv5, 5/5] " Pavel Machek
2018-03-29 16:34                           ` omap4-droid4: voice call support was Re: [PATCHv5,5/5] " Tony Lindgren
2018-03-29 16:34                             ` omap4-droid4: voice call support was Re: [PATCHv5, 5/5] " Tony Lindgren
2018-03-29 18:05                             ` omap4-droid4: voice call support was Re: [PATCHv5,5/5] " Pavel Machek
2018-03-29 18:05                               ` omap4-droid4: voice call support was Re: [PATCHv5, 5/5] " Pavel Machek
2018-03-29 21:58                               ` omap4-droid4: voice call support was Re: [PATCHv5,5/5] " Tony Lindgren
2018-03-29 21:58                                 ` omap4-droid4: voice call support was Re: [PATCHv5, 5/5] " Tony Lindgren
2018-04-01 23:17                                 ` omap4-droid4: voice call support was Re: [PATCHv5,5/5] " Tony Lindgren
2018-04-01 23:17                                   ` omap4-droid4: voice call support was Re: [PATCHv5, 5/5] " Tony Lindgren
2018-03-31 14:55                         ` call/normal switch was Re: omap4-droid4: voice call support was Pavel Machek
2018-03-31 14:55                           ` Pavel Machek
2018-03-31 18:19                           ` Tony Lindgren
2018-03-31 19:19                             ` Pavel Machek
2018-03-31 19:19                               ` Pavel Machek
2018-03-31 19:46                               ` Pavel Machek
2018-03-31 19:46                                 ` Pavel Machek
2018-03-31 19:55                                 ` Pavel Machek
2018-03-31 19:55                                   ` Pavel Machek
2018-03-31 23:43                                   ` Tony Lindgren
2018-04-01  6:48                                     ` Pavel Machek
2018-04-01 13:18                                     ` Pavel Machek
2018-04-01 13:18                                       ` Pavel Machek
2018-04-01 15:36                                       ` Tony Lindgren
2018-04-01 15:36                                         ` Tony Lindgren
2018-04-01 17:30                                         ` Tony Lindgren
2018-04-02 15:50                                           ` Dan Williams
2018-04-02 15:57                                             ` Tony Lindgren
2018-04-03 15:04                                               ` Tony Lindgren
2018-04-03 15:04                                                 ` Tony Lindgren
2018-04-03 15:50                                                 ` Pavel Machek
2018-04-03 15:50                                                   ` Pavel Machek
2018-04-03 19:44                                                   ` Tony Lindgren
2018-04-06 12:04                                                     ` Pavel Machek
2018-04-06 12:04                                                       ` Pavel Machek
2018-04-06 12:23                                                       ` Merlijn Wajer
2018-04-06 12:23                                                         ` Merlijn Wajer
2018-04-06 12:45                                                         ` Pavel Machek
2018-04-06 12:45                                                           ` Pavel Machek
2018-04-06 22:02                                                         ` Pavel Machek
2018-04-07  8:10                                                         ` simultaneous voice/data works (was Re: call/normal switch was Re: omap4-droid4: voice call support was) Pavel Machek
2018-04-07  8:10                                                           ` Pavel Machek
2018-04-07 12:22                                                           ` Pavel Machek
2018-04-07 12:22                                                             ` Pavel Machek
2018-04-08  2:44                                                             ` Dan Williams
2018-04-08  7:41                                                               ` Pavel Machek
2018-04-09  3:15                                                                 ` Dan Williams
2018-04-09 14:08                                                               ` Tony Lindgren
2018-04-09 15:53                                                                 ` Dan Williams
2018-04-09 20:21                                                                 ` Pavel Machek
2018-04-09 20:21                                                                   ` Pavel Machek
2018-04-10 10:58                                                                 ` Pavel Machek [this message]
2018-04-10 10:58                                                                   ` Pavel Machek
2018-04-10 13:50                                                                   ` Tony Lindgren
2018-04-10 13:50                                                                     ` Tony Lindgren
2018-04-11 11:43                                                                     ` Pavel Machek
2018-04-11 11:43                                                                       ` Pavel Machek
2018-04-03 22:11                                         ` call/normal switch was Re: omap4-droid4: voice call support was Pavel Machek
2018-04-03 22:11                                           ` Pavel Machek
2018-03-31 19:46                               ` Tony Lindgren
2018-03-31 19:46                                 ` Tony Lindgren
2018-04-02 15:06                       ` omap4-droid4: voice call support was Re: [PATCHv5,5/5] ARM: dts: omap4-droid4: add soundcard Mark Brown
2018-04-02 15:06                         ` omap4-droid4: voice call support was Re: [PATCHv5, 5/5] " Mark Brown
2018-03-28  9:00               ` omap4-droid4: voice call support was Re: [PATCHv5,5/5] " Pavel Machek
2018-03-28  9:36                 ` Pavel Machek
2018-03-28  9:36                   ` omap4-droid4: voice call support was Re: [PATCHv5, 5/5] " Pavel Machek
2018-04-03  8:52       ` [PATCHv5,5/5] " Pavel Machek
2018-02-23 22:24 ` [PATCHv5 0/5] Motorola Droid 4 Audio Support Tony Lindgren
2018-02-23 22:24   ` Tony Lindgren
2018-03-02 20:57   ` Tony Lindgren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180410105840.GA13697@amd \
    --to=pavel@ucw.cz \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=dcbw@redhat.com \
    --cc=devicetree@vger.kernel.org \
    --cc=kernel@collabora.com \
    --cc=lee.jones@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=merlijn@wizzup.org \
    --cc=perex@perex.cz \
    --cc=robh+dt@kernel.org \
    --cc=sebastian.reichel@collabora.co.uk \
    --cc=tiwai@suse.com \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.