Bug 104719

Summary: [Sierra EM7455] support location via NMEA
Product: ModemManager Reporter: Thomas Weißschuh <thomas>
Component: generalAssignee: ModemManager bug user <modemmanager>
Status: RESOLVED MOVED QA Contact:
Severity: normal    
Priority: medium CC: russianneuromancer
Version: 1.6   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Thomas Weißschuh 2018-01-21 21:07:41 UTC
It would be nice if ModemManager supported the GPS functionality of Sierra EM7455 (and other recent, Qualcom based) modems.

The Modem contains a NMEA tty port with usb ifnum==2.
Writing the magic sequence `$GPS_START` to the tty will will trigger continous GPS fixes and the emission of NMEA sequences on the same tty. (The behaviour could also be configured via AT commands).

The modem also supports the qmi "LOC" interface (version 2.0), but no "PDS" interface.

(I tested the NMEA traces with the Lenovo branded version of the card with the following (vanilla) firmware:

 current fw version:      02.24.05.06
 current carrier name:    GENERIC
 current config name:     GENERIC_002.026_000
Comment 1 Thomas Weißschuh 2018-01-24 08:08:06 UTC
I would be willing to take a shot at an implementation.
Should it be the method with the NMEA device or the QMI interface? (I have 0 experience with the QMI stuff)
Comment 2 Aleksander Morgado 2018-01-24 10:05:03 UTC
Well I would definitely prefer it to be with the QMI LOC service. Take a look at libqmi and the minimal "LOC" service support we currently have there. Also, you may want to ping dcbw as he was working on that as well IIRC.
Comment 3 Thomas Weißschuh 2018-01-26 12:47:47 UTC
The modem is currently using the MBIM driver.
It does not have a native QMI device but does support QMI via MBIM).

Should the MBIM driver support location via QMI?
Comment 4 Thomas Weißschuh 2018-01-26 16:34:59 UTC
We could als move the logic for these Qualcomm chips into the parent class, as the chipset is used by multiple vendors.
We could then identify the ports via udev rules (different vendors have different identification schemes)
Comment 5 Aleksander Morgado 2018-01-26 17:58:44 UTC
The QMI LOC based gps management could be implemented in a separate common source file, and then used by:
  * the QMI implementation directly (i.e. mm-broadband-modem-qmi.c)
  * the MBIM implementation, if QMI-over-MBIM is supported (i.e. mm-broadband-modem-mbim.c)

That would probably be best, both generic implementations trying to use that service. As for the ports, when using QMI there is no actual need to use the tty to read the GPS NMEA stream! ModemManager can read the GPS info directly using QMI. We still should allow enabling/disabling GPS to be used by external programs via the TTY, and we call this "unmanaged gps", but there wouldn't be any need to "tag" ttys as "gps data port" in MM, as the MM implementation could just use QMI to receive the NMEA stream.
Comment 6 Thomas Weißschuh 2018-01-26 22:23:46 UTC
I would begin with unmanaged GPS part.
(So far I could not find any docs about QMI, any pointers are welcome).

About the unmanaged GPS:

Currently the Sierra plugin uses the vanilla QMI and MBIM modem classes without a custom subclass, so there is no usable extension point currently.
To get the logic into the different classes I think there are these choices:

1) Implement new complete new subclasses, only overriding the location stuff. (With all the boilerplate this entails)
2) Monkeypatching the returned object. (No idea if this is possible)
3) Moving the logic into the base modem class.
4) Having some sort of "Mixins". (No idea if this is possible)

Which one do you prefer?
Comment 7 Aleksander Morgado 2018-01-26 22:51:18 UTC
3) Moving the logic into the base modem QMI/MBIM classes; ie mm-broadband-modem-qmi.c and mm-broadband-modem-mbim.c. Just see the GPS support done in the QMI implementation based on the PDS service.
Comment 8 Thomas Weißschuh 2018-01-27 08:07:56 UTC
Thanks for the clarification, I somehow thought, that enabling the raw port would be done using the "write magic value to GPS interface" way.
Comment 9 Thomas Weißschuh 2018-01-28 15:57:53 UTC
Update:

I sent the groundwork in libqmi to the libqmi-devel list.

I also managed the get the modem into a native QMI mode.
It turned that the QMI-via-MBIM mode would not deliver any QMI indications, making the LOC service unusable there.
(Probably also the PDS service).
Do you know if this is supposed to happen or where the issue could be?
(Normal messages work. Indications are dropped for all tested services)

As at least this modem should be in native QMI mode by default (I managed to change it and forget about it), the LOC-over-QMI-over-MBIM case could be ignored until a modem without native QMI is encountered.
Comment 10 Thomas Weißschuh 2018-02-03 12:51:11 UTC
How would you prefer the implementation of the QmiLOC location backend?

*) Both the PDS and LOC implementation living in MMBroadbankModemQmi
*) Dedicated subclasses of MMBroadbandModemQmi for both the PDS and LOC implementations
*) Implementing a new interface MMQmiLocationProvider with subclasses for PDS and LOC
*) Something else I didn't think about (I am quite new to gobject)
Comment 11 Aleksander Morgado 2018-02-04 13:32:50 UTC
Hey! The first option is the most desirable one. If a modem supports LOC, it would use LOC, otherwise we check if the modem supports PDS and if so it would use PDS, and otherwise nothing.
Comment 12 Thomas Weißschuh 2018-02-04 13:42:40 UTC
How will we do the unmanaged GPS? I did not find any information about enabling the unmanaged port via QMI/MBIM.

Also the unmanaged GPS implementation would have to be shared between the Sierra, Sierra (legacy), and probably plugins for other modems sharing the Qualcomm chipset.

I fear that we will need a more general sulution to the problems of multiple differently usable location providers.
This could then also be used for the PDS/QMI case.

Personally I am not comfortable with designing this right now, due to missing knowledge about the whole of ModemManager and the capabilities of GObject.
Comment 13 GitLab Migration User 2018-06-10 09:06:08 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/issues/78.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.