GPS

From postmarketOS Wiki

This page is intended to help with troubleshooting GPS issues.

How to check if GPS works

Check whether GPS is part of the modem

If yes, you might want to use ModemManager to access it. If not, you might have /dev/gnssX to access it and need some program to share the device amoung multiple users. gnss-share is probably the way to go.

Using ModemManager's CLI

mmcli -m any --location-get 

If you get no output, then you did not get a fix yet.

Using Satellite

Satellite is a nice GUI app for testing GPS connectivity live.

AGPS

Normally, information about which satellites are where to expect (satellite almanac of orbit) is retrieved from the GPS satellites themselves and that can take at least roughly 12 min with a good signal.

That's where A-GPS (assisted GPS) steps in, by downloading this data from the Internet instead.

Enabling GPS manually in ModemManager

Some devices may need the following steps for the GPS to work with ModemManager:

mmcli -m any --location-enable-gps-nmea

mmcli -m any --location-enable-gps-raw

GPS helper daemons

GeoClue

Many apps (ie. osmin, Gnome Maps) use geoclue to gather location info. /usr/libexec/geoclue-2.0/demos/agent

GPSD

According to this issue, GPSD is not used by GNOME and KDE software stacks, and is effectively not necessary to work anymore. You may want to use GeoClue and NetworkManager+ModemManager stack instead. However if the application is configured to use something else than gpsd has to be checked.

Troubleshooting

Check if SIM card has carrier configuration for AGPS

The carrier config selected by ModemManager (mmcli -m any | grep 'carrier config') also contains configuration for A-GPS. It seems that pmOS supports only XTRA assistance method properly and SUPL (agps-msa, agps-msb) does not work correctly at the moment (TODO: needs to be confirmed, this is based on experience with OnePlus 6 model), and since the supported method depends on the carrier, you need a SIM card which supports XTRA.

Whether the config is complete in that regard can be checked with mmcli -m any --location-status as it should contain assistance servers. If not, you might experience not continuous and only infrequent GPS fixes and other problems regarding GPS.

Injecting AGPS data manually for ModemManager

In case your phone does not use AGPS, you can try to inject it manually. But usually it should not be needed - it's supposed to just work on pmOS with ModemManager. First, check URLs of assistance servers:

mmcli -m any --location-status

Then inject the downloaded file:

mmcli -m any --location-inject-assistance-data=(filename)

See this comment thread for more details.

Check if your device requires SIM for GPS

Keep in mind that all devices using modemmanger need to have a SIM card inserted to wake to modem and to enable GPS. It can be a SIM which is not active anymore.