How to set-up GNSS USB dongle

While changing the broken display of my Librem 5, I’ve destroyed the connector to the GNSS antenna on the mainboard. So GNSS is kind of broken, it still sees some satellites, but never gets a fix, even on flat field.

So I decided to order an external GNSS USB dongle. I found one at AliExpress with USB-C. It’s using the Ublox UBX-M8030 chip.

If I plug it in it does appear as /dev/ttyACM0. It also seems to work as cat /dev/ttyACM0 gives out NMEA output. Parsing it with an online tool shows plausible/correct locations.

But the problem is, it does not work with GNOME Maps or Satellite.

I have set device_path="/dev/ttyACM0" in /etc/gnss-share.conf and restarted the gnss-share.service.

sudo socat unix:///var/run/gnss-share.sock - never puts something out. But I’m not sure if that is expected.

Does someone has an idea what is missing? Am I doing something wrong?

Here are some config files as well as other relevant things.

Part from /etc/geoclue/geoclue.conf

[network-nmea]
enable=true
nmea-socket=/var/run/gnss-share.sock
$ ls -al /var/run/gnss-share.sock
srw-rw---- 1 root geoclue 0 22. Jan 14:25 /var/run/gnss-share.sock

$ /usr/libexec/geoclue-2.0/demos/where-am-i 
Client object: /org/freedesktop/GeoClue2/Client/1

New location:
Latitude:    48,7XXXX°
Longitude:   9,4XXXX°
Accuracy:    15867,000000 meters
Description: 3GPP
Timestamp:   Sa 25 Jan 2025 20:18:24 CET (1737832704 seconds since the Epoch)

New location:
Latitude:    48,7XXXX°
Longitude:   9,4XXXX°
Accuracy:    15867,000000 meters
Heading:     0,000000°
Description: 3GPP + WiFi
Timestamp:   Sa 25 Jan 2025 20:18:29 CET (1737832709 seconds since the Epoch)

New location:
Latitude:    48,7XXXX°
Longitude:   9,4XXXX°
Accuracy:    15867,000000 meters
Speed:       0,000000 meters/second
Heading:     0,000000°
Description: 3GPP + WiFi
Timestamp:   Sa 25 Jan 2025 20:18:44 CET (1737832724 seconds since the Epoch)
$ sudo systemctl status geoclue.service
● geoclue.service - Location Lookup Service
     Loaded: loaded (/lib/systemd/system/geoclue.service; static)
     Active: active (running) since Sat 2025-01-25 20:20:33 CET; 53s ago
   Main PID: 30944 (geoclue)
      Tasks: 3 (limit: 3014)
     Memory: 10.7M
        CPU: 585ms
     CGroup: /system.slice/geoclue.service
             └─30944 /usr/libexec/geoclue

Jan 25 20:20:33 claudii systemd[1]: Starting Location Lookup Service...
Jan 25 20:20:33 claudii systemd[1]: Started Location Lookup Service.

$ sudo systemctl status gnss-share.service 
● gnss-share.service - Manage access to and AGPS on GNSS devices
     Loaded: loaded (/lib/systemd/system/gnss-share.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2025-01-25 20:11:21 CET; 16min ago
       Docs: https://gitlab.com/postmarketOS/gnss-share
   Main PID: 30733 (gnss-share)
      Tasks: 11 (limit: 3014)
     Memory: 13.0M
        CPU: 7.218s
     CGroup: /system.slice/gnss-share.service
             └─30733 /usr/bin/gnss-share

Jan 25 20:11:21 claudii systemd[1]: Started Manage access to and AGPS on GNSS devices.
Jan 25 20:11:21 claudii gnss-share[30733]: Starting GNSS server, accepting connections at:  /var/run/gnss-share.so>
Jan 25 20:14:39 claudii gnss-share[30733]: Client connected
Jan 25 20:14:42 claudii gnss-share[30733]: Client disconnected
Jan 25 20:18:23 claudii gnss-share[30733]: Client connected
Jan 25 20:18:53 claudii gnss-share[30733]: Client disconnected
Jan 25 20:20:40 claudii gnss-share[30733]: Client connected
Jan 25 20:20:48 claudii gnss-share[30733]: Client connected

Update 2025-01-26
“Spherical Triangle” gave me the tip to set device_driver="stm_serial" in /etc/gnss-share.conf on matrix chat. Yet it does not fix the issue.

stty < /dev/ttyACM0 
speed 9600 baud; line = 0;
min = 1; time = 0;
-brkint -icrnl -imaxbel
-opost
-isig -icanon -echo -echoe
$ cat /etc/gnss-share.conf 
# Socket to sent NMEA location to
socket="/var/run/gnss-share.sock"
# Group to set as owner for the socket
group="geoclue"

# GPS device driver to use
# Supported values: stm, stm_serial
device_driver="stm_serial"

# Path to GPS device to use
device_path="/dev/ttyACM0"

# Baud rate for GPS serial device
device_baud_rate=9600

# Directory to load/store almanac and ephemeris data
agps_directory="/var/cache/gnss-share"
2 Likes

Contact Purism:

While I can’t see what the actual problem is, …

  • to debug this, you should disable other sources in geoclue.conf, at least temporarily, and
  • if you get this working then you should use a udev rule, with USB vendor and product id, to create a symlink for the device (currently being referenced as /dev/ttyACM0 but that is not good because that could be anything). That way, GNSS-dependent code will only use the device as a source of location information when the right device is plugged in.

OK, admittedly, this second point might not be as important as on a big computer when you can have a whole bunch of USB devices plugged in, or not, but I guess if you use your Librem 5 with a hub, dock or lapdock, that issue could start to be problematic.

Also, you may find that networking is attempting to use the device as a modem i.e. for some kind of point-to-point link - and that probably isn’t what you intended. If you are messing around with udev rules then I believe the part incantation that you want is ENV{ID_MM_DEVICE_IGNORE}="1"

And, if the device is sensitive to the stty settings then the udev rule can force the correct settings.

1 Like

So I have setup udev rules, which do work:

$ cat /etc/udev/rules.d/80-ublock-gnss.rules 
# Rules to make u-blox M8030 work
ATTRS{idVendor}=="1546", ATTRS{idProduct}=="01a8", ENV{ID_MM_DEVICE_IGNORE}="1"
ACTION=="add", ATTRS{idVendor}=="1546", ATTRS{idProduct}=="01a8", SYMLINK+="gnssusb"

I also have set device_path="/dev/gnssusb" in /etc/gnss-share.conf.
But it does not help, still the same result.

Further I tried this recommendation:

But the symptoms are a bit different: cat /dev/gnssusb gives always NMEA data out if I plug the USB GPS dongle in. Although sudo socat unix:///var/run/gnss-share.sock - stays always silent :frowning:

I’m testing with satellite as well as with /usr/libexec/geoclue-2.0/demos/where-am-i. I started gnss-share manually to obtain the log:

~ > sudo gnss-share -d
Starting GNSS server, accepting connections at:  /var/run/gnss-share.sock
stm sending resume
write:  $PSTMGPSRESTART,*25
Client connected
Checking date/time on module...
Client connected
error: stm unable to set time: stm/setTime: timed out waiting for device
Client disconnected
1 Like

I think it needs someone who is familiar with the source code.

Other comments:

  • I guess use of a random USB dongle in place of the built-in GNSS chip may be outside the Purism support boundary and it might be that some random USB dongles are ‘compatible’ and some aren’t.
  • It may help to mention how many $/€ the dongle cost, in case it encourages anyone else to have a go.

Edit: In all the output, I can’t see whether you checked that the underlying device is accessible. (I mean sure you can cat but you can cat a lot of things as root.)

1 Like

It may help to mention how many $/€ the dongle cost, in case it encourages anyone else to have a go.

It wasn’t expensive. I did not found a “suitable” model with USB-C at German/European shops. So I ended up ordering it from aliexpress.com. Its around 20 EUR including shipment costs.

Edit: In all the output, I can’t see whether you checked that the underlying device is accessible. (I mean sure you can cat but you can cat a lot of things as root.)

~ > ls -al /dev/{gnss*,ttyACM0}
crw-rw---- 1 root dialout 240, 0 29. Jan 18:30 /dev/gnss0
lrwxrwxrwx 1 root root         7 30. Jan 19:42 /dev/gnssusb -> ttyACM0
crw-rw---- 1 root dialout 166, 0 30. Jan 19:42 /dev/ttyACM0

As far as I understand gnss-share runs as root:

sudo systemctl show --property=User,Group,UID,GID gnss-share.service
UID=[not set]
GID=[not set]
User=
Group=
1 Like