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 which can be used to access the GPS data. If so, 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 map apps (ie. osmin, pure-maps, Gnome Maps) use geoclue to gather location info. You first need to launch it with executing:

/usr/libexec/geoclue-2.0/demos/agent

Optional check with:

/usr/libexec/geoclue-2.0/demos/where-am-i

GNSS-share

Facilitates sharing GNSS location data with multiple clients.

Start the service:

doas rc-service gnss-share start

Quick and dirty check if you get data:

sudo socat - UNIX-CONNECT:/var/run/gnss-share.sock

GPSD

According to pmaports#2340, 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 unlocked SIM for GPS

Keep in mind that all devices using modemmanager <v1.23 need to have a SIM card inserted to wake to modem and to enable GPS. So it is not enough if the modem is ready to process AT commands. It can be a SIM which is not active anymore but it should not be blocked. If the SIM card is still waiting for a PIN, you will see

$ mmcli -m any --location-status
error: modem not enabled yet

To get rid of this, compile a more up to date modemmanager, see here.