Librem 5 GPS/Location Tracking

This is so unixy :heart:

Spent some time out in a field and I have now managed to get a valid latitude and longitude out of /dev/gnss0 and it agrees well enough with an iPhone at the same location.

5 Likes

I got GPS location working in Pure Maps (on the L5)!
I had to

  1. Have clear sky
  2. wait ~10 minutes for the first fix (but then the fix is acquired fast, even after a reboot)
  3. Build gps-share and run it (quite simple, build it with cargo build. I just had to sudo apt install libudev*)
  4. fix .local domain name resolution
    4b. try where-am-i and verify it works
  5. to debug problems, check status of geoclue service
  6. run pure maps :slight_smile:

Updates are a bit laggish but navigation is finally usable!

11 Likes

This is probably because of the almanac and ephemeris getting downloaded the first time and then being saved, as Angus wrote about above.

Could you explain what that means?

Is “where-am-i” some command-line tool, or a function inside the Pure Maps app?

1 Like

It’s a command line tool in the geoclue-2-demo package which lives under /usr/libexec/geoclue-2.0/demos/where-am-i. It just prints out the location from geoclue. Since it connects to geoclue, if there are problems in getting the position, systemctl status geoclue prints out errors in the setup, if any.

When I started gps-share the first time, it found the gps device and said

Attempting to autodetect GPS device...
Attempting to autodetect GNSS device...
Detected /dev/gnss0 as a GPS device
TCP server bound on all interfaces
Port: 10110
group: /Client4/EntryGroup1

I also started cgps, which had 3D FIX, but where-am-i reported the location with 20000m accuracy (so it was definitely not using gps). systemctl status geoclue showed an error in domain name resolution of pureos.local. I just added pureos.local to the 127.0.0.1 line in the hosts file (I really needed gps because I was lost, that’s the most quick fix I found).

(gps-share cpu usage is 0 when nothing is connected to it, and jumps to 12-15% when there’s a client. Also, I’m running it with --network-interface lo to prevent other devices from accessing its location remotely)

5 Likes

cgps uses gpsd which will likely break gps-share or gnss-share.

Only one of gpsd or g*-share should be given access to the /dev/gnss0 device at a time.

If you want to spoof gpsd on a system using gnss-share use something like this

#!/bin/bash

PORT=2947
SOCK=/var/run/gnss_share.sock

socat -d -d -d -lf /tmp/socat.log TCP-LISTEN:${PORT},reuseaddr,fork UNIX-CLIENT:${SOCK} &
3 Likes

My experience with librem 5 in italy. Using, with Librem 5, gnome maps or in the browser with openstreetmap, my position is reported further south of about 140 m. On the other hand, with a phone with android the position is exact with a maximum error of 5 m.

1 Like

I’m in italy too, and it works ok, sometimes with reported error less than 5m. Did you try xgps?

1 Like

Maybe connecting the Librem5 to an external bluetooth GPS could be a good solution and I’m looking for if it can be done on gnome-maps or pure-maps (I can’t get a good GPS signal )

But on my Librem 5 Bluetooth does not work! I cannot enable BT.

Bluetooth is somewhat unreliable on my L5 too. Usually it can be solved by toggling the kill swith for wifi/BT.

I have tried in every way also with the kill switch, but nothing.

Eventually the gps works. I put him in my car and, after reporting for about 30 minutes that I was in China, he finally found himself well. It was a pleasure to see the directions on pure maps. But I think that the use of an external GPS receiver connected with bluetooth would be better. With bluetooth I have some difficulties for pairing and, in any case, I don’t know how to get the GPS signal from the receiver to the Librem5 and display the exact position on pure maps by not activating the Librem5 localization. We’ll see.
P.S. however the Librem5 is fantastic :slight_smile:

3 Likes

I’m watching the GPS receiver with grep for the GSV messages and have here an example:

$GPGSV,2,1,06,15,54,011,,18,51,322,,05,36,068,,13,29,034,*77
 GPS only mode
   GSV record
       2 total amount of GSV messages
         1 continued number of this GSV message
           06 total number of sats in view
              15 SatxPRN Satellites list used for positioning
                 54 SatxElev evaluation in degrees           
                    011 SatxAzim Azimuth of satellite x in degree, ref. "North",
                       ,, SatxCN0 Carrier to Noise Ratio for satellite x in dB
                         18 SatxPRN
                            51 SatxElev
                               322 SatxAzim
                                  ,, SatxCN0
...                               
$GPGSV,2,2,06,20,14,096,,02,07,146,,,,,,,,,*71

i.e. all GSV messages have an empty SatxCN0, between ,,. Does this mean that the hardware is broken?

It means that the module knows it should be able to see those satellites , probably based on at least a partial almanac download.

It’s not actively receiving any data from those satellites so it doesn’t show a signal to noise ratio.

Make sure it has an unobstructed view of the sky and that it’s not moving. Turing off the screen and logging in via ssh might almost improve the S/N ratio.

The L5 sits in my garden on a table, in the middle of the garden, with blue sky above. The display is off and I’m running the test via SSH.

I’ve a 2nd device L5 (the one of my son) and this works fine on the same table, getting GSV records with signal strength value and a GPS fix after a few minutes.

Could it be that the ground on the GNSS antenna is broken, or would this show no GSV records at all in this case.

On some devices the ground does not make a great connection with the frame. It can sometimes be fixed by disassembling it and adjusting the ground. You could also talk to support@puri.sm about the device.

I’ve contacted support@ with all the logs etc. because I can’t do such deep disassembling, esp. not within the warranty. We will see.

Could someone share the files almanac.txt and ephemeris.txt from /var/cache/gnss_share after running gnss_share for those of us having trouble with the gps module?

Mine just sees a single gps and 6 glonass satellites. the parameter “signal strength” (ss) is missing on all satellites.

I wrote a super simple py script for debugging (if someone is interested i will publish that thing).

My Chip reports Position: {'latitude': 23.680298666666665, 'longitude': 116.15435566666665, 'speed': 0, 'course': None, 'fix': False, 'altitude': 31, 'satellites': 0} with no fix. The location is not changing nor the state (“no fix”) or 0 satellites changes. Anyway the Maps programm shows that very location after a while as a fix. I consider this a bug.

On my phone that directory does not exist. I assume that that is because I don’t have the relevant package installed. It is my understanding that GNSS will work fine without having the package installed i.e. if all you want to do is confirm that the GNSS hardware is working (which I have done).