[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC] get gpsd to work with gnss-share

From: Clayton Craft
Subject: Re: [RFC] get gpsd to work with gnss-share
Date: Sun, 8 Jan 2023 22:44:20 -0800


Hello from west of the Cascades, author of gnss-share here :)

On Sun, 08 Jan 2023 16:26:57 -0800 "Gary E. Miller" <> wrote:
> > 
> > > > +    } else if (str_starts_with(session->,
> > > > "unix://")) {  
> > > 
> > > What would a sample unix:// URL look like?  
> > 
> > It is used like this:
> > 
> > sudo gpsd-3.22/gpsd/gpsd -D 9 -N unix:///var/run/gnss-share.sock
> Running gpsd under sudo is suboptimal.  Run as root.
> Not under your control, but /var/run has been deprecated a while.

The socket can be created anywhere, it's configurable. Some distros symlink
/run --> /var/run, and my excuse is that old habits die hard :)

> Why no -n?
> Any doc on that socket?

It's currently RO, gnss-share ignores any writes to it. This might change in the
future, but currently gnss-share controls the underlying device if, e.g., a-gps
needs to be uploaded or whatever. gnss-share can be controlled at runtime by
using signals.

What gnss-share does is open some underlying gnss device (e.g. connected over
serial) and just passes through any data from it directly to the socket. The
real value in gnss-share is that it can perform any arbitrary setup for specific
devices, or interrupt them to do things like load a-gps, etc. It also supports
any number of clients connected to the socket at once all receiving the same
unaltered data from the module.

I know that for the Librem 5, gpsd is capable of "using" the data from it's gps
module as-is. A couple of years ago I was using gpsd on the L5, and it was fine,
but decided to make gnss-share to allow for loading/storing a-gps -related data,
and doing other things to improve lock times, as well as supporting concurrent
clients from things like geoclue and others.

So in theory if gpsd could connect to the gnss-share socket, it should be able
to use the data from it, at least for the L5's gnss module.

> > > Why did the current gpsd/android not need to do this?  
> > 
> > I'm not familiar with Android, but I'm pretty sure they are not using
> > gnss-share.
> So you are not on Android?  I guess I am lost...

No, this is postmarketOS, but there are other Linux distros (so far I know of
PureOS too) that are not Android that also use gnss-share.

> > > Got any doc on what this scoket looks like?  
> > 
> > It carries usual NMEA data. It is very similar to TCP socket, but it
> > uses filename, not IP+port number. That way, filesystem permissions
> > can be used to limit who can see the NMEA data.
> If it is NMEA, can you just open it like a file?  Can gpsd also write to
> it?

It's a unix socket that gnss-share echo's data that it receives from some
underlying serial connection to the actual GNSS module.

> No such thing as "usual NMEA", just look at the GPSD regressions for
> a small sample of the huge variations possible.
> Where is it documented.

Here's a sample of the set of sentences that are 1) written to the serial
connection by the GNSS device every 1 second, and 2) echo'd without modification
to the unix socket by gnss-share:


(I tried to obfuscate it for obvious reasons, but hopefully you get the idea)

Hope this helps clarify things a bit!


Attachment: signature.asc
Description: PGP signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]