gpsd-dev
[Top][All Lists]
Advanced

[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

Gary,

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

On Sun, 08 Jan 2023 16:26:57 -0800 "Gary E. Miller" <gem@rellim.com> wrote:
> > 
> > > > +    } else if (str_starts_with(session->gpsdata.dev.path,
> > > > "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:

$PSTMCPU,60.50,-1,49*4C
$GPRMC,xxxxx,V,xxxx.xxxx,N,xxxxx.xxxx,W,0.0,0.0,090123,,,N*6A
$GPGGA,xxxxxx,xxxx.xxxxx,N,xxxx.xxxxxx,W,0,00,99.0,025.15,M,0.0,M,,*7B
$GPVTG,0.0,T,,M,0.0,N,0.0,K,N*02
$GNGSA,A,1,,,,,,,,,,,,,99.0,99.0,99.0*1E
$GNGSA,A,1,,,,,,,,,,,,,99.0,99.0,99.0*1E
$GPGSV,3,1,12,29,81,004,,02,79,315,,05,59,088,,18,39,255,*7D
$GPGSV,3,2,12,25,36,189,,20,34,052,,26,25,311,,12,15,166,*7D
$GPGSV,3,3,12,11,13,062,,31,09,268,,15,06,142,,23,06,201,*7A
$GLGSV,3,1,10,84,52,307,,83,43,054,,74,42,268,,74,42,268,*64
$GLGSV,3,2,10,68,38,094,,67,24,036,,73,23,216,,75,21,329,*66
$GLGSV,3,3,10,69,16,146,,82,06,078,,,,,,,,,*6C
$GPGLL,xxxx.xxxxx,N,xxxx.xxxx,W,xxxxxx,V,N*54

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

Hope this helps clarify things a bit!

-Clayton

Attachment: signature.asc
Description: PGP signature


reply via email to

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