Browse Source

New upstream version 3.20

master
Bernd Zeimetz 4 years ago
parent
commit
81257aeeaf
  1. 89
      .ci-build/build.sh
  2. 24
      .ci-build/test_options.sh
  3. 162
      .gitlab-ci.yml
  4. 11
      .travis.yml
  5. 41
      .travis/build.sh
  6. 18
      Android.bp
  7. 217
      INSTALL.adoc
  8. 34
      NEWS
  9. 6
      Qgpsmm.pc.in
  10. 38
      README.adoc
  11. 517
      SConstruct
  12. 3
      TODO
  13. 6
      android/gpsd_config.in
  14. 115
      build.adoc
  15. 270
      cgps.c
  16. 33
      compiler.h
  17. 85187
      contrib/ais-samples/ais-nmea-sample.log
  18. 167714
      contrib/ais-samples/ais-nmea-sample.log.chk
  19. 32
      contrib/appamor/README.md
  20. 68
      contrib/appamor/usr.sbin.gpsd
  21. 4
      contrib/ashctl.c
  22. 4
      contrib/binlog.c
  23. 12
      contrib/binreplay.c
  24. 9
      contrib/gpsData.py
  25. 14
      contrib/maxsats.pl
  26. 4
      contrib/motosend.c
  27. 98
      contrib/ntpshmviz
  28. 14
      contrib/skyview.php
  29. 2
      contrib/skyview2svg
  30. 2
      contrib/webgps.py
  31. 6
      dbusexport.c
  32. 36
      devtools/aivdmtable
  33. 50
      devtools/cycle_analyzer
  34. 33
      devtools/get_geoid_table.py
  35. 34
      devtools/get_mag_var_table.py
  36. 66
      devtools/regress-builder
  37. 70
      devtools/regressdiff
  38. 5
      devtools/sizes
  39. 13
      devtools/striplog
  40. 15
      do-clean
  41. 2
      doc/explan_driver_nmea.c.xml
  42. 6
      doc/explan_geoid.c.xml
  43. 2
      doc/explan_gpsd_log.c.xml
  44. 21
      doc/explan_gpsutils.c.xml
  45. 2
      doc/explan_libgpsd_core.c.xml
  46. 2
      doc/explan_serial.c.xml
  47. 39
      doc/explan_timebase.h.xml
  48. 2
      doc/internals.xml
  49. 501
      driver_ais.c
  50. 300
      driver_evermore.c
  51. 542
      driver_garmin.c
  52. 112
      driver_garmin_txt.c
  53. 136
      driver_geostar.c
  54. 195
      driver_greis.c
  55. 410
      driver_italk.c
  56. 229
      driver_navcom.c
  57. 2949
      driver_nmea0183.c
  58. 184
      driver_nmea2000.c
  59. 178
      driver_oncore.c
  60. 50
      driver_proto.c
  61. 1588
      driver_rtcm2.c
  62. 918
      driver_rtcm3.c
  63. 2088
      driver_sirf.c
  64. 91
      driver_skytraq.c
  65. 88
      driver_superstar2.c
  66. 4344
      driver_tsip.c
  67. 2179
      driver_ubx.c
  68. 76
      driver_zodiac.c
  69. 210
      drivers.c
  70. 115
      example_aiogps.py
  71. 26
      example_aiogps_run
  72. 2
      gegps
  73. 1031
      geoid.c
  74. 252
      gps.h
  75. 2
      gps/__init__.py
  76. 308
      gps/aiogps.py
  77. 1
      gps/client.py
  78. 904
      gps/clienthelpers.py
  79. 40
      gps/fake.py
  80. 61
      gps/gps.py
  81. 24
      gps/misc.py
  82. 8
      gps2udp.c
  83. 2
      gps_maskdump.c
  84. 3
      gpscap.py
  85. 2
      gpscat
  86. 119
      gpsclient.c
  87. 131
      gpsctl.c
  88. 623
      gpsd.c
  89. 171
      gpsd.h
  90. 13
      gpsd.php
  91. 13
      gpsd.php.in
  92. 61
      gpsd_config.h
  93. 393
      gpsd_json.c
  94. 295
      gpsdclient.c
  95. 1
      gpsdclient.h
  96. 5
      gpsfake
  97. 104
      gpsmon.c
  98. 4
      gpsmon.h
  99. 8
      gpspacket.c
  100. 12
      gpspipe.c

89
.ci-build/build.sh

@ -0,0 +1,89 @@
#!/usr/bin/env bash
set -e
set -x
export PATH=/usr/sbin:/usr/bin:/sbin:/bin
if uname -a | grep -qi freebsd; then
export PATH="${PATH}:/usr/local/bin:/usr/local/sbin"
fi
if [ "${USE_CCACHE}" = "true" ] && [ -n "${CCACHE_DIR}" ] && command -v ccache >/dev/null; then
if [ -d "/usr/lib64/ccache" ]; then
# fedora
export PATH="/usr/lib64/ccache:${PATH}"
elif [ -d "/usr/local/libexec/ccache/" ]; then
# freebsd
export PATH="/usr/local/libexec/ccache:${PATH}"
else
# debian, .....
export PATH="/usr/lib/ccache:${PATH}"
fi
mkdir -p "${CCACHE_DIR}"
echo 'max_size = 100M' > "${CCACHE_DIR}/ccache.conf"
else
export USE_CCACHE="false"
fi
if command -v lsb_release >/dev/null && lsb_release -d | grep -qi -e debian -e ubuntu; then
eval "$(dpkg-buildflags --export=sh)"
export DEB_HOST_MULTIARCH=$(dpkg-architecture -qDEB_HOST_MULTIARCH)
export PYTHONS="$(pyversions -v -r '>= 2.3'; py3versions -v -r '>= 3.4')"
SCONSOPTS="${SCONSOPTS} libdir=/usr/lib/${DEB_HOST_MULTIARCH}"
else
SCONSOPTS="${SCONSOPTS} libdir=/usr/lib"
fi
SCONSOPTS="${SCONSOPTS} $@ prefix=/usr"
SCONSOPTS="${SCONSOPTS} systemd=yes"
SCONSOPTS="${SCONSOPTS} nostrip=yes"
SCONSOPTS="${SCONSOPTS} dbus_export=yes"
SCONSOPTS="${SCONSOPTS} docdir=/usr/share/doc/gpsd"
SCONSOPTS="${SCONSOPTS} gpsd_user=gpsd"
SCONSOPTS="${SCONSOPTS} gpsd_group=dialout"
SCONSOPTS="${SCONSOPTS} debug=yes"
SCONSOPTS="${SCONSOPTS} qt_versioned=5"
export SCONS=$(command -v scons)
if command -v nproc >/dev/null; then
NPROC=$(nproc)
SCONS_PARALLEL="-j ${NPROC} "
if [ "${SLOW_CHECK}" != "yes" ]; then
CHECK_NPROC=$(( 4 * ${NPROC} ))
SCONS_CHECK_PARALLEL="-j ${CHECK_NPROC} "
else
SCONS_CHECK_PARALLEL="${SCONS_PARALLEL}"
fi
else
SCONS_PARALLEL=""
SCONS_CHECK_PARALLEL=""
fi
export SCONSOPTS
if [ -z "$PYTHONS" ]; then
export PYTHONS="3"
fi
if [ -n "${SCAN_BUILD}" ]; then
export PYTHONS="3"
fi
for py in $PYTHONS; do
_SCONS="${SCONS} target_python=python${py}"
python${py} ${_SCONS} ${SCONSOPTS} --clean
rm -f .sconsign.*.dblite
${SCAN_BUILD} python${py} ${_SCONS} ${SCONS_PARALLEL}${SCONSOPTS} build-all
if [ -z "${NOCHECK}" ]; then
python${py} ${_SCONS} ${SCONS_CHECK_PARALLEL}${SCONSOPTS} check
fi
done
if [ "${USE_CCACHE}" = "true" ]; then
ccache -s
fi

24
.ci-build/test_options.sh

@ -0,0 +1,24 @@
#!/bin/bash
set -e
set -x
apt -y install ccache
PATH=/usr/sbin:/usr/bin:/sbin:/bin
export PATH="/usr/lib/ccache:$PATH"
if which nproc >/dev/null; then
SCONS_PARALLEL="-j $(nproc) "
else
SCONS_PARALLEL=""
fi
(
scons --help | grep -B1 'default: True' | grep 'yes|no' | sed 's,:.*,=no,' | grep -v '^gpsd$'
scons --help | grep -B1 'default: False' | grep 'yes|no' | sed 's,:.*,=yes,'
) | while read option; do
scons --clean
rm -f .sconsign.*.dblite
scons ${SCONS_PARALLEL}${option} build
done

162
.gitlab-ci.yml

@ -1,14 +1,166 @@
image: alpine:latest
cache:
key: "${CI_JOB_NAME}"
paths:
- .ccache/
variables:
USE_CCACHE: "true"
CCACHE_BASEDIR: "${CI_PROJECT_DIR}"
CCACHE_DIR: "${CI_PROJECT_DIR}/.ccache"
CCACHE_COMPILERCHECK: "content"
DEBIAN_FRONTEND: 'noninteractive'
stages:
- build
- advanced_build
- test
.debian_build: &debian_build
script:
- apt update && apt -y install --no-install-recommends eatmydata
- eatmydata -- apt -y install --no-install-recommends ${PACKAGES}
- eatmydata -- .ci-build/build.sh
debian-stable:
image: debian:latest
stage: build
variables:
SCONSOPTS: 'qt=yes xgps=yes'
PACKAGES: 'build-essential ccache debhelper po-debconf python3-all-dev python3-all-dbg python-all-dev python-all-dbg xsltproc docbook-xsl docbook-xml asciidoc libncurses-dev libusb-1.0-0-dev libdbus-1-dev libglib2.0-dev makedev libbluetooth-dev libqt4-dev lsb-release bc dpkg-dev scons chrpath dh-buildinfo pps-tools dh-systemd python-serial'
<<: *debian_build
debian-unstable:gcc:
image: debian:unstable
stage: advanced_build
variables:
SCONSOPTS: 'qt=yes xgps=yes'
PACKAGES: 'build-essential ccache debhelper po-debconf python3-all-dev python3-all-dbg python-all-dev python-all-dbg xsltproc docbook-xsl docbook-xml asciidoc libncurses-dev libusb-1.0-0-dev libdbus-1-dev libglib2.0-dev makedev libbluetooth-dev libqt4-dev lsb-release bc dpkg-dev scons chrpath dh-buildinfo pps-tools dh-systemd python-serial'
<<: *debian_build
debian-unstable:clang:
image: debian:unstable
stage: advanced_build
variables:
SCONSOPTS: 'qt=yes xgps=yes'
CC: 'clang'
CXX: 'clang++'
PACKAGES: 'clang build-essential ccache debhelper po-debconf python3-all-dev python3-all-dbg python-all-dev python-all-dbg xsltproc docbook-xsl docbook-xml asciidoc libncurses-dev libusb-1.0-0-dev libdbus-1-dev libglib2.0-dev makedev libbluetooth-dev libqt4-dev lsb-release bc dpkg-dev scons chrpath dh-buildinfo pps-tools dh-systemd python-serial'
<<: *debian_build
debian-unstable:minimal:
image: debian:unstable
stage: advanced_build
variables:
SCONSOPTS: 'aivdm=no ashtech=no bluez=no control_socket=no controlsend=no coveraging=no dbus_export=no debug=no earthmate=no evermore=no force_global=no fury=no fv18=no garmin=no garmintxt=no geostar=no gpsclock=no gpsdclients=no greis=no implicit_link=no isync=no itrax=no leapfetch=no libgpsmm=no magic_hat=no manbuild=no minimal=no mtk3301=no navcom=no ncurses=no netfeed=no nmea0183=no nmea2000=no nostrip=no ntrip=no oceanserver=no oncore=no oscillator=no passthrough=no profiling=no python=no qt=no reconfigure=no rtcm104v2=no rtcm104v3=no shared=no shm_export=no sirf=no skytraq=no slow=no socket_export=yes squelch=no superstar2=no systemd=no timeservice=no tnt=no tripmate=no tsip=no ublox=no usb=no xgps=no'
NOCHECK: 'true'
PACKAGES: 'build-essential ccache scons chrpath lsb-release python3-all-dev'
<<: *debian_build
# the latest tag should match the last Ubuntu LTS release.
ubuntu-latest:gcc:
image: ubuntu:latest
stage: advanced_build
variables:
SCONSOPTS: 'qt=yes xgps=yes'
PACKAGES: 'build-essential ccache debhelper po-debconf python3-all-dev python3-all-dbg python-all-dev python-all-dbg xsltproc docbook-xsl docbook-xml asciidoc libncurses-dev libusb-1.0-0-dev libdbus-1-dev libglib2.0-dev makedev libbluetooth-dev libqt4-dev lsb-release bc dpkg-dev scons chrpath dh-buildinfo pps-tools dh-systemd python-serial'
before_script:
- apt update && apt -y install scons
- sed -i "s/os.environ.has_key('DH_INTERNAL_OPTIONS')/'DH_INTERNAL_OPTIONS' in os.environ/" /usr/lib/scons/SCons/Script/Main.py
<<: *debian_build
# the "rolling" release
ubuntu-rolling:gcc:
image: ubuntu:rolling
stage: advanced_build
variables:
SCONSOPTS: 'qt=yes xgps=yes'
PACKAGES: 'build-essential ccache debhelper po-debconf python3-all-dev python3-all-dbg python-all-dev python-all-dbg xsltproc docbook-xsl docbook-xml asciidoc libncurses-dev libusb-1.0-0-dev libdbus-1-dev libglib2.0-dev makedev libbluetooth-dev libqt4-dev lsb-release bc dpkg-dev scons chrpath dh-buildinfo pps-tools dh-systemd python-serial'
<<: *debian_build
# the devel tag should point to the docker image of the next, upcoming Ubuntu release
ubuntu-devel:gcc:
image: ubuntu:devel
stage: advanced_build
variables:
SCONSOPTS: 'qt=yes xgps=yes'
PACKAGES: 'build-essential ccache debhelper po-debconf python3-all-dev python3-all-dbg python-all-dev python-all-dbg xsltproc docbook-xsl docbook-xml asciidoc libncurses-dev libusb-1.0-0-dev libdbus-1-dev libglib2.0-dev makedev libbluetooth-dev libqt4-dev lsb-release bc dpkg-dev scons chrpath dh-buildinfo pps-tools dh-systemd python-serial'
<<: *debian_build
fedora-latest:
image: fedora:latest
stage: advanced_build
variables:
SCONSOPTS: 'qt=yes xgps=yes'
script:
- dnf install -y ccache diffutils bluez-libs-devel chrpath dbus-devel desktop-file-utils gcc-c++ libXaw-devel ncurses-devel python-devel qt-devel scons xmlto pps-tools-devel
- .ci-build/build.sh
freebsd:
stage: advanced_build
variables:
WRITE_PAD: '0.01250'
tags:
- freebsd
script:
- .ci-build/build.sh
scan-build:
allow_failure: true
image: debian:unstable
stage: test
needs: ["debian-unstable:gcc"]
variables:
SCONSOPTS: 'qt=yes xgps=yes'
SCAN_BUILD: 'scan-build -o scan_build'
PACKAGES: 'clang clang-tools build-essential debhelper po-debconf python3-all-dev python3-all-dbg python-all-dev python-all-dbg xsltproc docbook-xsl docbook-xml asciidoc libncurses-dev libusb-1.0-0-dev libdbus-1-dev libglib2.0-dev makedev libbluetooth-dev libqt4-dev lsb-release bc dpkg-dev scons chrpath dh-buildinfo pps-tools dh-systemd python-serial'
artifacts:
paths:
- scan_build
expire_in: 1 week
<<: *debian_build
# as long as sconstruct has so many options, this does not make sense
# needs a better / faster way to test
#
#test-options:
# image: debian:unstable
# stage: test
# needs: ["debian-unstable:gcc"]
# variables:
# DEBIAN_FRONTEND: 'noninteractive'
# when: manual
# script:
# - apt update && apt -y install build-essential debhelper po-debconf python3-all-dev python3-all-dbg python-all-dev python-all-dbg xsltproc docbook-xsl docbook-xml asciidoc libncurses-dev libusb-1.0-0-dev libdbus-1-dev libglib2.0-dev makedev libbluetooth-dev libqt4-dev lsb-release bc dpkg-dev scons chrpath dh-buildinfo pps-tools dh-systemd python-serial
# - .ci-build/test_options.sh
#
.changes_pages: &changes_pages
changes:
- 'www/*'
- 'www/*/*'
- '*.adoc'
.should_build_pages: &should_build_pages
only:
refs:
- master
<<: *changes_pages
pages:
stage: deploy
image: alpine:latest
stage: build
script:
- apk update && apk add python xmlto asciidoc scons rsync
- apk update && apk add python xmlto asciidoc scons rsync musl-dev gcc
- mkdir .pages; WEBSITE=.public scons website=.pages website; mv .public public
- find public -type f -regex '.*\.\(htm\|html\|txt\|text\|js\|css\)$' -exec gzip -f -k {} \;
- ls -lR public
artifacts:
paths:
- public
only:
- master
<<: *should_build_pages

11
.travis.yml

@ -1,15 +1,18 @@
sudo: required
language: generic
## The used .ci-build/build.sh is maintained for the gitlab CI.
## Please upadte the travis yaml file if necessary
# Some versions of clang++ don't work with some C++ headers, due to an
# issue with __float128. Until this is reproducible in a more debuggable
# context, we disable the C++ builds in the clang case.
env:
- TRAVIS_DEBIAN_DISTRIBUTION=unstable TRAVIS_DEBIAN_BUILD_COMMAND="/bin/bash .travis/build.sh" TRAVIS_DEBIAN_BUILD_DEPENDENCIES="build-essential debhelper po-debconf python-all-dev python-all-dbg xsltproc docbook-xsl docbook-xml asciidoc libncurses-dev libusb-1.0-0-dev libdbus-1-dev libglib2.0-dev makedev libbluetooth-dev qtbase5-dev qt5-default lsb-release bc dpkg-dev scons chrpath dh-buildinfo pps-tools dh-systemd python-serial"
- TRAVIS_DEBIAN_DISTRIBUTION=unstable TRAVIS_DEBIAN_BUILD_COMMAND="/bin/bash .travis/build.sh" TRAVIS_DEBIAN_BUILD_DEPENDENCIES="build-essential debhelper po-debconf python-all-dev python-all-dbg xsltproc docbook-xsl docbook-xml asciidoc libncurses-dev libusb-1.0-0-dev libdbus-1-dev libglib2.0-dev makedev libbluetooth-dev libqt4-dev lsb-release bc dpkg-dev scons chrpath dh-buildinfo pps-tools dh-systemd python-serial"
- TRAVIS_DEBIAN_DISTRIBUTION=unstable TRAVIS_DEBIAN_BUILD_COMMAND="/bin/bash .travis/build.sh libgpsmm=no qt=no" TRAVIS_DEBIAN_BUILD_DEPENDENCIES="build-essential debhelper po-debconf python-all-dev python-all-dbg xsltproc docbook-xsl docbook-xml asciidoc libncurses-dev libusb-1.0-0-dev libdbus-1-dev libglib2.0-dev makedev libbluetooth-dev libqt4-dev lsb-release bc dpkg-dev scons chrpath dh-buildinfo pps-tools dh-systemd clang python-serial" TRAVIS_DEBIAN_BUILD_ENVIRONMENT="CC=clang CXX=clang++"
- TRAVIS_DEBIAN_DISTRIBUTION=stable TRAVIS_DEBIAN_BUILD_COMMAND="/bin/bash .travis/build.sh" TRAVIS_DEBIAN_BUILD_DEPENDENCIES="build-essential debhelper po-debconf python-all-dev python-all-dbg xsltproc docbook-xsl docbook-xml asciidoc libncurses-dev libusb-1.0-0-dev libdbus-1-dev libglib2.0-dev makedev libbluetooth-dev libqt4-dev lsb-release bc dpkg-dev scons chrpath dh-buildinfo pps-tools dh-systemd python-serial"
- TRAVIS_DEBIAN_DISTRIBUTION=unstable TRAVIS_DEBIAN_BUILD_COMMAND="/bin/bash .ci-build/build.sh" TRAVIS_DEBIAN_BUILD_DEPENDENCIES="build-essential debhelper po-debconf python-all-dev python-all-dbg xsltproc docbook-xsl docbook-xml asciidoc libncurses-dev libusb-1.0-0-dev libdbus-1-dev libglib2.0-dev makedev libbluetooth-dev qtbase5-dev qt5-default lsb-release bc dpkg-dev scons chrpath dh-buildinfo pps-tools dh-systemd python-serial"
- TRAVIS_DEBIAN_DISTRIBUTION=unstable TRAVIS_DEBIAN_BUILD_COMMAND="/bin/bash .ci-build/build.sh" TRAVIS_DEBIAN_BUILD_DEPENDENCIES="build-essential debhelper po-debconf python-all-dev python-all-dbg xsltproc docbook-xsl docbook-xml asciidoc libncurses-dev libusb-1.0-0-dev libdbus-1-dev libglib2.0-dev makedev libbluetooth-dev libqt4-dev lsb-release bc dpkg-dev scons chrpath dh-buildinfo pps-tools dh-systemd python-serial"
- TRAVIS_DEBIAN_DISTRIBUTION=unstable TRAVIS_DEBIAN_BUILD_COMMAND="/bin/bash .ci-build/build.sh libgpsmm=no qt=no" TRAVIS_DEBIAN_BUILD_DEPENDENCIES="build-essential debhelper po-debconf python-all-dev python-all-dbg xsltproc docbook-xsl docbook-xml asciidoc libncurses-dev libusb-1.0-0-dev libdbus-1-dev libglib2.0-dev makedev libbluetooth-dev libqt4-dev lsb-release bc dpkg-dev scons chrpath dh-buildinfo pps-tools dh-systemd clang python-serial" TRAVIS_DEBIAN_BUILD_ENVIRONMENT="CC=clang CXX=clang++"
- TRAVIS_DEBIAN_DISTRIBUTION=stable TRAVIS_DEBIAN_BUILD_COMMAND="/bin/bash .ci-build/build.sh" TRAVIS_DEBIAN_BUILD_DEPENDENCIES="build-essential debhelper po-debconf python-all-dev python-all-dbg xsltproc docbook-xsl docbook-xml asciidoc libncurses-dev libusb-1.0-0-dev libdbus-1-dev libglib2.0-dev makedev libbluetooth-dev libqt4-dev lsb-release bc dpkg-dev scons chrpath dh-buildinfo pps-tools dh-systemd python-serial"
services:
- docker

41
.travis/build.sh

@ -1,41 +0,0 @@
#!/bin/bash
set -e
set -x
export PATH=/usr/sbin:/usr/bin:/sbin:/bin
eval "$(dpkg-buildflags --export=sh)"
export DEB_HOST_MULTIARCH=$(dpkg-architecture -qDEB_HOST_MULTIARCH)
SCONSOPTS="$@ prefix=/usr"
SCONSOPTS="${SCONSOPTS} systemd=yes"
SCONSOPTS="${SCONSOPTS} nostrip=yes"
SCONSOPTS="${SCONSOPTS} dbus_export=yes"
SCONSOPTS="${SCONSOPTS} docdir=/usr/share/doc/gpsd"
SCONSOPTS="${SCONSOPTS} libdir=/usr/lib/${DEB_HOST_MULTIARCH}"
SCONSOPTS="${SCONSOPTS} gpsd_user=gpsd"
SCONSOPTS="${SCONSOPTS} gpsd_group=dialout"
SCONSOPTS="${SCONSOPTS} debug=yes"
### SCONSOPTS="${SCONSOPTS} qt=yes" # The default qt=yes must be overridable
SCONSOPTS="${SCONSOPTS} xgps=no" # Until we figure out the right Gtk3 packages
if dpkg -s qtbase5-dev 1>/dev/null 2>&1; then
SCONSOPTS="${SCONSOPTS} qt_versioned=5"
fi
export SCONSOPTS
export PYTHONS="$(pyversions -v -r '>= 2.3')"
if [ "$PYTHONS" = "" ]; then
export PYTHONS="2"
fi
for py in $PYTHONS; do
python${py} /usr/bin/scons ${SCONSOPTS}
python${py}-dbg /usr/bin/scons ${SCONSOPTS}
done
/usr/bin/scons build-all www check

18
Android.bp

@ -24,7 +24,6 @@ cc_binary {
vendor: true,
required: ["gpsd_wrapper"],
generated_headers: [
"gpsd_timebase_h",
"gpsd_revision_h",
"gpsd_config_h",
"gpsd_packet_names_h"
@ -62,7 +61,6 @@ cc_library_shared {
vendor: true,
export_include_dirs: ["."],
generated_headers: [
"gpsd_timebase_h",
"gpsd_revision_h",
"gpsd_config_h",
"gpsd_packet_names_h"
@ -97,7 +95,6 @@ cc_library_static {
vendor: true,
export_include_dirs: ["."],
generated_headers: [
"gpsd_timebase_h",
"gpsd_revision_h",
"gpsd_config_h",
"gpsd_packet_names_h"
@ -153,20 +150,6 @@ genrule {
out: ["revision.h"]
}
python_binary_host {
name: "leapsecond",
main: "leapsecond.py",
srcs: ["leapsecond.py"],
}
genrule {
name: "gpsd_timebase_h",
tools: ["leapsecond"],
cmd: "$(location leapsecond) -H $(in) > $(out)",
srcs: ["leapseconds.cache"],
out: ["timebase.h"]
}
python_binary_host {
name: "maskaudit",
main: "maskaudit.py",
@ -186,7 +169,6 @@ cc_library_static {
vendor: true,
export_include_dirs: ["."],
generated_headers: [
"gpsd_timebase_h",
"gpsd_revision_h",
"gpsd_config_h",
"gpsd_packet_names_h"

217
INSTALL → INSTALL.adoc

@ -9,7 +9,7 @@ Here are the steps for installing GPSD and verifying its performance.
They assume you have GPSD available as an installable binary package,
Instructions for building GPSD from source (including cross-building)
are in the file "build.txt" in the source distribution.
are in the file "build.adoc" in the source distribution.
Most of these installation instructions are generic to Linux (inc
There are some special notes on installation for OS X and the Raspberry Pi
@ -44,7 +44,7 @@ adapter chips found in GPSes require specific drivers.
Under a stock Linux kernel these will all be loaded on demand when
the USB system sees the appropriate vendor/product ID combinations.
See build.txt for instructions relating to custom kernels.
See build.adoc for instructions relating to custom kernels.
== Check that your system configuration will allow GPSD to work ==
@ -88,20 +88,34 @@ absolutely needs is the C runtime support. The test clients and
various additional features have additional prerequisites:
|===============================================================================
|pthreads library | support for PPS timekeeping on serial GPSes
|DBUS | gpsd will issue DBUS notifications
|ncurses | a test client and the GPS monitor depend on this
|libtinfo5 | shared low-level terminfo library (see below)
|libusb-1.0.x or later | better USB device discovery
|Qt + qmake | libQgpsmm depends on this
|pps-tools | for PPS time keeping
|dbus | gpsd will issue DBUS notifications
|ncurses | for cgps and gpsmon clients
|libtinfo5 | low-level terminfo library (see below)
|libusb-1.0.x or later | for older Garmin USB devices
|Qt | libQgpsmm depends on this
|python2.x(x>=6) or 3.y(y>=2) | required for various clients and utilities
|python-GI bindings | the test clients xgps and xgpsspeed, need this
|PyGObject | for xps and xgpsspeed clients (see below)
|python-cairo | for python-GI
|GTK | for python-GI
|pyserial | for ubxtool and zerk in direct-serial mode
|gnuplot | to plot gpsprof output.
|===============================================================================
Some ncurses packages contain the terminfo library; some break it out
separately as libtinfo5 or libtinfo.
The PyGObject package goes by several names, and is split up into sub
packages different ways, depending on the distribution. Sometimes
python-gi, python-gobject, python-cairo, etc. The packages also need
the underlying system libraries (GTK, GLib, etc.)
The asynchronous python module (gps/aiogps.py) and its example client
(example_aiogps.py) require Python 3.6+.
See below for more specific module requirements in the individual
distribution instructions.
== Installing gpsd ==
=== Install your distributions package(s) ===
@ -122,7 +136,7 @@ repository index for anything with gpsd as a prefix.
=== Install from source code ===
Directions for installing from source are in the file build.txt found
Directions for installing from source are in the file build.adoc found
in the source distribution.
== How to test the software ==
@ -198,6 +212,21 @@ xmlto to build the documentation.
# port install xmlto
--------------------------------------------------------------
Currently the osX port does not work with Qt5. To see the build
failure:
--------------------------------------------------------------
# port install qt5
# scons --config=force qt_versioned=5
--------------------------------------------------------------
If you have Qt5 installed, and want to avoid the build failure, bui.d
this way:
--------------------------------------------------------------
# scons --config=force qt=no
--------------------------------------------------------------
While running gpsd, or scons check, you may run out of shared memory
segments. If so, you will see this error message:
@ -249,24 +278,85 @@ is strongly recommended.
# apt-get install git-core
--------------------------------------------------------------
Git-core is only required to build from a git repository. pps-tools is for
testing PPS inputs.
Git-core is required to build from a git repository. pps-tools is for
PPS timing.
The rest of the installation is just as for any other source based
install, as noted in the file *build.txt* .
install, as noted in the file *build.adoc* .
=== Other Debian derivatives (including stock) ===
==== Jessie ====
==== Buster (10) with python2 ====
--------------------------------------------------------------
# apt-get update
# apt-get dist-upgrade
# reboot
# apt-get install scons libncurses-dev python-dev pps-tools
# apt-get install git-core
# apt-get install build-essential manpages-dev pkg-config
--------------------------------------------------------------
If "apt-get install scons" fails, check the file "/etc/apt/sources.list".
Git-core is required to build from a git repository.
pps-tools is for PPS timing.
Build-essential installs the compiler and associated tools.
Manpages-dev is the associated man pages.
Pkg-config is a helper for scons.
Gtk3 is only required to run xgps and xgpsspeed. You do not need a local
X11 server installed, but it still pulls in a lot of packages.
--------------------------------------------------------------
# apt-get install python-gi-dev python-cairo-dev
# apt-get install python-gobject-dev libgtk-3-dev
--------------------------------------------------------------
Ubxtool and zerk may optionally use the pyserial module for
direct connection to the GNSS receiver:
--------------------------------------------------------------
# apt-get install python-serial
--------------------------------------------------------------
gpsd may optional connect to dbus with the libdbus package:
--------------------------------------------------------------
# apt-get install libdbus-1-dev
--------------------------------------------------------------
Some very old Garmin USB devices need libusb:
--------------------------------------------------------------
# apt-get install libusb-1.0-0-dev
--------------------------------------------------------------
If you wish to build the documentation, be warned it pull in a
lot of packages. To build the doc install:
--------------------------------------------------------------
apt-get install xsltproc docbook-xsl xmlto asciidoc
--------------------------------------------------------------
The rest of the installation is just as for any other source based
install, as noted in the file *build.adoc* .
--------------------------------------------------------------
# git clone https://gitlab.com/gpsd/gpsd.git
# cd gpsd
# scons --config=force && scons install
--------------------------------------------------------------
==== Jessie (8) ====
--------------------------------------------------------------
# apt-get install scons libncurses5-dev python-dev pps-tools
# apt-get install git-core
--------------------------------------------------------------
Git-core is only required to build from a git repository. pps-tools is for
testing PPS inputs.
Git-core is required to build from a git repository. pps-tools is for
PPS timing.
The rest of the installation is just as for any other source based
install, as noted in the file *build.txt* .
install, as noted in the file *build.adoc* .
==== Wheezy ====
@ -327,11 +417,31 @@ and other tools:
# apt-get install git-core
--------------------------------------------------------------
Git-core is only required to build from a git repository. pps-tools is for
testing PPS inputs.
Git-core is required to build from a git repository. pps-tools is for
PPS timing.
The rest of the installation is just as for any other source based
install, as noted in the file *build.txt* .
install, as noted in the file *build.adoc* .
==== Ubuntu 18.04 LTS ====
Preliminary install notes.
--------------------------------------------------------------
apt install gcc scons python-gi python-gi-cairo g++
apt install libncurses5-dev pps-tools
apt install gir1.2-gtk-3.0
--------------------------------------------------------------
If you wish to build the documentation, be warned it pull in a
lot of packages. To build the doc install:
--------------------------------------------------------------
apt install xsltproc docbook-xsl xmlto asciidoc
--------------------------------------------------------------
The rest of the installation is just as for any other source based
install, as noted in the file *build.adoc* .
=== Other Raspberry Pi tips ===
@ -411,22 +521,83 @@ https://learn.adafruit.com/adafruit-ultimate-gps-hat-for-raspberry-pi/
You will need to dig deeper to make the PPS work, here is a good reference:
http://www.satsignal.eu/ntp/Raspberry-Pi-NTP.html
== Special Notes for FreeBSD Installation ==
== BSD derivatives ==
=== Special Notes for FreeBSD Installation ==+
gpsd will build, install and run on FreeBSD.
Due to the missing CAN bus support (linux/can.h), NMEA2000/CAN
is not supporten on FreeBSD.
Use their pkg command to install scons, and optionally git if you
want to access the development source.
If you want to build the QT bindings, you'll also need the
qt5-network and pkgconf packages.
--------------------------------------------------------------
# pkg install scons
# pkg install git
# git clone ssh://git@gitlab.com/gpsd/gpsd.git
# ln -s /usr/local/bin/python2.7 /usr/local/bin/python
# ln -s /usr/local/bin/python2.7 /usr/local/bin/python2
# ln -s /usr/local/bin/python3.6 /usr/local/bin/python3
# git clone https://gitlab.com/gpsd/gpsd.git
# cd gpsd
# scons --config=force && scons install
--------------------------------------------------------------
FreeBSD fails to create the python links as required by PEP394.
So you need to add them yourself, as above.
=== Special Notes for NetBSD 8.1 Installation ===
gpsd will build, install and run on NetBSD.
Use their pkg_add command to install pkgin. Then use pkgin to
install the required tools.
--------------------------------------------------------------
# export PKG_PATH=\
"http://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/amd64/8.1/All"
# pkg_add -v pkgin
# echo http://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/amd64/8.1/All > \
/usr/pkg/etc/pkgin/repositories.conf
# pkgin update
# pkgin install python37 py37-curses
# ln -s /usr/pkg/bin/python3.7 /usr/pkg/bin/python
# ln -s /usr/pkg/bin/python3.7 /usr/pkg/bin/python3
# pkgin install py37-scons
# pkgin install ncurses
# pkgin install openssl mozilla-rootcerts
# mozilla-rootcerts install
# pkgin install git
# git clone https://gitlab.com/gpsd/gpsd.git
# cd gpsd
# scons --config=force && scons install
--------------------------------------------------------------
=== Special Notes for OpenBSD 6.6 Installation ===
gpsd will build, install and run on NetBSD.
All you need for a basic gpsd install is scons and git. Then
create the missing python link.
--------------------------------------------------------------
# pkg_add scons
# pkg_add git
# ln -s /usr/local/bin/python2 /usr/local/bin/python
--------------------------------------------------------------
Then install the normal way.
--------------------------------------------------------------
# git clone https://gitlab.com/gpsd/gpsd.git
# cd gpsd
# scons --config=force && scons install
--------------------------------------------------------------
== Special Notes for CentOS 7 Installation ==
== Special Notes for Fedora derivatives ==
=== Special Notes for CentOS 7 Installation ===
gpsd currently will build, install and run on CentOS 7.

34
NEWS

@ -1,5 +1,35 @@
GPSD project news
3.20: 2019-12-31
Change README into an asciidoc file and publish HTML from it
Add NED and geoid_sep to gps_fix_t and TPV JSON.
Add "-e NED" to ubxtool to enable NED messages.
gpsdata.separation replaced by gpsdata.fix.geoid_sep.
Remove nofloats build option.
TPV JSON "alt" is now fixed at WGS84. Probably.
xgps now uses XGPSOPTS environment variable.
add health variable to satellite_t
change satellite_t elevation and azimuth to double
satellite_t elevation, azimuth, and ss use NAN for unknown value.
add altMSL, altHAE, and depth, to gps_fix_t
altitude in gps_fix_t is deprecated and undefined
wgs84_separation() now return EGM2008 computed from 5x5 degree base data.
The best results are close to cm, the worst off up to 12m.
Move mag_var from gps_device_t to magnetic_var gps_data_t.
Added mag_var() to interpolate magnetic variation (deviation) from a table.
Remove true2magnetic() as mag_var() improves on it.
Remove TIMEHINT_ENABLE. It only worked when enabled.
Remove NTP_ENABLE and NTPSHM_ENABLE. It only worked when enabled.
Remove PPS_ENABLE and TIMING_ENABLE.
Add dgps_age and dgps_station to gps_fix_t
Convert all timestamp_t to timespec_t.
Remove FIXED_PORT_SPEED and FIXED_STOP_BITS build options.
Add -s [speed] and -f [framing] runtime options to gpsd.
A working CC and termios.h are mandatory.
use the current leap second to determine the current GPS epoch.
leapfetch.py, leapseconds.cache, timebase.h and leapfetch option gone.
See also change histories in gps.h and gpsd.h
3.19: 2019-07-01
Rearrange rawdata_t. Bump the API because gps_data_t changed.
Report sequence-ID fields in type 7 and 13 AIS messages.
@ -83,9 +113,9 @@
New HOWTO on the website: "Introduction to Time Service".
3.13: 2015-02-26 (Eric S. Raymond <esr@snark.thyrsus.com>)
compiler.h inclusion removed for gps.h so it's standalone for /usr/include.
compiler.h inclusion removed for gps.h so it's standalone for /usr/include.
TOFF JSON report gives the offset between GPS top of second and clock time.
A new ntpmon tool supports capturing clock samples from NTP SHM segments.
A new ntpmon tool supports capturing clock samples from NTP SHM segments.
3.12: 2015-02-22 (Eric S. Raymond <esr@snark.thyrsus.com>)
The daemon's power utilization has been reduced by changing from

6
Qgpsmm.pc.in

@ -5,9 +5,9 @@ includedir=@includedir@
qt_config=lex yacc warn_on uic resources qt release incremental link_prl def_files_disabled exceptions no_mocdepend stl qt_no_framework create_pc create_prl moc thread dll
Name: Qgpsmm
Description: GPS Daemon communication library - QT binding
Description: GPS Daemon communication library - Qt binding
Version: @VERSION@
Libs: -L${libdir} -lQgpsmm
Libs.private: -L/usr/lib -lQtNetwork -lQtCore -lpthread
Libs.private: -L${libdir} -lQt@QTVERSIONED@Network -lQt@QTVERSIONED@Core -lpthread
Cflags: -I${includedir}
Requires: QtNetwork
Requires: Qt@QTVERSIONED@Network

38
README → README.adoc

@ -1,5 +1,15 @@
gpsd README file
----------------
WARNING
~~~~~~~
The files at https://gitlab.com/gpsd/gpsd/-/tags are NOT the gpsd
release files. DO NOT use them. The release files are at:
http://download-mirror.savannah.gnu.org/releases/gpsd/
GENERAL
=======
~~~~~~~
gpsd is a userland daemon acting as a translator between GPS and
AIS receivers and their clients. gpsd listens on port 2947 for clients
@ -11,25 +21,25 @@ information from the GPS and translates it into something uniform and
easier to understand for clients. The distribution includes sample
clients, application interface libraries, and test/profiling tools.
There is a website for GPSD where you can find updates, news, and
project mailing lists; look for that URL in the scons recipe, the file
SConstruct in this top-level directory. See that website for a list
of GPS units known to be compatible.
The website for GPSD where you can find updates, news, and
project mailing lists is: https://gpsd.io/
See that website for a list of GPS units known to be compatible.
See the file INSTALL for installation instructions and some tips on
how to troubleshoot your installation. The file build.txt has
See the file INSTALL.adoc for installation instructions and some tips on
how to troubleshoot your installation. The file build.adoc has
instructions for building from source. The packaging/ directory
contains resources and suggestions for packagers and distribution
integrators.
LICENSE
=======
~~~~~~~
This software (gpsd) is released under the terms and conditions of the BSD
License, a copy of which is included in the file COPYING.
1.X CREDITS
===========
~~~~~~~~~~~
Remco Treffkorn designed and originated the code.
@ -55,7 +65,7 @@ None of these people have been active in 2.X and later versions; gpsd
has evolved out of recognition from the 1.X codebase.
2.X CREDITS
===========
~~~~~~~~~~~
Eric S. Raymond drastically rewrote this code in late 2004/early 2005
to clean it up and extend it. The 2.X architecture has become
@ -76,7 +86,7 @@ included:
library, libgpsd(3).
* C and Python libraries are available to encapsulate the client side of
querying gpsd, see libgps(3).
* Cleaned-up error reporting, we don't use syslog when running in foreground
* Cleaned-up error reporting, we don't use syslog when running in the foreground
but send all error and status messages to the tty instead.
* Added -n option to do batch monitoring of GPSes.
* xgpsspeed is working again; xgps has been seriously reworked and improved.
@ -104,17 +114,17 @@ Amaury Jacquot <sxpert@esitcom.org> added DBUS support.
Ville Nuorvala <vnuorval@tcs.hut.fi> wrote the NTRIP support.
We are delighted to acknowlege the assistance of Carl Carter, a field
We are delighted to acknowledge the assistance of Carl Carter, a field
application engineer at SiRF. He assisted us with the correction and
tuning of the SiRF binary-protocol driver, shedding a good deal of
light on murky aspects of the chip's behavior.
We are also delighted to acknowledge the assistance of Timo Ylhainen, VP of
Software Operations at Fastrax. He clarified a number of points about
Software Operations at Fastrax. He clarified some points about
the iTalk protocol, helping to further development of iTalk support.
3.X CREDITS
===========
~~~~~~~~~~~
The main feature of the 3.x versions is a stabilized and finalized
version of the JSON command/response protocol. This was designed and mainly

517
SConstruct

File diff suppressed because it is too large

3
TODO

@ -32,9 +32,6 @@ the calibration process less annoying?
In gps_data_t, save PPS precision; this will require creating a pps struct.
Where would PPS precision come from?
Convert all the timestamp_t (double) timespec (nsec).
That could be done one small step at a time.
Make the Python JSON client as smart as the C JSON client. Gonna be
a big job. The C client checks all the JSON classes for completeness
and correctness. For example, a missing JSON field will be replaced

6
android/gpsd_config.in

@ -18,8 +18,8 @@
#define HAVE_NETINET_IP_H 1
#define HAVE_ARPA_INET_H 1
#define HAVE_SYSLOG_H 1
#define HAVE_TERMIOS_H 1
#define HAVE_DAEMON 1
#define SIZEOF_TIME_T 8
#define HAVE_CLOCK_GETTIME 1
#define HAVE_STRPTIME 1
#define HAVE_GMTIME_R 1
@ -43,7 +43,6 @@
#define GPSDCLIENTS_ENABLE 1
#define GREIS_ENABLE 1
#define IMPLICIT_LINK_ENABLE 1
#define IPV6_ENABLE 1
#define ISYNC_ENABLE 1
#define ITRAX_ENABLE 1
#define LEAPFETCH_ENABLE 1
@ -54,14 +53,11 @@
#define NAVCOM_ENABLE 1
#define NETFEED_ENABLE 1
#define NMEA0183_ENABLE 1
#define NTP_ENABLE 1
#define NTPSHM_ENABLE 1
#define NTRIP_ENABLE 1
#define OCEANSERVER_ENABLE 1
#define ONCORE_ENABLE 1
#define OSCILLATOR_ENABLE 1
#define PASSTHROUGH_ENABLE 1
#define PPS_ENABLE 1
#define QT_ENABLE 1
#define RECONFIGURE_ENABLE 1
#define RTCM104V2_ENABLE 1

115
build.txt → build.adoc

@ -3,7 +3,8 @@
This is a guide to building GPSD from a bare source tree. It includes
guidance on how to cross-build the package.
Some hints for people building binary packages are in packaging/readme.txt.
Some hints for people building binary packages are in
packaging/README.PACKAGERS.
(This file is marked up in asciidoc.)
@ -106,6 +107,12 @@ code and cannot be fixed).
clang produces a gpsd that passes all regression tests.
If you get a build failure including the text "error adding symbols:
DSO missing from command line" or the complaint "ERROR: CC doesn't
work", you nay have tripped over stale data in the builder's
configuration cache. Clean the directory with "scons -c" then manually
remove .sconsign.*dblite and retry your build.
=== Python ===
You will need Python 2.x at minor version 6 or later or Python 3 at
@ -116,6 +123,15 @@ some code generators in Python), it is not required to run the service
daemon. In particular, you can cross-compile onto an embedded system
without having to take Python with you.
scons finds the python used for scons separately from the python that
should be used for the target. It seems to look for the target python
as "python", which as above is supposed to exist per python norms.
However, some packaging systems avoid a bare python, preferring to
bind a program to a particular release as it is built. On systems
without a "python" command, invoking scons as:
scons target_python=python3.7
seems to help.
You will need both basic Python and (if your package system makes the
distinction) the Python development package used for building C
extensions. Usually these are called "python" and "python-dev". You
@ -125,7 +141,7 @@ because of a missing Python.h.
The xgps and xgpsspeed clients will only be installed if these Python
extensions are installed:
|============================================================================
|===========================================================================
|python-gi | Python bindings for gobject-introspection libraries
|python-gi-cairo | Python bindings for Cairo toolkit under GI
|===========================================================================
@ -139,7 +155,7 @@ On Gentoo systems those packages are named:
The ubxtool and zerk clients will only be usable in direct-serial mode
if this Python extension is installed:
|============================================================================
|===========================================================================
|pyserial | Python Serial Port extension
|===========================================================================
@ -272,12 +288,14 @@ To build gpsd for your host platform from source, simply call 'scons'
in a working-directory copy. (Cross-build is described in a later
section.)
To clean the built files, call 'scons -c' . To clean scons' cache, call
'scons sconsclean'. Run 'rm -f .sconsign.dblite' to clear the scons
database. Doing all three should return your working directory to a
To clean the built files, run 'scons -c' or 'scons --clean'.
Run 'rm -f .sconsign.*dblite' to clear the scons
database. Doing both should return your working directory to a
near pristine state as far as building is concerned. Some user created
files may remain, and source code changes will not have been reverted..
When in doubt, restart with a clean copy of the source.
You can specify the installation prefix, as for an autotools build, by
running "scons prefix=<installation_root>". The default value is
"/usr/local". The environment variable DESTDIR also works in the
@ -322,60 +340,35 @@ place.
You will need php and php-gd installed to support the PHP web page
generator included with the distribution. To install it, copy the file
'gpsd.php' to your HTML document directory. Then see the
post-installation instructions in INSTALL for how to configure it.
== The leapseconds cache ==
Early in your build, the recipe will try to go over the Internet to
one of several sources of current data on the leap-second offset in
order to ensure that the file leapseconds.cache is up to date. This,
in turn, is used to build a timebase.h include file.
This procedure may fail if you are building in a network that
requires an authenticating web proxy. If that occurs, the build will
time out with a warning and a suggestion to use the leapfetch=no build
option.
Building with leapfetch=no may, in unusual circumstances, result in
reported GPS time being off by a second or more. The circumstances
are:
1. It has been less than 20 minutes since power-up; the GPS has
not yet received the current leapsecond offset as part of the
periodic ephemeris download.
2. One or more leap-second offset increments have been issued between
when your GPSD source tree was cloned from the repository (or
leapsecond.cache was later updated) and now. Leap-second
increments, compensating for minute and unpredictable changes in
the Earth's rotation, are occasionally issued by international time
authorities.
Note that the same failure can occur with any GPSD installation. But
by refreshing leapseconds.cache you reduce the error window for
leap-second offset bumps to affect your installation so that it begins
as late as possible, at your build time rather than from when the
source tree was copied.
If you have had a leap-second transition, the following regression tests
will break:
bu303-climbing.log
bu303-moving.log
bu303-nofix.log
bu303-stillfix.log
bu303b-nofix.log
italk-binary.log
navcom.log
ublox-aek-4t.log
ublox-lea-4t.log
ublox-sirf1.log
There is no help for this other than a test rebuild. The problem is
that these devices rely on the build-time leap-second offset; you'll
see times one second off. Other GPSes either return
leap-second-corrected time or the test loads include a
leapsecond-offset report before any time is reported.
post-installation instructions in INSTALL.adoc for how to configure it.
== Leap Seconds ==
The header gpsd.h contains the value BUILD_LEAPSECONDS. This is set,
at release time, to the leap second value current at that time.
Ideally gpsd would be reading the standard leapseconds.cache file
provided by most distributions for the current leap second.
Most of the drivers supply the current leap second, after the GNSS
receiver sends it in a message to gpsd. But none of the standard NMEA
0183 messages supply the current leap second. Thus the need for a fall
back leap second value.
The leap second value is mainly used to check for invalid UTC time from
the GNSS receiver. If the receiver is affected by the GPS Week Number
Roll Over (WKNO) bug, then the UTC time it reports will be off by 1024
weeks.
All GNSS receivers may be using the wrong leap second internally on
startup. This may happen if it has been less than about 12 minutes since
power-up; the receiver has not yet received the current leapsecond
offset as part of the periodic almanac download. Page 18, subframe 4,
of the almanac contains the leap second data.
The gpsd daemon may be using the wrong leap second internally if
the compiled in leap second is no longer valid, and the GNSS receiver
has not reported the current leap second to gpsd.
== Optional features ==
@ -464,7 +457,7 @@ message) if the tool cannot be found. When running multiple jobs with
appended to the command. With a non-default setting, accommodating
parallelism is the user's responsibility.
For instructions on how to live-test the software, see the file INSTALL.
For instructions on how to live-test the software, see the file INSTALL.adoc.
== Reverting to a clean state ==

270
cgps.c

@ -91,17 +91,17 @@
#include "gpsd_config.h" /* must be before all includes */
#include <ctype.h>
#include <curses.h>
#include <errno.h>
#include <math.h>
#include <signal.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <math.h>
#include <errno.h>
#include <curses.h>
#include <time.h>
#include <signal.h>
#include <unistd.h>
#include <ctype.h>
#include "gps.h"
#include "gps_json.h" /* for GPS_JSON_RESPONSE_MAX */
@ -109,6 +109,7 @@
#include "gpsdclient.h"
#include "revision.h"
#include "os_compat.h"
#include "timespec.h"
static struct gps_data_t gpsdata;
static time_t status_timer; /* Time of last state change. */
@ -151,6 +152,20 @@ static const char *int_to_str(int val, int min, int max)
return buf;
}
/* range test an double, to tenths, return 5 chars + NUL */
static const char *tenth_to_str(double val, double min, double max)
{
static char buf[20];
if (0 == isfinite(val) ||
val < min ||
val > max) {
return " n/a";
}
(void)snprintf(buf, sizeof(buf), "%5.1f", val);
return buf;
}
/* format a DOP into a 5 char string, handle NAN, INFINITE */
static char *dop_to_str(double dop)
{
@ -172,7 +187,8 @@ static char *ep_to_str(double ep, double factor, char *units)
if (isfinite(ep) == 0) {
return " n/a ";
}
val = ep * factor;
/* somehow these go negative now and then... */
val = fabs(ep * factor);
if ( 100 <= val ) {
(void)snprintf(buf, sizeof(buf), "+/-%5d %.3s", (int)val, units);
} else {
@ -188,7 +204,7 @@ static char *ecef_to_str(double pos, double vel, double factor, char *units)
if (isfinite(pos) == 0) {
if (isfinite(vel) == 0) {
return " n/a n/a ";
return " n/a n/a ";
} else {
(void)snprintf(buf, sizeof(buf), " n/a %8.3f%.4s/s",
vel * factor, units);
@ -355,7 +371,8 @@ static void windowsetup(void)
/* Do the initial field label setup. */
(void)mvwprintw(datawin, row++, DATAWIN_DESC_OFFSET, "Time:");
(void)mvwprintw(datawin, row++, DATAWIN_DESC_OFFSET, "Heading:");
/* FIXME: prolly should be heading... */
(void)mvwprintw(datawin, row++, DATAWIN_DESC_OFFSET, "Track:");
(void)mvwprintw(datawin, row++, DATAWIN_DESC_OFFSET, "Pitch:");
(void)mvwprintw(datawin, row++, DATAWIN_DESC_OFFSET, "Roll:");
(void)mvwprintw(datawin, row++, DATAWIN_DESC_OFFSET, "Dip:");
@ -386,9 +403,9 @@ static void windowsetup(void)
(void)mvwaddstr(datawin, row++, DATAWIN_DESC_OFFSET, "Time:");
(void)mvwaddstr(datawin, row++, DATAWIN_DESC_OFFSET, "Latitude:");
(void)mvwaddstr(datawin, row++, DATAWIN_DESC_OFFSET, "Longitude:");
(void)mvwaddstr(datawin, row++, DATAWIN_DESC_OFFSET, "Altitude:");
(void)mvwaddstr(datawin, row++, DATAWIN_DESC_OFFSET, "Alt (HAE, MSL):");
(void)mvwaddstr(datawin, row++, DATAWIN_DESC_OFFSET, "Speed:");
(void)mvwaddstr(datawin, row++, DATAWIN_DESC_OFFSET, "Heading:");
(void)mvwaddstr(datawin, row++, DATAWIN_DESC_OFFSET, "Track ");
(void)mvwaddstr(datawin, row++, DATAWIN_DESC_OFFSET, "Climb:");
(void)mvwaddstr(datawin, row++, DATAWIN_DESC_OFFSET, "Status:");
@ -431,7 +448,7 @@ static void windowsetup(void)
(void)mvwaddstr(datawin, row++, DATAWIN_DESC_OFFSET,
"Speed Err (EPS):");
(void)mvwaddstr(datawin, row++, DATAWIN_DESC_OFFSET,
"Head Err (EPD):");
"Track Err (EPD):");
/* it's actually esr that thought *these* were interesting */
(void)mvwaddstr(datawin, row++, DATAWIN_DESC_OFFSET,
"Time offset:");
@ -476,38 +493,39 @@ static void update_compass_panel(struct gps_data_t *gpsdata)
char scr[128];
int row = 1;
/* Print time/date. */
if (isfinite(gpsdata->fix.time) != 0) {
(void)unix_to_iso8601(gpsdata->fix.time, scr, sizeof(scr));
if (0 < gpsdata->fix.time.tv_sec) {
(void)timespec_to_iso8601(gpsdata->fix.time, scr, sizeof(scr));
} else
(void)strncpy(scr, "n/a", sizeof(scr));
(void)strlcpy(scr, "n/a", sizeof(scr));
(void)mvwprintw(datawin, row++, DATAWIN_VALUE_OFFSET, "%-*s", 27, scr);
/* Fill in the heading. */
/* Fill in the track. */
/* FIXME: prolly should be heading... */
if (isfinite(gpsdata->fix.track) != 0) {
(void)snprintf(scr, sizeof(scr), "%.1f degrees", gpsdata->fix.track);
} else
(void)strncpy(scr, "n/a", sizeof(scr));
(void)strlcpy(scr, "n/a", sizeof(scr));
(void)mvwprintw(datawin, row++, DATAWIN_VALUE_OFFSET, "%-*s", 27, scr);
/* Fill in the climb. */
if (isfinite(gpsdata->fix.climb) != 0) {
(void)snprintf(scr, sizeof(scr), "%.2f", gpsdata->fix.climb);
} else
(void)strncpy(scr, "n/a", sizeof(scr));
(void)strlcpy(scr, "n/a", sizeof(scr));
(void)mvwprintw(datawin, row++, DATAWIN_VALUE_OFFSET, "%-*s", 27, scr);
/* Fill in the speed. */
if (isfinite(gpsdata->fix.speed) != 0)
(void)snprintf(scr, sizeof(scr), "%.2f", gpsdata->fix.speed);
else
(void)strncpy(scr, "n/a", sizeof(scr));
(void)strlcpy(scr, "n/a", sizeof(scr));
(void)mvwprintw(datawin, row++, DATAWIN_VALUE_OFFSET, "%-*s", 27, scr);
/* Fill in the altitude. */
if (isfinite(gpsdata->fix.altitude) != 0)
(void)snprintf(scr, sizeof(scr), "%.3f", gpsdata->fix.altitude);
if (isfinite(gpsdata->fix.altHAE) != 0)
(void)snprintf(scr, sizeof(scr), "%.3f", gpsdata->fix.altHAE);
else
(void)strncpy(scr, "n/a", sizeof(scr));
(void)strlcpy(scr, "n/a", sizeof(scr));
(void)mvwprintw(datawin, row++, DATAWIN_VALUE_OFFSET, "%-*s", 27, scr);
/* When we need to fill in receiver type again, do it here. */
@ -541,7 +559,7 @@ static void update_gps_panel(struct gps_data_t *gpsdata, char *message)
/* This gets called once for each new GPS sentence. */
{
int newstate;
char scr[60];
char scr[80];
/* This is for the satellite status display. Originally lifted from
* xgps.c. Note that the satellite list may be truncated based on
@ -555,13 +573,13 @@ static void update_gps_panel(struct gps_data_t *gpsdata, char *message)
/* got version, check it */
/* FIXME: expected API version not available ? */
if (0 != strcmp(gpsdata->version.release, VERSION)) {
(void)fprintf(stderr, "cgps: WARNING gpsd release %s, API: %d.%d, "
(void)fprintf(stderr, "cgps: WARNING gpsd release %s, API: %d.%d, "
"expected %s ",
gpsdata->version.release,
gpsdata->version.proto_major,
gpsdata->version.proto_minor,
VERSION);
sleep(2);
gpsdata->version.release,
gpsdata->version.proto_major,
gpsdata->version.proto_minor,
VERSION);
sleep(2);
}
}
@ -576,7 +594,8 @@ static void update_gps_panel(struct gps_data_t *gpsdata, char *message)
for (sat_no = 0; sat_no < loop_end; sat_no++) {
int column = 1; /* column to write to */
char *gnssid;
char sigid[2] = "";
char sigid[2] = " ";
char health = ' ';
if ( 0 == gpsdata->skyview[sat_no].svid) {
gnssid = " ";
@ -625,21 +644,25 @@ static void update_gps_panel(struct gps_data_t *gpsdata, char *message)
(void)mvwaddstr(satellites, sat_no + 2, column,
int_to_str(gpsdata->skyview[sat_no].PRN,
1, 438));
/* u-blox uses -91 to signal something undocumented */
column += 6;
column += 5;
(void)mvwaddstr(satellites, sat_no + 2, column,
int_to_str(gpsdata->skyview[sat_no].elevation,
-90, 90));
tenth_to_str(gpsdata->skyview[sat_no].elevation,
-90.0, 90.0));
column += 7;
(void)mvwaddstr(satellites, sat_no + 2, column,
int_to_str(gpsdata->skyview[sat_no].azimuth,
0, 359));
tenth_to_str(gpsdata->skyview[sat_no].azimuth,
0.0, 359.0));
column += 6;
(void)mvwaddstr(satellites, sat_no + 2, column,
int_to_str((int)round(gpsdata->skyview[sat_no].ss),
0, 254));
tenth_to_str(gpsdata->skyview[sat_no].ss,
0.0, 254.0));
column += 6;
(void)mvwprintw(satellites, sat_no + 2, column, " %c ",
if (SAT_HEALTH_BAD == gpsdata->skyview[sat_no].health) {
/* only mark known unhealthy */
health = 'u';
}
(void)mvwprintw(satellites, sat_no + 2, column, " %c%c ",
health,
gpsdata->skyview[sat_no].used ? 'Y' : 'N');
}
@ -670,35 +693,50 @@ static void update_gps_panel(struct gps_data_t *gpsdata, char *message)
curs_set(0);
/* Print time/date. */
if (isfinite(gpsdata->fix.time) != 0) {
(void)unix_to_iso8601(gpsdata->fix.time, scr, sizeof(scr));
if (0 < gpsdata->fix.time.tv_sec) {
(void)timespec_to_iso8601(gpsdata->fix.time, scr, sizeof(scr));
} else
(void)strncpy(scr, " n/a", sizeof(scr));
(void)strlcpy(scr, " n/a", sizeof(scr));
(void)mvwprintw(datawin, 1, DATAWIN_VALUE_OFFSET, "%-*s", 26, scr);
/* Fill in the latitude. */
if (gpsdata->fix.mode >= MODE_2D) {
deg_to_str2(deg_type, gpsdata->fix.latitude,
scr, sizeof(scr), " N", " S");
deg_to_str2(deg_type, gpsdata->fix.latitude,
scr, sizeof(scr), " N", " S");
} else
(void)strncpy(scr, "n/a", sizeof(scr));
(void)strlcpy(scr, "n/a", sizeof(scr));
(void)mvwprintw(datawin, 2, DATAWIN_VALUE_OFFSET, " %-*s", 25, scr);
/* Fill in the longitude. */
if (gpsdata->fix.mode >= MODE_2D) {
deg_to_str2(deg_type, gpsdata->fix.longitude,
scr, sizeof(scr), " E", " W");
deg_to_str2(deg_type, gpsdata->fix.longitude,
scr, sizeof(scr), " E", " W");
} else
(void)strncpy(scr, "n/a", sizeof(scr));
(void)strlcpy(scr, "n/a", sizeof(scr));
(void)mvwprintw(datawin, 3, DATAWIN_VALUE_OFFSET, " %-*s", 25, scr);
/* Fill in the altitude. */
if (gpsdata->fix.mode >= MODE_3D && isfinite(gpsdata->fix.altitude) != 0)
(void)snprintf(scr, sizeof(scr), "%9.3f %s",
gpsdata->fix.altitude * altfactor, altunits);
else
(void)strncpy(scr, " n/a", sizeof(scr));
/* Fill in the altitudes. */
if (gpsdata->fix.mode >= MODE_3D) {
char buf1[20], buf2[20];
if (0 != isfinite(gpsdata->fix.altHAE))
(void)snprintf(buf1, sizeof(buf1), "%11.3f,",
gpsdata->fix.altHAE * altfactor);
else
(void)strlcpy(buf1, " n/a,", sizeof(buf1));
if (0 != isfinite(gpsdata->fix.altMSL))
(void)snprintf(buf2, sizeof(buf2), "%11.3f ",
gpsdata->fix.altMSL * altfactor);
else
(void)strlcpy(buf2, " n/a ", sizeof(buf2));
(void)strlcpy(scr, buf1, sizeof(scr));
(void)strlcat(scr, buf2, sizeof(scr));
(void)strlcat(scr, altunits, sizeof(scr));
} else {
(void)strlcpy(scr, " n/a, n/a ", sizeof(scr));
}
(void)mvwprintw(datawin, 4, DATAWIN_VALUE_OFFSET, "%-*s", 27, scr);
/* Fill in the speed. */
@ -706,84 +744,101 @@ static void update_gps_panel(struct gps_data_t *gpsdata, char *message)
(void)snprintf(scr, sizeof(scr), "%8.2f %s",
gpsdata->fix.speed * speedfactor, speedunits);
else
(void)strncpy(scr, " n/a", sizeof(scr));
(void)strlcpy(scr, " n/a", sizeof(scr));
(void)mvwprintw(datawin, 5, DATAWIN_VALUE_OFFSET, "%-*s", 27, scr);
/* Fill in the heading. */
/* Fill in the track. */
if (!magnetic_flag) {
(void)strlcpy(scr, " (true, var): ", sizeof(scr));
} else {
(void)strlcpy(scr, " (mag, var): ", sizeof(scr));
}
if (gpsdata->fix.mode >= MODE_2D && isfinite(gpsdata->fix.track) != 0) {
double magheading = true2magnetic(gpsdata->fix.latitude,
gpsdata->fix.longitude,
gpsdata->fix.track);
if (!magnetic_flag || isfinite(magheading) == 0) {
(void)snprintf(scr, sizeof(scr), "%5.1f deg (true)",
char buf1[20], buf2[20];
if (!magnetic_flag || isfinite(gpsdata->fix.magnetic_track) == 0) {
(void)snprintf(buf1, sizeof(buf1), "%5.1f,",
gpsdata->fix.track);
} else {
(void)snprintf(scr, sizeof(scr), "%5.1f deg (mag) ",
magheading);
(void)snprintf(buf1, sizeof(buf1), "%5.1f,",
gpsdata->fix.magnetic_track);
}
(void)strlcat(scr, buf1, sizeof(scr));
if (0 != isfinite(gpsdata->fix.magnetic_var)) {
(void)snprintf(buf2, sizeof(buf2), "%6.1f",
gpsdata->fix.magnetic_var);
(void)strlcat(scr, buf2, sizeof(scr));
} else {
(void)strlcat(scr, " ", sizeof(scr));
}
} else
(void)strncpy(scr, "n/a", sizeof(scr));
(void)mvwprintw(datawin, 6, DATAWIN_VALUE_OFFSET, " %-*s", 25, scr);
(void)strlcat(scr, " n/a", sizeof(scr));
(void)mvwprintw(datawin, 6, DATAWIN_VALUE_OFFSET - 10, "%-*s deg",
32, scr);
/* Fill in the rate of climb. */
if (isfinite(gpsdata->fix.climb) != 0)
(void)snprintf(scr, sizeof(scr), "%8.2f %s/min",
gpsdata->fix.climb * altfactor * 60, altunits);
else
(void)strncpy(scr, " n/a", sizeof(scr));
(void)strlcpy(scr, " n/a", sizeof(scr));
(void)mvwprintw(datawin, 7, DATAWIN_VALUE_OFFSET, "%-*s", 27, scr);
/* Fill in the GPS status and the time since the last state
* change. */
if (gpsdata->online == 0) {
if (0 == gpsdata->online.tv_sec &&
0 == gpsdata->online.tv_nsec) {
newstate = 0;
(void)strncpy(scr, "OFFLINE", sizeof(scr));
(void)strlcpy(scr, "OFFLINE", sizeof(scr));
} else {
const char *fmt;
const char *mod = "";
newstate = gpsdata->fix.mode;
switch (gpsdata->status) {
case STATUS_DGPS_FIX:
mod = "DIFF ";
break;
case STATUS_RTK_FIX:
switch (gpsdata->status) {
case STATUS_DGPS_FIX:
mod = "DGPS ";
break;
case STATUS_RTK_FIX:
mod = "RTK ";
break;