Re: simultaneous voice/data works (was Re: call/normal switch was Re: omap4-droid4: voice call support was)

2018-04-11 Thread Pavel Machek
On Tue 2018-04-10 06:50:29, Tony Lindgren wrote:
> * Pavel Machek  [180410 11:00]:
> > On Mon 2018-04-09 07:08:47, Tony Lindgren wrote:
> > > * Dan Williams  [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.
> 
> Hmm maybe also try to check if enabling the GPS this way starts
> printing something out of /dev/ttyUSB[123]?

No, I did not find anything there :-(.

This combination seems to give me working gps:

sudo src/qmicli/qmicli -d /dev/cdc-wdm0 --pds-start-gps | nc -u 127.0.0.1 5000

/usr/sbin/gpsd -ND 4 udp://127.0.0.1:5000

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


signature.asc
Description: Digital signature


Re: simultaneous voice/data works (was Re: call/normal switch was Re: omap4-droid4: voice call support was)

2018-04-10 Thread Tony Lindgren
* Pavel Machek  [180410 11:00]:
> On Mon 2018-04-09 07:08:47, Tony Lindgren wrote:
> > * Dan Williams  [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.

Hmm maybe also try to check if enabling the GPS this way starts
printing something out of /dev/ttyUSB[123]?

Regards,

Tony


Re: simultaneous voice/data works (was Re: call/normal switch was Re: omap4-droid4: voice call support was)

2018-04-10 Thread Pavel Machek
On Mon 2018-04-09 07:08:47, Tony Lindgren wrote:
> * Dan Williams  [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 000..e69de29
diff --git a/src/qmicli/qmicli-pds.c b/src/qmicli/qmicli-pds.c
new file mode 100644
index 000..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 .
+ *
+ * Copyright (C) 2015-2017 Aleksander Morgado 
+ */
+
+#include "config.h"
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+
+#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_positi

Re: simultaneous voice/data works (was Re: call/normal switch was Re: omap4-droid4: voice call support was)

2018-04-09 Thread Pavel Machek
On Mon 2018-04-09 07:08:47, Tony Lindgren wrote:
> * Dan Williams  [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?

In the meantime, I got GPS to work :-).

I modified qmicli to pipe NMEA data to stdout, which should be enough.

But yes, directly exposing NMEA data on ttyGSM? would be even nicer.

Thanks,

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


signature.asc
Description: Digital signature


Re: simultaneous voice/data works (was Re: call/normal switch was Re: omap4-droid4: voice call support was)

2018-04-09 Thread Dan Williams
On Mon, 2018-04-09 at 07:08 -0700, Tony Lindgren wrote:
> * Dan Williams  [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?

Not all modems support all of the ModemManager location options;
-unmanaged is only for devices that support sending the data to a
separate port and for which we know the commands to do that.

It looks like QMI has a way to direct the output to a specific device:

// Enum to describe QMI PDS Output Devices
enum eQMIPDSOutputDevices:UINT8
{
   eQMIPDSOutputDevices_NoneDisabled  = 0,
   eQMIPDSOutputDevices_USB   = 1,
   eQMIPDSOutputDevices_UART1 = 2,
   eQMIPDSOutputDevices_UART2 = 3,
   eQMIPDSOutputDevices_SharedMemory  = 4,
};

so we could add support for that to libqmi and then to ModemManager,
which could help implement --location-enable-gps-unmanaged on alternate
ports.

But what might be simpler is implementing something like the "QMI GPS
proxy" that already exists, but for ModemManager or libqmi directly. 
That way you can use QMI and get known formatting of the output data,
but proxy it to a normal-looking NMEA tty?  Instead of trying to figure
out which TTY/UART/etc the information comes out of for each specific
device and somehow encoding that into the platform.  We know what the
QMI ports are already, that's easy.  We don't know what all the TTYs
are for every given modem and hardcoding that info somewhere is error-
prone and hard to keep up with.

Dan


Re: simultaneous voice/data works (was Re: call/normal switch was Re: omap4-droid4: voice call support was)

2018-04-09 Thread Tony Lindgren
* Dan Williams  [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?

Regards,

Tony


Re: simultaneous voice/data works (was Re: call/normal switch was Re: omap4-droid4: voice call support was)

2018-04-08 Thread Dan Williams
On Sun, 2018-04-08 at 09:41 +0200, Pavel Machek wrote:
> Hi!
> 
> > > mmcli -m 0 --enable
> > > mmcli -m 0  --location-enable-gps-nmea
> > > watch -n .3 sudo mmcli -m 0  --location-get-gps-nmea
> > > 
> > > ...can be used to get GPS data. Droid4 seems to have rather bad
> > > GPS,
> > > so you should probably put it near window for testing.
> > > 
> > > Is there way to grab data from modemmanager and feed it to gpsd,
> > > so
> > > that normal applications can access gps? I don't see easy way.
> > > 
> > > 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.
> > 
> > Doesn't --location-get-gps-nmea work for you?  That will spit out
> > the
> > latest NMEA traces MM gets from the modem, if it supports NMEA.  I
> > believe --location-status will tell you what methods MM supports
> > with
> > the modem.
> 
> Yes, --location-get-gps-nmea works for me.
> 
> I guess one way forward would be to implement --location-get-gps-nmea
> support for qmicli, and use that?

Yeah, libqmi already has the necessary bits but it's not plumbed
through to qmicli.  Note that qmicli is a straight interface to QMI and
doesn't try to impose abstractions on anything, so you wouldn't get --
location-get-gps-nmea, but you'd instead be working directly with the
QMI PDS (older) and/or LOC (newer) service commands.

Dan


Re: simultaneous voice/data works (was Re: call/normal switch was Re: omap4-droid4: voice call support was)

2018-04-08 Thread Pavel Machek
Hi!

> > mmcli -m 0 --enable
> > mmcli -m 0  --location-enable-gps-nmea
> > watch -n .3 sudo mmcli -m 0  --location-get-gps-nmea
> > 
> > ...can be used to get GPS data. Droid4 seems to have rather bad GPS,
> > so you should probably put it near window for testing.
> > 
> > Is there way to grab data from modemmanager and feed it to gpsd, so
> > that normal applications can access gps? I don't see easy way.
> > 
> > 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.
> 
> Doesn't --location-get-gps-nmea work for you?  That will spit out the
> latest NMEA traces MM gets from the modem, if it supports NMEA.  I
> believe --location-status will tell you what methods MM supports with
> the modem.

Yes, --location-get-gps-nmea works for me.

I guess one way forward would be to implement --location-get-gps-nmea
support for qmicli, and use that?

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


signature.asc
Description: Digital signature


Re: simultaneous voice/data works (was Re: call/normal switch was Re: omap4-droid4: voice call support was)

2018-04-07 Thread Dan Williams
On Sat, 2018-04-07 at 14:22 +0200, Pavel Machek wrote:
> On Sat 2018-04-07 10:10:00, Pavel Machek wrote:
> > Hi!
> > 
> > It seems qmicli can be used while unicsy_demo/ofone talks to the
> > modem
> > using the AT commands.
> > 
> > So I could do:
> > 
> > qmicli -d /dev/cdc-wdm0 --wds-follow-network --wds-start-
> > network=apn=internet.t-mobile.cz
> > route del default
> > sudo ifconfig wwan0 up
> > dhclient wwan0
> > 
> > to get GPRS/UMTS connection. AT commands still work.
> > 
> > Does anyone have any idea what to do to get the GPS to work?
> 
> Got that to work.
> 
> I installed modemmanager -- unfortunately that claims ttyUSB4 so it
> breaks voice/sms -- but then

It shouldn't break SMS since MM will do SMS via QMI, but yeah for now
it'll break voice because that would happen via QMI too, and we haven't
implemented voice for QMI yet.

--help-messaging
--help-sms

Also available via D-Bus of course.

> mmcli -m 0 --enable
> mmcli -m 0  --location-enable-gps-nmea
> watch -n .3 sudo mmcli -m 0  --location-get-gps-nmea
> 
> ...can be used to get GPS data. Droid4 seems to have rather bad GPS,
> so you should probably put it near window for testing.
> 
> Is there way to grab data from modemmanager and feed it to gpsd, so
> that normal applications can access gps? I don't see easy way.
> 
> 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.

Doesn't --location-get-gps-nmea work for you?  That will spit out the
latest NMEA traces MM gets from the modem, if it supports NMEA.  I
believe --location-status will tell you what methods MM supports with
the modem.

Also available via D-Bus of course.

> Is modemmanager enabling GPS, or is it talking to libqmi to do that?
> The code is quite confusing to me...

Yes.  When the modem is driven with QMI, then all the data comes from
QMI.  For other modems (like Huawei HiLink and Gobi 1000) the enabling
commands are done via AT on the main command port and then one of the
TTYs starts spewing out NMEA.

Dan


Re: simultaneous voice/data works (was Re: call/normal switch was Re: omap4-droid4: voice call support was)

2018-04-07 Thread Pavel Machek
On Sat 2018-04-07 10:10:00, Pavel Machek wrote:
> Hi!
> 
> It seems qmicli can be used while unicsy_demo/ofone talks to the modem
> using the AT commands.
> 
> So I could do:
> 
> qmicli -d /dev/cdc-wdm0 --wds-follow-network 
> --wds-start-network=apn=internet.t-mobile.cz
> route del default
> sudo ifconfig wwan0 up
> dhclient wwan0
> 
> to get GPRS/UMTS connection. AT commands still work.
> 
> Does anyone have any idea what to do to get the GPS to work?

Got that to work.

I installed modemmanager -- unfortunately that claims ttyUSB4 so it
breaks voice/sms -- but then

mmcli -m 0 --enable
mmcli -m 0  --location-enable-gps-nmea
watch -n .3 sudo mmcli -m 0  --location-get-gps-nmea

...can be used to get GPS data. Droid4 seems to have rather bad GPS,
so you should probably put it near window for testing.

Is there way to grab data from modemmanager and feed it to gpsd, so
that normal applications can access gps? I don't see easy way.

I tried --location-enable-gps-unmanaged , but that did not work for
me.

Is modemmanager enabling GPS, or is it talking to libqmi to do that?
The code is quite confusing to me...

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


signature.asc
Description: Digital signature