Browse Source

New upstream version 3.20

master
Bernd Zeimetz 9 months ago
parent
commit
81257aeeaf
100 changed files with 14876 additions and 262378 deletions
  1. +89
    -0
      .ci-build/build.sh
  2. +24
    -0
      .ci-build/test_options.sh
  3. +157
    -5
      .gitlab-ci.yml
  4. +7
    -4
      .travis.yml
  5. +0
    -41
      .travis/build.sh
  6. +0
    -18
      Android.bp
  7. +194
    -23
      INSTALL.adoc
  8. +32
    -2
      NEWS
  9. +3
    -3
      Qgpsmm.pc.in
  10. +24
    -14
      README.adoc
  11. +288
    -229
      SConstruct
  12. +0
    -3
      TODO
  13. +1
    -5
      android/gpsd_config.in
  14. +54
    -61
      build.adoc
  15. +165
    -105
      cgps.c
  16. +17
    -16
      compiler.h
  17. +0
    -85187
      contrib/ais-samples/ais-nmea-sample.log
  18. +0
    -167714
      contrib/ais-samples/ais-nmea-sample.log.chk
  19. +32
    -0
      contrib/appamor/README.md
  20. +68
    -0
      contrib/appamor/usr.sbin.gpsd
  21. +2
    -2
      contrib/ashctl.c
  22. +2
    -2
      contrib/binlog.c
  23. +6
    -6
      contrib/binreplay.c
  24. +4
    -5
      contrib/gpsData.py
  25. +1
    -13
      contrib/maxsats.pl
  26. +2
    -2
      contrib/motosend.c
  27. +47
    -51
      contrib/ntpshmviz
  28. +1
    -13
      contrib/skyview.php
  29. +1
    -1
      contrib/skyview2svg
  30. +1
    -1
      contrib/webgps.py
  31. +4
    -2
      dbusexport.c
  32. +20
    -16
      devtools/aivdmtable
  33. +37
    -13
      devtools/cycle_analyzer
  34. +33
    -0
      devtools/get_geoid_table.py
  35. +34
    -0
      devtools/get_mag_var_table.py
  36. +42
    -24
      devtools/regress-builder
  37. +38
    -32
      devtools/regressdiff
  38. +2
    -3
      devtools/sizes
  39. +7
    -6
      devtools/striplog
  40. +15
    -0
      do-clean
  41. +1
    -1
      doc/explan_driver_nmea.c.xml
  42. +3
    -3
      doc/explan_geoid.c.xml
  43. +1
    -1
      doc/explan_gpsd_log.c.xml
  44. +5
    -16
      doc/explan_gpsutils.c.xml
  45. +1
    -1
      doc/explan_libgpsd_core.c.xml
  46. +1
    -1
      doc/explan_serial.c.xml
  47. +0
    -39
      doc/explan_timebase.h.xml
  48. +0
    -2
      doc/internals.xml
  49. +250
    -251
      driver_ais.c
  50. +19
    -281
      driver_evermore.c
  51. +203
    -339
      driver_garmin.c
  52. +53
    -59
      driver_garmin_txt.c
  53. +70
    -66
      driver_geostar.c
  54. +95
    -100
      driver_greis.c
  55. +213
    -197
      driver_italk.c
  56. +116
    -113
      driver_navcom.c
  57. +1604
    -1345
      driver_nmea0183.c
  58. +110
    -74
      driver_nmea2000.c
  59. +137
    -41
      driver_oncore.c
  60. +19
    -31
      driver_proto.c
  61. +846
    -742
      driver_rtcm2.c
  62. +534
    -384
      driver_rtcm3.c
  63. +1047
    -1041
      driver_sirf.c
  64. +42
    -49
      driver_skytraq.c
  65. +47
    -41
      driver_superstar2.c
  66. +3174
    -1170
      driver_tsip.c
  67. +1174
    -1005
      driver_ubx.c
  68. +42
    -34
      driver_zodiac.c
  69. +94
    -116
      drivers.c
  70. +115
    -0
      example_aiogps.py
  71. +26
    -0
      example_aiogps_run
  72. +1
    -1
      gegps
  73. +936
    -95
      geoid.c
  74. +175
    -77
      gps.h
  75. +1
    -1
      gps/__init__.py
  76. +308
    -0
      gps/aiogps.py
  77. +1
    -0
      gps/client.py
  78. +904
    -0
      gps/clienthelpers.py
  79. +18
    -22
      gps/fake.py
  80. +51
    -10
      gps/gps.py
  81. +20
    -4
      gps/misc.py
  82. +4
    -4
      gps2udp.c
  83. +2
    -0
      gps_maskdump.c
  84. +2
    -1
      gpscap.py
  85. +1
    -1
      gpscat
  86. +0
    -119
      gpsclient.c
  87. +68
    -63
      gpsctl.c
  88. +343
    -280
      gpsd.c
  89. +84
    -87
      gpsd.h
  90. +2
    -11
      gpsd.php
  91. +2
    -11
      gpsd.php.in
  92. +19
    -42
      gpsd_config.h
  93. +266
    -127
      gpsd_json.c
  94. +127
    -168
      gpsdclient.c
  95. +0
    -1
      gpsdclient.h
  96. +1
    -4
      gpsfake
  97. +38
    -66
      gpsmon.c
  98. +0
    -4
      gpsmon.h
  99. +3
    -5
      gpspacket.c
  100. +3
    -9
      gpspipe.c

+ 89
- 0
.ci-build/build.sh View File

@@ -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
- 0
.ci-build/test_options.sh View File

@@ -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


+ 157
- 5
.gitlab-ci.yml View File

@@ -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

+ 7
- 4
.travis.yml View File

@@ -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


+ 0
- 41
.travis/build.sh View File

@@ -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


+ 0
- 18
Android.bp View File

@@ -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"


INSTALL → INSTALL.adoc View File

@@ -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.


+ 32
- 2
NEWS View File

@@ -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


+ 3
- 3
Qgpsmm.pc.in View File

@@ -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

README → README.adoc View File

@@ -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

+ 288
- 229
SConstruct
File diff suppressed because it is too large
View File


+ 0
- 3
TODO View File

@@ -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


+ 1
- 5
android/gpsd_config.in View File

@@ -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


build.txt → build.adoc View File

@@ -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 ==


+ 165
- 105
cgps.c View File

@@ -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;
case STATUS_RTK_FLT:
break;
case STATUS_RTK_FLT:
mod = "RTK ";
break;
case STATUS_DR:
break;
case STATUS_DR:
mod = "DR ";
break;
case STATUS_GNSSDR:
mod = "+DR ";
break;
case STATUS_TIME:
break;
case STATUS_GNSSDR:
mod = "GNSSDR ";
break;
case STATUS_TIME:
mod = "FIXED ";
break;
default:
/* ignore: */
mod = "";
break;
}
break;
case STATUS_PPS_FIX:
mod = "PPS ";
break;
default:
/* ignore: */
mod = "";
break;
}
switch (gpsdata->fix.mode) {
case MODE_2D:
fmt = "2D %sFIX (%d secs)";
break;
case MODE_3D:
if (STATUS_TIME == gpsdata->status) {
fmt = "%sSURVEYED (%d secs)";
} else {
fmt = "3D %sFIX (%d secs)";
}
if (STATUS_TIME == gpsdata->status) {
fmt = "%sSURVEYED (%d secs)";
} else {
fmt = "3D %sFIX (%d secs)";
}
break;
default:
fmt = "NO %sFIX (%d secs)";
break;
}
(void)snprintf(scr, sizeof(scr), fmt, mod,
(int)(time(NULL) - status_timer));
(void)snprintf(scr, sizeof(scr), fmt, mod,
(int)(time(NULL) - status_timer));
}
(void)mvwprintw(datawin, 8, DATAWIN_VALUE_OFFSET + 1, "%-*s", 26, scr);

@@ -869,23 +924,28 @@ static void update_gps_panel(struct gps_data_t *gpsdata, char *message)
27, estr);
}


/* Fill in the estimated speed error, EPS. */
ep_str = ep_to_str(gpsdata->fix.eps, speedfactor, speedunits);
(void)mvwprintw(datawin, row++, DATAWIN_VALUE_OFFSET + 8,
"%-*s", 12, ep_str);
"%-*s ", 14, ep_str);

/* Fill in the estimated track error, EPD. */
ep_str = ep_to_str(gpsdata->fix.epd, speedfactor, "deg");
(void)mvwprintw(datawin, row++, DATAWIN_VALUE_OFFSET + 8, "%-*s", 18,
ep_str);
(void)mvwprintw(datawin, row++, DATAWIN_VALUE_OFFSET + 8, "%-*s ",
14, ep_str);

/* Fill in the time offset, milliseconds. */
if (isfinite(gpsdata->fix.time) != 0)
(void)snprintf(scr, sizeof(scr), "%6.3f sec",
(double)(timestamp()-gpsdata->fix.time));
else
(void)strncpy(scr, " n/a", sizeof(scr));
if (0 < gpsdata->fix.time.tv_sec) {
timespec_t ts_now, ts_diff;
(void)clock_gettime(CLOCK_REALTIME, &ts_now);
TS_SUB(&ts_diff, &ts_now, &gpsdata->fix.time);

(void)snprintf(scr, sizeof(scr), "%lld.%03ld sec",
(long long)ts_diff.tv_sec,
ts_diff.tv_nsec / 1000000);
} else {
(void)strlcpy(scr, " n/a", sizeof(scr));
}
(void)mvwprintw(datawin, row++, DATAWIN_VALUE_OFFSET + 8, "%-*s", 18,
scr);
/* Fill in the grid square (esr thought *this* one was interesting). */
@@ -935,7 +995,7 @@ static void usage(char *prog)
" d = DD.ddddddd\n"
" m = DD MM.mmmmmm'\n"
" s = DD MM' SS.sssss\"\n"
" -m Display heading as the estimated magnetic heading\n"
" -m Display track as the estimated magnetic track\n"
" Valid or USA (Lower 48 + AK) and Western Europe.\n"
" -s Be silent (don't print raw gpsd data)\n"
" -V Show version, then exit\n",


+ 17
- 16
compiler.h View File

@@ -46,9 +46,9 @@
0 * (int) sizeof(({ \
struct { \
int unused_int; \
typeof(arr) unused_arr; \
__typeof__(arr) unused_arr; \
} zero_init = {0}; \
typeof(arr) arg_is_not_array UNUSED = { \
__typeof__(arr) arg_is_not_array UNUSED = { \
zero_init.unused_arr[0], \
}; \
1; \
@@ -65,20 +65,21 @@
assert(locresult != -23); \
} while (0)

#ifdef HAVE_STDATOMIC_H
#if !defined(__COVERITY__)
#if !defined(__cplusplus)
#ifdef __COVERITY__
/* do nothing */
#elif defined(__cplusplus)
/* we are C++ */
#if __cplusplus >= 201103L
/* C++ before C++11 can not handle stdatomic.h or atomic */
/* atomic is just C++ for stdatomic.h */
#include <atomic>
#endif
#elif defined(HAVE_STDATOMIC_H)
/* we are C and atomics are in C98 and newer */
#include <stdatomic.h>
#elif __cplusplus >= 201103L
/* C++ before C++11 can not handle stdatomic.h or atomic */
/* atomic is just C++ for stdatomic.h */
#include <atomic>
#endif /* __cplusplus */
#endif /* __COVERITY__ */
#endif /* HAVE_STDATOMIC_H */

#ifdef HAVE_OSATOMIC_H
#include <libkern/OSAtomic.h>
#elif defined(HAVE_OSATOMIC_H)
/* do it the OS X way */
#include <libkern/OSAtomic.h>
#endif /* HAVE_OSATOMIC_H */

static inline void memory_barrier(void)
@@ -99,7 +100,7 @@ static inline void memory_barrier(void)
/* do it the OS X way */
OSMemoryBarrier();
#elif defined(__GNUC__)
asm volatile ("" : : : "memory");
__asm__ __volatile__ ("" : : : "memory");
#endif
}



+ 0
- 85187
contrib/ais-samples/ais-nmea-sample.log
File diff suppressed because it is too large
View File


+ 0
- 167714
contrib/ais-samples/ais-nmea-sample.log.chk
File diff suppressed because it is too large
View File


+ 32
- 0
contrib/appamor/README.md View File

@@ -0,0 +1,32 @@
## Apparmor profile for gpsd

[AppArmor](https://en.wikipedia.org/wiki/AppArmor "wikipedia:AppArmor")
is a [Mandatory Access Control](https://wiki.archlinux.org/index.php/Mandatory_Access_Control "Mandatory Access Control")
(MAC) system, implemented upon the
[Linux Security Modules](https://en.wikipedia.org/wiki/Linux_Security_Modules "wikipedia:Linux Security Modules") (LSM).

Distributions using Apparmor are Debian, Ubuntu, various derivates, SuSE
and various others. Please note that RedHat, CentOS and Fedora are using
SELinux, which does obviously not use Apparmor profiles.

The file *usr.sbin.gpsd* is the apparmor profile created by the
Ubuntu/Cacnonical developers for the usage in Debian and Ubuntu. If you
want to use it, you need

- an apparmor installation. Please consult the documentation of your
distribution, some useful documentation can be found in
[Debian Wiki](https://wiki.debian.org/AppArmor/HowToUse) and
[Arch Wiki](https://wiki.archlinux.org/index.php/AppArmor). Make sure
apparmor in general is working as expected before adding new profiles.
- to copy the file to */etc/apparmor.d* and name it according to the
location of your gpsd binary. The proper name should be the output of
`command -v gpsd | sed 's,^/,,;s,/,.,g'`
- to edit your copied file, at least you need to fix the location of
gpsd if necessary, also check if the rules apply to your installation or
if you want to limit them (for example: if you have one fixed serial device
you might now want to allow gpsd to talk to all tty devices).

Before enforcing your new profile you might want to run it in complain
mode: `aa-complain /etc/apparmor.d/your.new.profile`. Give it a good
testing, if everything works as expected, put it into enforce mode:
`aa-enforce /etc/apparmor.d/your.new.profile`

+ 68
- 0
contrib/appamor/usr.sbin.gpsd View File

@@ -0,0 +1,68 @@
# vim:syntax=apparmor
# ------------------------------------------------------------------
#
# Copyright (C) 2018 Canonical Ltd.
#
# This software is distributed under a BSD-style license. See the
# file "COPYING" in the top-level directory of the distribution for details.
#
# ------------------------------------------------------------------

#include <tunables/global>

/usr/sbin/gpsd {
#include <abstractions/base>
#include <abstractions/nameservice>

capability ipc_lock,
capability net_bind_service,
capability sys_nice,
capability fsetid,
capability setgid,
capability setuid,
capability sys_resource,

# for all the remote connection options
network dgram,
network stream,

# common serial paths to GPS devices
/dev/tty{,S,USB,AMA,ACM}[0-9]* rw,
/sys/dev/char r,
/sys/dev/char/** r,

# pps related devices
/dev/pps[0-9]* rw,
/sys/devices/virtual/pps r,
/sys/devices/virtual/pps/** r,

# gpsd device to share
/dev/gpsd[0-9] rw,

# libusb device access to GPS devices
/proc/ r,
/dev/ r,
/sys/class/ r,
/sys/bus/ r,
/dev/bus/usb/ r,
/sys/bus/usb/devices/ r,
/sys/devices/pci[0-9]*/**/{uevent,busnum,devnum,speed,descriptors} r,
/run/udev/data/+usb* r,
/run/udev/data/c189* r,

# common config path (by default unused)
/etc/gpsd/* r,

# enumerate own FDs
@{PROC}/@{pid}/fd/ r,

# default paths feeding GPS data into chrony
/{,var/}run/chrony.tty{,S,USB,AMA}[0-9]*.sock rw,
/tmp/chrony.tty{,S,USB,AMA}[0-9]*.sock rw,

# logging
/{,var/}run/systemd/journal/dev-log w,

# Site-specific additions and overrides. See local/README for details.
#include <local/usr.sbin.gpsd>
}

+ 2
- 2
contrib/ashctl.c View File

@@ -2,7 +2,6 @@
* This file is Copyright (c) 2010-2018 by the GPSD project
* SPDX-License-Identifier: BSD-2-clause
*/
#include <sys/types.h>
#include <err.h>
#include <errno.h>
#include <fcntl.h>
@@ -10,8 +9,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h> /* For nanosleep() */
#include <sys/types.h>
#include <termios.h>
#include <time.h> /* For nanosleep() */
#include <unistd.h>

#define MODE_RAW 0


+ 2
- 2
contrib/binlog.c View File

@@ -2,15 +2,15 @@
* This file is Copyright (c) 2010-2018 by the GPSD project
* SPDX-License-Identifier: BSD-2-clause
*/
#include <sys/types.h>
#include <err.h>
#include <assert.h>
#include <err.h>
#include <errno.h>
#include <fcntl.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <termios.h>
#include <time.h> /* For nanosleep() */
#include <unistd.h>


+ 6
- 6
contrib/binreplay.c View File

@@ -4,18 +4,18 @@
* This file is Copyright (c) 2010-2018 by the GPSD project
* SPDX-License-Identifier: BSD-2-clause
*/
#include <sys/types.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <err.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <termios.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <termios.h>
#include <time.h> /* For nanosleep() */
#include <unistd.h>
#ifndef __GLIBC__
#include <util.h>
#else


+ 4
- 5
contrib/gpsData.py View File

@@ -7,11 +7,10 @@
# Preserve this property!
from __future__ import absolute_import, print_function, division

import gps
import os
from gps import *
from time import *
import time
import threading
import time

gpsd = None # setting the global variable

@@ -22,7 +21,7 @@ class GpsPoller(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
global gpsd # bring it in scope
gpsd = gps(mode=WATCH_ENABLE) # starting the stream of info
gpsd = gps.gps(mode=gps.WATCH_ENABLE) # starting the stream of info
self.current_value = None
self.running = True # setting the thread running to true

@@ -51,7 +50,7 @@ if __name__ == '__main__':
print('latitude ', gpsd.fix.latitude)
print('longitude ', gpsd.fix.longitude)
print('time utc ', gpsd.utc, ' + ', gpsd.fix.time)
print('altitude (m)', gpsd.fix.altitude)
print('altHAE (m) ', gpsd.fix.altHAE)
print('eps ', gpsd.fix.eps)
print('epx ', gpsd.fix.epx)
print('epv ', gpsd.fix.epv)


+ 1
- 13
contrib/maxsats.pl View File

@@ -2,19 +2,7 @@

# Copyright (c) 2008 Chris Kuethe <chris.kuethe@gmail.com>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#
# This file is Copyright (c) 2008-2018 by the GPSD project
# This file is Copyright (c) 2008-2019 by the GPSD project
# SPDX-License-Identifier: BSD-2-clause

use strict;


+ 2
- 2
contrib/motosend.c View File

@@ -2,18 +2,18 @@
* This file is Copyright (c) 2010-2018 by the GPSD project
* SPDX-License-Identifier: BSD-2-clause
*/
#include <sys/types.h>
#include <err.h>
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <termios.h>
#include <time.h> /* For nanosleep() and time() */
#include <unistd.h>
#include <limits.h>

/*
* @@Cj - receiver ID


+ 47
- 51
contrib/ntpshmviz View File</