PureMaps (flatpak) on the L5

PureMaps (using OpenStreetMap) flatpak version screenshots (compressed):

Sydney:


Barcelona:


5 Likes

@amarok: You wrote somewhere that you couldn’t get a geolocation with the L5 despite having location services enabled in gnome settings. Do you have the geoclue-2.0 and geoclue-2-demo deb packages installed?

Can’t say anything about the L5 so far as I’m still waiting to get it, but on the Pinephone with Mobian it looks like this for me, when the necessary packages are installed:

~$ dpkg -l | grep geoclue
ii  geoclue-2-demo                           2.5.6-1mobian1                                  arm64        geoinformation service (demonstration programs)
ii  geoclue-2.0                              2.5.6-1mobian1                                  arm64        geoinformation service
ii  gir1.2-geoclue-2.0:arm64                 2.5.6-1mobian1                                  arm64        convenience library to interact with geoinformation service (introspection)
ii  libgeoclue-2-0:arm64                     2.5.6-1mobian1                                  arm64        convenience library to interact with geoinformation service

If those packages are already installed, is the GeoClue service running?

~$ sudo systemctl status geoclue
● geoclue.service - Location Lookup Service
     Loaded: loaded (/lib/systemd/system/geoclue.service; static)
     Active: active (running) since Fri 2020-12-11 22:10:21 CET; 13s ago
   Main PID: 23863 (geoclue)
      Tasks: 4 (limit: 1989)
     Memory: 2.4M
     CGroup: /system.slice/geoclue.service
             └─23863 /usr/libexec/geoclue

12月 11 22:10:21 pinephone geoclue[23863]: Available accuracy level from GClueWifi: 4
12月 11 22:10:21 pinephone systemd[1]: Started Location Lookup Service.
12月 11 22:10:21 pinephone geoclue[23863]: Avahi Service Browser's CACHE_EXHAUSTED event occurred
12月 11 22:10:21 pinephone geoclue[23863]: Avahi Service Browser's ALL_FOR_NOW event occurred
12月 11 22:10:21 pinephone geoclue[23863]: WiFi device 'wlan0' added.
12月 11 22:10:21 pinephone geoclue[23863]: Available accuracy level from GClueWifi: 6
12月 11 22:10:21 pinephone geoclue[23863]: New modem '/org/freedesktop/ModemManager1/Modem/1'
12月 11 22:10:21 pinephone geoclue[23863]: Modem '/org/freedesktop/ModemManager1/Modem/1' has location capabilities
12月 11 22:10:21 pinephone geoclue[23863]: Available accuracy level from GClue3G: 5
12月 11 22:10:21 pinephone geoclue[23863]: Available accuracy level from GClueModemGPS: 8

As soon as the geoclue service is running, you can get your location via CLI with /usr/libexec/geoclue-2.0/demos/where-am-i.

where-am-i has two very useful options --accuracy-level and --timeout: An accuracy-level of 8 forces the location service to use GNSS/GPS, while you should get a less accurate position from a WiFi scan with an accuracy-level of 6 (if GPS is not available). With timeout you can scan for a longer period of time. For more information, invoke where-am-i with --help. The command is included in the package geoclue-2-demo.

If you get a Failed to query location: Forbidden when querying the logs with journalctl -u geoclue, this is usually because you have exceeded your daily limit for queries to the Mozilla Location Sevice (MLS). MLS is used by GeoClue to get the location from WiFi APs and Cell Towers.

With the GeoClue service running, you should be able to get a more or less accurate position in PureMaps. At least that’s the case for me with PureMaps installed from flatpak on Mobian/Pinephone.

If you want to get a GPS fix, you have to be outside and you need a clear view to the sky. Most of the time it takes over 12 minutes (or sometimes much longer) for me to get a GPS fix after a “cold start” - and sometimes it doesn’t work at all (f.ex. cloudy weather). So be patient :slight_smile:

There are some more commands to get info out of modem-manager about GPS (NMEA data). But I don’t know, if the GPS data is accessible via modem-manager on the Librem 5.

~$ mmcli -L
    /org/freedesktop/ModemManager1/Modem/0 [QUALCOMM INCORPORATED] QUECTEL Mobile Broadband Module
~$ sudo mmcli -m 0 --location-enable-gps-nmea 
successfully setup location gathering
~$ sudo mmcli -m 0 --location-get
  --------------------------
  3GPP |      operator code: ***
       |      operator name: *
       | location area code: ****
       | tracking area code: ****
       |            cell id: ********
  --------------------------
  GPS  |               nmea: $GPGSA,A,1,,,,,,,,,,,,,,,,*32
       |                     $GPRMC,,V,,,,,,,,,,N*53
       |                     $GPVTG,,T,,M,,N,,K,N*2C
       |                     $GPGGA,,,,,,0,,,,,,,,*66

Hope this helps a bit - I would be very interested in hearing from you if you could get PureMaps working on the Librem 5 with location services!

4 Likes

Check it out:

purism@pureos:~$ dpkg -l | grep geoclue
ii geoclue-2.0 2.5.2-1 arm64 geoinformation service
ii gir1.2-geoclue-2.0:arm64 2.5.2-1 arm64 convenience library to interact with geoinformation service (introspection)
ii libgeoclue-2-0:arm64 2.5.2-1 arm64 convenience library to interact with geoinformation service
purism@pureos:~$ sudo systemctl status geoclue
● geoclue.service - Location Lookup Service
Loaded: loaded (/lib/systemd/system/geoclue.service; static; vendor preset: enabled)
Active: active (running) since Fri 2020-12-11 13:52:06 PST; 39min ago
Main PID: 918 (geoclue)
Tasks: 4 (limit: 3107)
Memory: 8.8M
CGroup: /system.slice/geoclue.service
└─918 /usr/lib/geoclue-2.0/geoclue

Dec 11 14:27:02 pureos geoclue[918]: Failed to query location: Forbidden
Dec 11 14:27:41 pureos geoclue[918]: Failed to query location: Forbidden
Dec 11 14:28:25 pureos geoclue[918]: Failed to query location: Forbidden
Dec 11 14:28:40 pureos geoclue[918]: Failed to query location: Forbidden
Dec 11 14:29:11 pureos geoclue[918]: Failed to query location: Forbidden
Dec 11 14:29:41 pureos geoclue[918]: Failed to query location: Forbidden
Dec 11 14:29:57 pureos geoclue[918]: Failed to query location: Forbidden
Dec 11 14:30:16 pureos geoclue[918]: Failed to query location: Forbidden
Dec 11 14:31:00 pureos geoclue[918]: Failed to query location: Forbidden
Dec 11 14:31:27 pureos geoclue[918]: Failed to query location: Forbidden
purism@pureos:~$ /usr/libexec/geoclue-2.0/demos/where-am-i
-bash: /usr/libexec/geoclue-2.0/demos/where-am-i: No such file or directory
purism@pureos:~$

1 Like

I see - geoclue service is running but has exceeded the daily limit for queries to the MLS. For the where-am-i command, you have to install geoclue-2-demo.

Would be interesting to see if you can get more info with the mmcli command - but I don’t know if this is supposed to work on the L5.

To verify, that the “Failed to query location: Forbidden” message is really because of the daily limit, you can open the following URL in a browser (from the phone):

https://location.services.mozilla.com/v1/geolocate?key=geoclue

This URL comes from the geoclue config file /etc/geoclue/geoclue.conf. Then you should see something like that:

{"error":{"errors":[{"domain":"usageLimits","reason":"dailyLimitExceeded","message":"You have exceeded your daily limit."}],"code":403,"message":"You have exceeded your daily limit."}}
2 Likes

“dailyLimitExceeded”
I really don’t see how that’s possible.

I installed the demo package and tried again:

purism@pureos:~$ /usr/libexec/geoclue-2.0/demos/where-am-i
-bash: /usr/libexec/geoclue-2.0/demos/where-am-i: No such file or directory
purism@pureos:~$

1 Like

“dailyLimitExceeded”
I really don’t see how that’s possible.

I don’t know how Mozilla is counting against those limits, but it could be shared among all queries coming with “key=geoclue”. If this is the case, there are a lot of systems out there with this setting, as this is the default in a lot of Linux distributions.

purism@pureos:~$ /usr/libexec/geoclue-2.0/demos/where-am-i
-bash: /usr/libexec/geoclue-2.0/demos/where-am-i: No such file or directory

Then please do a dpkg -S where-am-i. This should give you all installed packages which include “where-am-i” and give you the full path to the executable.

Right, it was here instead:

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

The command doesn’t tell me anything, though:
purism@pureos:~$ /usr/lib/geoclue-2.0/demos/where-am-i
purism@pureos:~$

The command doesn’t tell me anything, though:
purism@pureos:~$ /usr/lib/geoclue-2.0/demos/where-am-i

That’s ok for now. As the queries are exceeded for MLS for the time being and you’re probably indoor atm, you won’t get a location back from the geoclue service.
Just wait until the “dailyLimitExceeded” goes away or you can go outside and try to get a GNSS/GPS fix.

For longer location scans, I usually use the following command outside:

where-am-i --accuracy-level=8 --timeout=36000

Another thing to try, would be to use mmcli -L to query the modem. This gives you the path to all available modems. The last number is the index to use with the “-m” option. If the GPS is integrated in the modem and accessible via modem-manager, you can enable GPS via sudo mmcli -m 0 --location-enable-gps-nmea and get the location via sudo mmcli -m 0 --location-get.

2 Likes

(I’ve XX’ed out the parts that looked like they could reveal my location.)

purism@pureos:~$ mmcli -L
/org/freedesktop/ModemManager1/Modem/0 [QUALCOMM INCORPORATED] 0
purism@pureos:~$ sudo mmcli -m 0 --location-enable-gps-nmea
successfully setup location gathering
purism@pureos:~$ sudo mmcli -m 0 --location-get


GPS | nmea: $GNGNS,NNN,XX
| $GPGSA,A,1,XX
| $PQWM1,XX
| $GPRMC,V,NXX
| $GPVTG,T,M,N,K,NXX
| $GPGGA,0,XX
| $PQWSXX
| $GNGSA,A,1,XX
purism@pureos:~$

Edit: Thanks for all these tips, btw.

1 Like

@amarok thank you for your patience and testing this. I have been interested for quite some time, if and how good GPS is working on the L5.

The data you posted doesn’t reveal your location. The part you XXed out at the end is the checksum. In case you are interested, here’s a description about the meaning of the NMEA sentences: https://www.rfwireless-world.com/Terminology/GPS-sentences-or-NMEA-sentences.html
Or if you want to decode the NMEA sentences, you can use an online tool like https://swairlearn.bluecover.pt/nmea_analyser

Now we know that we can query the GPS module via mmcli on the L5 - that’s cool. In this case, geoclue should be able to pick up the data as soon as you’ve got a GPS fix.

So the next step would be to get an actual GPS fix. You should get back a longer GPGGA NMEA sentence with an actual position from mmcli. This should look similar to that:

$GPGGA,122842.528,5231.277,N,01324.679,E,1,12,1.0,0.0,M,0.0,M,,*65
$GPGSA,A,3,01,02,03,04,05,06,07,08,09,10,11,12,1.0,1.0,1.0*30
$GPRMC,122842.528,A,5231.277,N,01324.679,E,026.8,028.6,121220,000.0,W*73

As soon as you’ve got a GPS fix, you can check again with where-am-i --accuracy-level=8.

Edit: For reference, here’s some sample output from where-am-i (without GPS fix, location XXed out):

mobian@pinephone:~$ /usr/libexec/geoclue-2.0/demos/where-am-i --accuracy-level=8
Client object: /org/freedesktop/GeoClue2/Client/4

New location:
Latitude:    XX.XXXXXX°
Longitude:   XX.XXXXXX°
Accuracy:    11.973171 meters
Speed:       0.009006 meters/second
Heading:     0.000000°
Timestamp:   2020年12月12日 14時07分01秒 (1607778421 seconds since the Epoch)

New location:
Latitude:    XX.XXXXXX°
Longitude:   XX.XXXXXX°
Accuracy:    11.876203 meters
Speed:       0.018885 meters/second
Heading:     0.000000°
Timestamp:   2020年12月12日 14時07分24秒 (1607778444 seconds since the Epoch)
4 Likes

The modem’s GPS antenna isn’t connected, you won’t be able to get a fix this way. Librem 5 has a separate GPS device that’s accessible via /dev/gnss0 node. AFAIK geoclue doesn’t have it fully wired up yet so you’d need something like https://github.com/zeenix/gps-share/pull/17 to make it show up in apps that use geoclue API. If you just want to verify how the module works, you can also use gpsd or even cat /dev/gnss0 and parse NMEA with your eyes :wink:

4 Likes

@dos: Thanks. I haven’t taken a closer look at the GPS hardware of the L5 so far. But it makes sense that you wouldn’t want the modem’s GPS to be used on a privacy focused device.

Well, I should have read https://puri.sm/posts/gps-tuning-the-librem-5-hardware/ before posting here… :sweat_smile:

And thanks for pointing me to the PR - seems like Angus Ainslie is already on the topic… :slight_smile:

1 Like

Thanks for all this anyway, @Kareema… I learned some things and that’s always good.

2 Likes

@dos: I just took a look at the state of https://github.com/zeenix/gps-share/pull/17 and it seems like it wouldn’t take long until the PR is merged. The FIXME to clean up the code should be easy enough for a rust beginner like me, so I’ll take a shot at it as soon as I find the time (after the merge is through).
I noticed, that there’s no Debian package for gps-share so far. Do you know if Angus Ainslie (or somebody else) is going to package it for the Librem 5?

Sorry to bump an old post, but where is the location service in settings? I cannot find it

Settings >> Privacy.

I got a PureMaps update yesterday, now the default map (mapbox) is displayed as follows:


Is this something I can fix somehow?

I tried to package it up, but it has a bunch of dependencies not found in Debian. Still, there’s someone in Debian who is watching this space, so I’m going to push what I have to relevant places.

Almost all is not displayed, but what is looks quite correct. :wink:

Text based/only map? :thinking: That does indeed show where everything is in relation to each other.

Is @Rinigus (the dev) still frequenting this forum?