OPNsense Forum

English Forums => General Discussion => Topic started by: siga75 on January 18, 2020, 11:10:36 am

Title: gpsd
Post by: siga75 on January 18, 2020, 11:10:36 am
does OPNsense use gpsd for GPS timing? I see the package is not installed and not in the repo

root@myfw:/usr/ports/astro/gpsd # pkg install gpsd
Updating OPNsense repository catalogue...
OPNsense repository is up to date.
Updating SunnyValley repository catalogue...
SunnyValley repository is up to date.
All repositories are up to date.
pkg: No packages available to install matching 'gpsd' have been found in the repositories


Anyway I found this, which does not come from a package:
root@myfw:/usr/ports/astro/gpsd # cat distinfo
TIMESTAMP = 1516146278
SHA256 (gpsd-3.17.tar.gz) = 68e0dbecfb5831997f8b3d6ba48aed812eb465d8c0089420ab68f9ce4d85e77a
SIZE (gpsd-3.17.tar.gz) = 8755304
root@myfw:/usr/ports/astro/gpsd # pkg info|grep gps
root@myfw:/usr/ports/astro/gpsd #

root@myfw:/usr/ports/astro/gpsd # pkg which /usr/ports/astro/gpsd/distinfo
/usr/ports/astro/gpsd/distinfo was not found in the database

Also with a ps aux I can't find a gps daemon, so how does it works?

I just ordered a u-blox zed-f9t and would like to know if gpsd 3.19 (or 3.20) will be part of the 20.1 release



Title: Re: gpsd
Post by: fabian on January 18, 2020, 11:56:30 am
You found the build instruction so you can run make install in that directory to install it. Since you are the first one who asked that, I think there is no port request yet. Since it is supported by ntp I think it is accessing the device natively.
Title: Re: gpsd
Post by: siga75 on January 18, 2020, 12:27:05 pm
thanks a lot Fabian, you are, as always, really helpful :)

Do you mean current GPS timing is supported natively by OPNsense without that daemon? Because I connected an older module and it works...
Title: Re: gpsd
Post by: fabian on January 18, 2020, 12:36:00 pm
I think it is natively supported by ntp daemon. Modern ublox devices should support nmea output so you may try it out to switch it to nmea mode and run ntpd afterwards. At least it would be an explanation why it would not work (ublox also has a vendor specific binary protocol)
Title: Re: gpsd
Post by: siga75 on January 18, 2020, 03:55:23 pm
I played a lot with NTP and GPS and I never realized NTP could directly access NMEA sentences via pseudo IP 127.127.20.0, I was sure gpsd was involved in the process of "translate" NMEA for NTP

Thanks for this

Since I want PPP (Precise Point Positioning) in order to put the receiver in stationary mode, I will need to be able to read raw data, so I will manually compile that gpsd. It looks like with the zed-f9t I can achieve less that 1cm accuracy, which is quite impressive

https://gpsd.gitlab.io/gpsd/ppp-howto.html

Title: Re: gpsd
Post by: siga75 on January 26, 2020, 08:12:38 pm
I just installed the new module :)

Too bad it's not possible to compile that gpsd, some binaries requires python2 and some python3, I should invest more time, but it's old version in any case (3.17), so I downloaded 3.20 for freeBSD from git and compiled, I just got a warning for missing pyserial.

In fact some function need it

[root@myfw /usr/ports/astro/gpsd.new]# ./ubxtool -s 38400 -f /dev/cuau1
ubxtool: failed to import pyserial

From a quick search it's available for freeBSD 12, I don't know if it will be for HardenedBSD

Any advice?
Title: Re: gpsd
Post by: fabian on January 26, 2020, 09:16:52 pm
At least gpsd should be complilabe using some flags to compile only the binary but ignore the python bindings. If you want them, you can also install that library using pip to make your script working. There may also exist as a pkg build file to install that package.
Title: Re: gpsd
Post by: siga75 on January 27, 2020, 07:03:38 am
Gpsd works on 3.20 I downloaded, but I need ubxtool too (part of the gpsd "suite") to correctly set the receiver. I didn't find pip package nor pyserial as a package.

EDIT: maybe I could just download the module and place it in /usr/local/lib/python3.7, I will give a try
I wanted to avoid to make too many manual stuff since it's less maintainable
Title: Re: gpsd
Post by: aimdev on February 11, 2020, 06:48:05 pm
I think it is natively supported by ntp daemon. Modern ublox devices should support nmea output so you may try it out to switch it to nmea mode and run ntpd afterwards. At least it would be an explanation why it would not work (ublox also has a vendor specific binary protocol)

UBLOX-M8 is working on my system, running latest version of opnsense, using the ublox option which sends the correct nmea to set it up. Device is cuaU0, on a usb3 port, speed 9600bps.
Gpsd support for UBLOX binary mode was not very well supported when I last tried to use it, ie if you want it then do it yourself.

Title: Re: gpsd
Post by: siga75 on February 12, 2020, 05:20:06 pm
u-blox since gpsd 3.19 is the best supported device, they dedicated a command (ubxtool) for that, using this command you can specify very detailed stuff, for example you can setup position fix mode (as a GPS for NTP should be) with:

ubxtool -P 29 -z CFG-TMODE-HEIGHT,xx901
ubxtool -P 29 -z CFG-TMODE-LAT,xx9713229
ubxtool -P 29 -z CFG-TMODE-LON,xx831022
ubxtool -P 29 -z CFG-TMODE-MODE,2
ubxtool -P 29 -z CFG-TMODE-POS_TYPE,1

enable/disable GNSS type:
ubxtool -P 29 -d GLONASS
ubxtool -P 29 -e GPS
ubxtool -P 29 -e GALILEO

disable NMEA and enable raw mode:
ubxtool -P 29 -d NMEA
ubxtool -P 29 -e BINARY
ubxtool -P 29 -e RAWX

I use it on some raspberry devices and it works like a charm

PS: the use of USB for timing purpose is highly discouraged


Title: Re: gpsd
Post by: aimdev on February 12, 2020, 05:41:32 pm
@siga75

Hi

Will give it another try sometime, perhaps there has been a change of programmers with a better attitude.
Re gps and usb, yes I know it is not the best approach as there is no PPS, but its purely a backup if the internet fails and there is no ntp service.