Browse Source

Imported Upstream version 3.9

master
Bernd Zeimetz 7 years ago
parent
commit
5c5616d548
100 changed files with 3781 additions and 1926 deletions
  1. +1
    -2
      INSTALL
  2. +22
    -1
      NEWS
  3. +196
    -101
      SConstruct
  4. +9
    -20
      TODO
  5. +31
    -17
      ais_json.c
  6. +49
    -14
      ais_json.i
  7. +75
    -22
      bits.c
  8. +13
    -33
      bits.h
  9. +2
    -2
      bsd_base64.c
  10. +1
    -1
      bsd_base64.h
  11. +29
    -1
      build.txt
  12. +11
    -11
      cgps.c
  13. +3
    -0
      control
  14. +69
    -71
      crc24q.c
  15. +1
    -1
      daemon.c
  16. +40
    -10
      devtools/ais.py
  17. +3
    -0
      devtools/flocktest
  18. +1
    -1
      devtools/tablegen.py
  19. +0
    -0
      doc/internals.xml
  20. +68
    -51
      driver_ais.c
  21. +44
    -47
      driver_evermore.c
  22. +8
    -7
      driver_garmin.c
  23. +25
    -27
      driver_geostar.c
  24. +14
    -16
      driver_italk.c
  25. +12
    -15
      driver_navcom.c
  26. +20
    -16
      driver_nmea0183.c
  27. +617
    -49
      driver_nmea2000.c
  28. +21
    -0
      driver_nmea2000.h
  29. +7
    -7
      driver_oncore.c
  30. +13
    -13
      driver_proto.c
  31. +30
    -30
      driver_rtcm3.c
  32. +9
    -10
      driver_sirf.c
  33. +9
    -13
      driver_superstar2.c
  34. +73
    -81
      driver_tsip.c
  35. +8
    -9
      driver_ubx.c
  36. +7
    -7
      driver_zodiac.c
  37. +31
    -26
      drivers.c
  38. +1
    -0
      gegps.1
  39. +1
    -1
      geoid.c
  40. +8
    -2
      gps.1
  41. +227
    -96
      gps.h
  42. +10
    -1
      gps.xml
  43. +9
    -9
      gps_json.h
  44. +190
    -84
      gpscap.ini
  45. +16
    -4
      gpscap.py
  46. +53
    -54
      gpsctl.c
  47. +84
    -66
      gpsd.c
  48. +25
    -9
      gpsd.h-tail
  49. +25
    -28
      gpsd.php
  50. +25
    -28
      gpsd.php.in
  51. +2
    -0
      gpsd.rules
  52. +9
    -15
      gpsd_json.5
  53. +311
    -194
      gpsd_json.c
  54. +9
    -11
      gpsd_json.xml
  55. +7
    -7
      gpsdclient.c
  56. +2
    -2
      gpsdclient.h
  57. +4
    -4
      gpsdctl.c
  58. +104
    -24
      gpsdecode.c
  59. +1
    -1
      gpsfake.1
  60. +1
    -0
      gpsfake.xml
  61. +85
    -0
      gpsinit
  62. +129
    -0
      gpsinit.8
  63. +170
    -0
      gpsinit.xml
  64. +17
    -17
      gpsmon.c
  65. +4
    -4
      gpspacket.c
  66. +6
    -2
      gpspipe.1
  67. +58
    -30
      gpspipe.c
  68. +8
    -1
      gpspipe.xml
  69. +2
    -2
      gpsutils.c
  70. +11
    -11
      gpxlogger.c
  71. +26
    -21
      hex.c
  72. +12
    -12
      isgps.c
  73. +34
    -12
      json.c
  74. +9
    -9
      json.h
  75. +60
    -37
      jsongen.py.in
  76. +25
    -24
      lcdgps.c
  77. +150
    -55
      leapsecond.py
  78. +17
    -17
      leapseconds.cache
  79. +1
    -1
      libgps.3
  80. +2
    -19
      libgps.h
  81. +2
    -2
      libgps.xml
  82. +15
    -14
      libgps_core.c
  83. +2
    -5
      libgps_dbus.c
  84. +1
    -1
      libgps_json.c
  85. +9
    -9
      libgps_shm.c
  86. +2
    -2
      libgps_sock.c
  87. +47
    -79
      libgpsd_core.c
  88. +3
    -3
      libgpsmm.cpp
  89. +2
    -2
      libgpsmm.h
  90. +15
    -15
      monitor_italk.c
  91. +4
    -2
      monitor_nmea.c
  92. +7
    -7
      monitor_proto.c
  93. +7
    -6
      monitor_tnt.c
  94. +1
    -1
      net_dgpsip.c
  95. +11
    -11
      net_ntrip.c
  96. +13
    -5
      netlib.c
  97. +107
    -115
      ntpshm.c
  98. +8
    -0
      packaging/readme.txt
  99. +2
    -1
      packaging/rpm/gpsd.spec
  100. +1
    -0
      packaging/rpm/gpsd.spec.in

+ 1
- 2
INSTALL View File

@@ -155,8 +155,7 @@ status page for your GPS if you wish. (It may not be in the core
package.) It will be installed in your HTTP document directory. The
first time it's invoked, it will generate a file called
'gpsd_config.inc' in that directory containing configuration
information; edit to taste. Note that for the Google Maps feature
work you need to set a valid Google API key in gpsd_config.inc.
information; edit to taste.

4. Note for people using gpsd as time source for ntpd: In case you're
using dhcp3-client to configure your system, make sure you disable


+ 22
- 1
NEWS View File

@@ -1,4 +1,25 @@
* Wed 23 May 2012 Eric S. Raymond <esr@snark.thyrsus.com>
* Wed 1 May 2013 Eric S. Raymond <esr@snark.thyrsus.com> - 3.9
Note to packagers: this is an urgent release that fixes a possible
DoS or security hole! Armor the AIS driver against an implausible
overrun attack. A (different) fix for our first malformed-packet
crash since about 2007. Minor improvements to the NMEA2000
driver. New FAQ entry on how to know WAAS/EGNOS is working.
New -u and -uu options enable usec timestamps on gpspipe output.

* Mon 25 Feb 2013 Eric S. Raymond <esr@snark.thyrsus.com> - 3.8
Fix various minor errors in the AIVDM/AIVDO description. Repair the
xmlto support in the build system. Add two more regression tests. Significant
improvements to NMEA2000 support. Upgrade the PHP client to v3 of the
Google Maps API. Support for the Telit SL869 chipset. Added a nautical-style
display to xgpsspeed. Minor improvements to leapsecond.py.

* Mon 02 Jul 2012 Eric S. Raymond <esr@snark.thyrsus.com> - 3.7
Snap release to get the midnight change in the default leap-second
constant out the door. Port tests now pass on all Debian supported
architectures, including the Sparc and s390 that were giving us
trouble before. Pre-2003 Delorme Earthmate works again.

* Wed 23 May 2012 Eric S. Raymond <esr@snark.thyrsus.com> - 3.6
It's the Fernando Poo Day release. Code has zero detectible defects
under Coverity scanning and cppcheck 1.52; this is mainly a cleanup
release to get those minor fixes into the field. If a leap-second


+ 196
- 101
SConstruct View File

@@ -19,12 +19,15 @@
# * Out-of-directory builds: see http://www.scons.org/wiki/UsingBuildDir

# Release identification begins here
gpsd_version = "3.6"
gpsd_version = "3.9"

# library version
libgps_version_current = 20
libgps_version_revision = 0
libgps_version_age = 0
libgps_version_current = 20
libgps_version_revision = 0
libgps_version_age = 0
libgpsd_version_current = 21
libgpsd_version_revision = 0
libgpsd_version_age = 0

# Release identification ends here

@@ -37,6 +40,7 @@ sitesearch = "catb.org"
website = "http://catb.org/gpsd"
mainpage = "https://savannah.nongnu.org/projects/gpsd/"
webupload = "login.ibiblio.org:/public/html/catb/gpsd"
cgiupload = "thyrsus.com:/home/www/thyrsus.com/cgi-bin/"
scpupload = "dl.sv.nongnu.org:/releases/gpsd/"
mailman = "http://lists.nongnu.org/mailman/listinfo/"
admin = "https://savannah.nongnu.org/project/admin/?group=gpsd"
@@ -45,8 +49,8 @@ bugtracker = "https://savannah.nongnu.org/bugs/?group=gpsd"
browserepo = "http://git.savannah.gnu.org/cgit/gpsd.git"
clonerepo = "https://savannah.nongnu.org/git/?group=gpsd"
gitrepo = "git://git.savannah.nongnu.org/gpsd.git"
webform = "https://www.mainframe.cx/cgi-bin/gps_report.cgi"
formserver = "www@mainframe.cx"
webform = "http://www.thyrsus.com/cgi-bin/gps_report.cgi"
formserver = "www@thyrsus.com"
devmail = "gpsd-dev@lists.nongnu.org"
# Hosting information ends here

@@ -79,14 +83,6 @@ systemd = os.path.exists("/usr/share/systemd/system")

# Set distribution-specific defaults here
imloads = True
if sys.platform.startswith('linux'):
(distro, version, cutename) = platform.linux_distribution()
if distro == 'Fedora':
if int(version) >= 13:
# See https://fedoraproject.org/wiki/Features/ChangeInImplicitDSOLinking
imloads = False
elif os.path.exists("/etc/arch-release"):
imloads = False

# Does our platform has a working memory-barrier instruction?
# The shared-memory export won't be reliable without it.
@@ -155,6 +151,7 @@ boolopts = (
("python", True, "build Python support and modules."),
("debug", False, "include debug information in build"),
("profiling", False, "build with profiling enabled"),
("coveraging", False, "build with code coveraging enabled"),
("strip", True, "build with stripping of binaries enabled"),
("chrpath", True, "use chrpath to edit library load paths"),
)
@@ -163,7 +160,7 @@ for (name, default, help) in boolopts:

nonboolopts = (
("gpsd_user", "nobody", "privilege revocation user",),
("gpsd_group", "(undefined)", "privilege revocation group"),
("gpsd_group", "dialout", "privilege revocation group"),
("prefix", "/usr/local", "installation directory prefix"),
("limited_max_clients", 0, "maximum allowed clients"),
("limited_max_devices", 0, "maximum allowed devices"),
@@ -183,6 +180,7 @@ pathopts = (
("sbindir", "sbin", "system binaries directory"),
("mandir", "share/man", "manual pages directory"),
("docdir", "share/doc", "documents directory"),
("udevdir", "/lib/udev", "udev rules directory"),
("pkgconfig", "$libdir/pkgconfig", "pkgconfig file directory"),
)
for (name, default, help) in pathopts:
@@ -199,12 +197,14 @@ import_env = (
"LOGNAME", # LOGNAME is required for the flocktest production.
'PATH', # Required for ccache and Coverity scan-build
'PKG_CONFIG_PATH', # Set .pc file directory in a crossbuild
'STAGING_DIR', # Required by the OpenWRT build.
'STAGING_DIR', # Required by the OpenWRT and CeroWrt builds.
'STAGING_PREFIX', # Required by the OpenWRT and CeroWrt builds.
)
envs = {}
for var in import_env:
if var in os.environ:
envs[var] = os.environ[var]
envs["GPSD_HOME"] = os.getcwd()

env = Environment(tools=["default", "tar", "textfile"], options=opts, ENV=envs)
opts.Save('.scons-option-cache', env)
@@ -228,13 +228,13 @@ for i in ["AR", "ARFLAGS", "CCFLAGS", "CFLAGS", "CC", "CXX", "CXXFLAGS", "STRIP"
j = i
if i == "LD":
i = "SHLINK"
if i == "CFLAGS" or i == "CCFLAGS":
if i in ("CFLAGS", "CCFLAGS", "LINKFLAGS"):
env.Replace(**{j: Split(os.getenv(i))})
else:
env.Replace(**{j: os.getenv(i)})
for flags in ["LDFLAGS", "LINKFLAGS", "SHLINKFLAGS", "CPPFLAGS"]:
if os.environ.has_key(flags):
env.MergeFlags({flags : [os.getenv(flags)]})
for flag in ["LDFLAGS", "LINKFLAGS", "SHLINKFLAGS", "CPPFLAGS"]:
if os.environ.has_key(flag):
env.MergeFlags({flag : [os.getenv(flag)]})


# Keep scan-build options in the environment
@@ -242,6 +242,10 @@ for key, value in os.environ.iteritems():
if key.startswith('CCC_'):
env.Append(ENV={key:value})

# FIXME: Set up compilation for gcov - doesn't work yet.
if env['coveraging']:
env['CFLAGS'].append(['-fprofile-arcs', '-ftest-coverage'])

# Placeholder so we can kluge together something like VPATH builds.
# $SRCDIR replaces occurrences for $(srcdir) in the autotools build.
env['SRCDIR'] = '.'
@@ -253,8 +257,6 @@ def announce(msg):
# We need to define -D_GNU_SOURCE
env.Append(CFLAGS='-D_GNU_SOURCE')



# DESTDIR environment variable means user wants to prefix the installation root.
DESTDIR = os.environ.get('DESTDIR', '')

@@ -267,7 +269,10 @@ def installdir(dir, add_destdir=True):
return wrapped

# Honor the specified installation prefix in link paths.
env.Prepend(LIBPATH=[installdir('libdir')])
if not env["sysroot"]:
env.Prepend(LIBPATH=[installdir('libdir')])
else:
env.Prepend(LIBPATH=[env["sysroot"] + installdir('libdir')])
if env["shared"]:
env.Prepend(RPATH=[installdir('libdir')])

@@ -361,8 +366,8 @@ docbook_html_uri = docbook_url_stem + 'html/docbook.xsl'

def CheckXsltproc(context):
context.Message('Checking that xsltproc can make man pages... ')
with open("xmltest.xml", "w") as ofp:
ofp.write('''
ofp = open("xmltest.xml", "w")
ofp.write('''
<refentry id="foo.1">
<refmeta>
<refentrytitle>foo</refentrytitle>
@@ -375,6 +380,7 @@ def CheckXsltproc(context):
</refnamediv>
</refentry>
''')
ofp.close()
probe = "xsltproc --nonet --noout '%s' xmltest.xml" % (docbook_man_uri,)
ret = context.TryAction(probe)[0]
os.remove("xmltest.xml")
@@ -451,6 +457,8 @@ if env['ncurses']:
ncurseslibs = pkg_config('ncurses')
elif config.CheckExecutable('ncurses5-config --version', 'ncurses5-config'):
ncurseslibs = ['!ncurses5-config --libs --cflags']
elif config.CheckExecutable('ncursesw5-config --version', 'ncursesw5-config'):
ncurseslibs = ['!ncursesw5-config --libs --cflags']
elif sys.platform.startswith('freebsd'):
ncurseslibs= [ '-lncurses' ]
elif sys.platform.startswith('openbsd'):
@@ -508,7 +516,8 @@ else:
bluezlibs = []
env["bluez"] = False

if config.CheckHeader("sys/timepps.h"):
# ntpshm is required for pps support
if env['pps'] and env['ntpshm'] and config.CheckHeader("sys/timepps.h"):
confdefs.append("#define HAVE_SYS_TIMEPPS_H 1\n")
announce("You have kernel PPS available.")
else:
@@ -569,12 +578,28 @@ else:
confdefs.append("#define COMPAT_SELECT\n")

confdefs.append('''
/* will not handle pre-Intel Apples that can run big-endian */
#if defined __BIG_ENDIAN__
/* will not handle pre-Intel Apples that can run big-endian
__BIG_ENDIAN__ and __LITTLE_ENDIAN__ are define in some gcc versions
only, probably depending on the architecture. Try to use endian.h if
the gcc way fails - endian.h also doesn not seem to be available on all
platforms.
*/
#ifdef __BIG_ENDIAN__
#define WORDS_BIGENDIAN 1
#else /* __BIG_ENDIAN__ */
#ifdef __LITTLE_ENDIAN__
#undef WORDS_BIGENDIAN
#else
#include <endian.h>
#if __BYTE_ORDER == __BIG_ENDIAN
#define WORDS_BIGENDIAN 1
#elif __BYTE_ORDER == __LITTLE_ENDIAN
#undef WORDS_BIGENDIAN
#endif
#else
#error "unable to determine endianess!"
#endif /* __BYTE_ORDER */
#endif /* __LITTLE_ENDIAN__ */
#endif /* __BIG_ENDIAN__ */

/* Some libcs do not have strlcat/strlcpy. Local copies are provided */
#ifndef HAVE_STRLCAT
@@ -608,8 +633,9 @@ if config.CheckXsltproc():
manbuilder = build % docbook_man_uri
elif WhereIs("xmlto"):
mangenerator = 'xmlto'
htmlbuilder = "xmlto html-nochunks $SOURCE; mv `basename $TARGET` $TARGET"
manbuilder = "xmlto man $SOURCE; mv `basename $TARGET` $TARGET"
xmlto = "xmlto %s $SOURCE || mv `basename $TARGET` `dirname $TARGET`"
htmlbuilder = xmlto % "html-nochunks"
manbuilder = xmlto % "man"
else:
announce("Neither xsltproc nor xmlto found, documentation cannot be built.")
if manbuilder:
@@ -654,6 +680,8 @@ else:

libgps_version_soname = libgps_version_current - libgps_version_age
libgps_version = "%d.%d.%d" %(libgps_version_soname, libgps_version_age, libgps_version_revision)
libgpsd_version_soname = libgpsd_version_current - libgpsd_version_age
libgpsd_version = "%d.%d.%d" %(libgpsd_version_soname, libgpsd_version_age, libgpsd_version_revision)

libgps_sources = [
"ais_json.c",
@@ -717,7 +745,7 @@ libgpsd_sources = [
# Inspired by Richard Levitte's (slightly buggy) code at
# http://markmail.org/message/spttz3o4xrsftofr

def VersionedSharedLibrary(env, libname, libgps_version, lib_objs=[], parse_flags=[]):
def VersionedSharedLibrary(env, libname, version, lib_objs=[], parse_flags=[]):
platform = env.subst('$PLATFORM')
shlib_pre_action = None
shlib_suffix = env.subst('$SHLIBSUFFIX')
@@ -725,8 +753,8 @@ def VersionedSharedLibrary(env, libname, libgps_version, lib_objs=[], parse_flag
shlink_flags = SCons.Util.CLVar(env.subst('$SHLINKFLAGS'))

if platform == 'posix':
ilib_suffix = shlib_suffix + '.' + libgps_version
(major, age, revision) = libgps_version.split(".")
ilib_suffix = shlib_suffix + '.' + version
(major, age, revision) = version.split(".")
soname = "lib" + libname + shlib_suffix + "." + major
shlink_flags += [ '-Wl,-Bsymbolic', '-Wl,-soname=%s' % soname ]
elif platform == 'cygwin':
@@ -734,9 +762,9 @@ def VersionedSharedLibrary(env, libname, libgps_version, lib_objs=[], parse_flag
shlink_flags += [ '-Wl,-Bsymbolic',
'-Wl,--out-implib,${TARGET.base}.a' ]
elif platform == 'darwin':
ilib_suffix = '.' + libgps_version + shlib_suffix
shlink_flags += [ '-current_version', '%s' % libgps_version,
'-compatibility_version', '%s' % libgps_version,
ilib_suffix = '.' + version + shlib_suffix
shlink_flags += [ '-current_version', '%s' % version,
'-compatibility_version', '%s' % version,
'-undefined', 'dynamic_lookup' ]

ilib = env.SharedLibrary(libname,lib_objs,
@@ -744,20 +772,20 @@ def VersionedSharedLibrary(env, libname, libgps_version, lib_objs=[], parse_flag
SHLINKFLAGS=shlink_flags, parse_flags=parse_flags)

if platform == 'darwin':
if libgps_version.count(".") != 2:
if version.count(".") != 2:
# We need a library name in libfoo.x.y.z.dylib form to proceed
raise ValueError
lib = 'lib' + libname + '.' + libgps_version + '.dylib'
lib = 'lib' + libname + '.' + version + '.dylib'
lib_no_ver = 'lib' + libname + '.dylib'
# Link libfoo.x.y.z.dylib to libfoo.dylib
env.AddPostAction(ilib, 'rm -f %s; ln -s %s %s' % (
lib_no_ver, lib, lib_no_ver))
env.Clean(lib, lib_no_ver)
elif platform == 'posix':
if libgps_version.count(".") != 2:
if version.count(".") != 2:
# We need a library name in libfoo.so.x.y.z form to proceed
raise ValueError
lib = "lib" + libname + ".so." + libgps_version
lib = "lib" + libname + ".so." + version
suffix_re = '%s\\.[0-9\\.]*$' % re.escape(shlib_suffix)
# For libfoo.so.x.y.z, links libfoo.so libfoo.so.x.y libfoo.so.x
major_name = shlib_suffix + "." + lib.split(".")[2]
@@ -797,7 +825,7 @@ else:
def Library(env, target, sources, version, parse_flags=[]):
return VersionedSharedLibrary(env=env,
libname=target,
libgps_version=version,
version=version,
lib_objs=sources,
parse_flags=parse_flags)
LibraryInstall = lambda env, libdir, sources: \
@@ -815,7 +843,7 @@ env.Clean(compiled_gpslib, "gps_maskdump.c")
compiled_gpsdlib = Library(env=env,
target="gpsd",
sources=libgpsd_sources,
version=libgps_version,
version=libgpsd_version,
parse_flags=usblibs + rtlibs + bluezlibs)

libraries = [compiled_gpslib, compiled_gpsdlib]
@@ -838,8 +866,7 @@ if qt_env:
compile_with = qt_env['CC']
compile_flags = qt_env['CFLAGS']
qtobjects.append(qt_env.SharedObject(src.split(".")[0] + '-qt', src,
CC=compile_with,
CFLAGS=compile_flags,
CC=compile_with, CFLAGS=compile_flags,
parse_flags=dbus_libs))
compiled_qgpsmmlib = Library(qt_env, "Qgpsmm", qtobjects, libgps_version)
libraries.append(compiled_qgpsmmlib)
@@ -849,6 +876,22 @@ if qt_env:
gpslibs = ["-lgps", "-lm"]
gpsdlibs = ["-lgpsd"] + usblibs + bluezlibs + gpslibs + caplibs

# We need to be able to make a static client library for ad-hoc testing.
# (None of the normal targets relies on this.) You can use this
# with a build command like
#
# g++ --static streamtest.cpp libgps.a -lrt -o streamtest
#
# When you link with this library you will get warnings that look like this:
# warning: Using 'getprotobyname' in statically linked applications requires
# at runtime the shared libraries from the glibc version used for
# linking
# The final executable will build but not be portable.

env.StaticLibrary(target='libgps.a',
source=libgps_sources,
parse_flags=dbus_libs + rtlibs)

# Source groups

gpsd_sources = ['gpsd.c','ntpshm.c','shmexport.c','dbusexport.c']
@@ -881,6 +924,10 @@ gpsmon_sources = [
if not env['shared'] or not env["implicit_link"]:
env.MergeFlags("-lm")

# FIXME: Part of an attempt to support coverage testing.
if env['coveraging']:
env.MergeFlags("-lgcov")

gpsd_env = env.Clone()
gpsd_env.MergeFlags("-pthread")

@@ -920,7 +967,7 @@ if ncurseslibs:
# Test programs
test_float = env.Program('test_float', ['test_float.c'])
test_geoid = env.Program('test_geoid', ['test_geoid.c'], parse_flags=gpsdlibs)
env.Depends(test_geoid, compiled_gpsdlib)
env.Depends(test_geoid, [compiled_gpsdlib, compiled_gpslib])
test_json = env.Program('test_json', ['test_json.c'], parse_flags=gpslibs)
env.Depends(test_json, compiled_gpslib)
test_mkgmtime = env.Program('test_mkgmtime', ['test_mkgmtime.c'], parse_flags=gpslibs)
@@ -1020,8 +1067,9 @@ env.Command(target = "packet_names.h", source="packet_states.h", action="""
# build timebase.h
def timebase_h(target, source, env):
from leapsecond import make_leapsecond_include
with open(target[0].abspath, 'w') as f:
f.write(make_leapsecond_include(source[0].abspath))
f = open(target[0].abspath, 'w')
f.write(make_leapsecond_include(source[0].abspath))
f.close()
env.Command(target="timebase.h", source="leapseconds.cache",
action=timebase_h)

@@ -1080,6 +1128,7 @@ def substituter(target, source, env):
('@WEBSITE@', website),
('@MAINPAGE@', mainpage),
('@WEBUPLOAD@', webupload),
('@CGIUPLOAD@', cgiupload),
('@SCPUPLOAD@', scpupload),
('@MAILMAN@', mailman),
('@ADMIN@', admin),
@@ -1093,15 +1142,17 @@ def substituter(target, source, env):
('@DEVMAIL@', devmail),
('@LIBGPSVERSION@', libgps_version),
)
with open(str(source[0])) as sfp:
content = sfp.read()
sfp = open(str(source[0]))
content = sfp.read()
sfp.close()
for (s, t) in substmap:
content = content.replace(s, t)
m = re.search("@[A-Z]+@", content)
if m and m.group(0) not in map(lambda x: x[0], substmap):
print >>sys.stderr, "Unknown subst token %s in %s." % (m.group(0), sfp.name)
with open(str(target[0]), "w") as tfp:
tfp.write(content)
tfp = open(str(target[0]), "w")
tfp.write(content)
tfp.close()

templated = glob.glob("*.in") + glob.glob("*/*.in") + glob.glob("*/*/*.in")

@@ -1118,6 +1169,7 @@ base_manpages = {
"gpsd_json.5" : "gpsd_json.xml",
"gps.1" : "gps.xml",
"cgps.1" : "gps.xml",
"gpsinit.8": "gpsinit.xml",
"lcdgps.1" : "gps.xml",
"libgps.3" : "libgps.xml",
"libgpsmm.3" : "libgpsmm.xml",
@@ -1148,7 +1200,7 @@ if manbuilder:

build = env.Alias('build', [libraries, binaries, python_built_extensions, "gpsd.php", manpage_targets])
env.Clean(build,
map(glob.glob,("*.[oa]", "*.os", "*.os.*", "*.pyc", "gps/*.pyc")) + \
map(glob.glob,("*.[oa]", "*.os", "*.os.*", "*.gcno", "*.pyc", "gps/*.pyc")) + \
generated_sources + \
map(lambda f: f[:-3], templated) + \
[".sconf_temp"])
@@ -1180,7 +1232,6 @@ binaryinstall.append(LibraryInstall(env, installdir('libdir'), compiled_gpsdlib)
if qt_env:
binaryinstall.append(LibraryInstall(qt_env, installdir('libdir'), compiled_qgpsmmlib))

# We don't use installdir here in order to avoid having DESTDIR affect the rpath
if env["shared"] and env["chrpath"]:
env.AddPostAction(binaryinstall, '$CHRPATH -r "%s" "$TARGET"' \
% (installdir('libdir', False), ))
@@ -1217,11 +1268,12 @@ if qt_env:


maninstall = []
if manbuilder:
for manpage in base_manpages.keys() + python_manpages.keys():
section = manpage.split(".")[1]
dest = os.path.join(installdir('mandir'), "man"+section, manpage)
maninstall.append(env.InstallAs(source=manpage, target=dest))
for manpage in base_manpages.keys() + python_manpages.keys():
if not manbuilder and not os.path.exists(manpage):
continue
section = manpage.split(".")[1]
dest = os.path.join(installdir('mandir'), "man"+section, manpage)
maninstall.append(env.InstallAs(source=manpage, target=dest))
install = env.Alias('install', binaryinstall + maninstall + python_install + pc_install + headerinstall)

def Uninstall(nodes):
@@ -1254,7 +1306,12 @@ def Utility(target, source, action):

# Report splint warnings
# Note: test_bits.c is unsplintable because of the PRI64 macros.
env['SPLINTOPTS'] = "-I/usr/include/libusb-1.0 +quiet"
splintopts = "-I/usr/include/libusb-1.0 +quiet"
# splint does not know about multi-arch, work around that
ma_status, ma = _getstatusoutput('dpkg-architecture -qDEB_HOST_MULTIARCH')
if ma_status == 0:
splintopts = '-I/usr/include/%s %s' %(ma.strip(),splintopts)
env['SPLINTOPTS']=splintopts

def Splint(target,sources, description, params):
return Utility(target,sources+generated_sources,[
@@ -1288,11 +1345,11 @@ Utility("cppcheck", ["gpsd.h", "packet_names.h"],
"cppcheck --template gcc --enable=all --inline-suppr --suppress='*:driver_proto.c' --force $SRCDIR")

# Sanity-check Python code. TODO: add xgps for the complete set.
Utility("pychecker", ["jsongen.py", "maskaudit.py"],
Utility("pychecker", ["jsongen.py", "maskaudit.py", python_built_extensions],
['''for f in gpsprof gpscat gpsfake gegps; do ln -s $$f $$f.py; done; \
pychecker --no-classattr --no-callinit jsongen.py leapsecond.py maskaudit.py gpsprof.py gpscat.py gpsfake.py gegps.py gps/*.py;
for f in gpsprof gpscat gpsfake gegps; do rm $$f.py $$f.pyc; done'''])
Utility("pylint", ["jsongen.py", "maskaudit.py"],
Utility("pylint", ["jsongen.py", "maskaudit.py", python_built_extensions],
['''pylint --output-format=parseable --reports=n --include-ids=y --disable=F0001,C0103,C0111,C0301,C0302,C0322,C0324,C0323,C0321,R0201,R0902,R0903,R0904,R0911,R0912,R0913,R0914,R0915,W0201,W0401,W0141,W0142,W0603,W0614,W0621,E1101,E1102 jsongen.py leapsecond.py maskaudit.py gpsprof.py gpscat.py gpsfake.py gegps.py gps/*.py xgps'''])

# Check the documentation for bogons, too
@@ -1336,19 +1393,27 @@ if env['python']:
else:
python_compilation_regress = None

# Regression-test the daemon
gps_regress = Utility("gps-regress", [gpsd, python_built_extensions],
# using regress-drivers requires socket_export being enabled.
if env['socket_export']:
# Regression-test the daemon
gps_regress = [Utility("gps-regress", [gpsd, python_built_extensions],
'$SRCDIR/regress-driver test/daemon/*.log')]

# Test that super-raw mode works. Compare each logfile against itself
# dumped through the daemon running in R=2 mode. (This test is not
# included in the normal regressions.)
Utility("raw-regress", [gpsd, python_built_extensions],
'$SRCDIR/regress-driver test/daemon/*.log')

# Test that super-raw mode works. Compare each logfile against itself
# dumped through the daemon running in R=2 mode. (This test is not
# included in the normal regressions.)
Utility("raw-regress", [gpsd, python_built_extensions],
'$SRCDIR/regress-driver test/daemon/*.log')

# Build the regression tests for the daemon.
Utility('gps-makeregress', [gpsd, python_built_extensions],
'$SRCDIR/regress-driver -b test/daemon/*.log')
# Build the regression tests for the daemon.
# Note: You'll have to do this whenever the default leap second
# changes in timebase.h. The problem is in the SiRF tests;
# that driver relies on the default until it gets the current
# offset from subframe data.
Utility('gps-makeregress', [gpsd, python_built_extensions],
'$SRCDIR/regress-driver -b test/daemon/*.log')
else:
gps_regress = []

# To build an individual test for a load named foo.log, put it in
# test/daemon and do this:
@@ -1357,16 +1422,16 @@ Utility('gps-makeregress', [gpsd, python_built_extensions],
# Regression-test the RTCM decoder.
rtcm_regress = Utility('rtcm-regress', [gpsdecode], [
'@echo "Testing RTCM decoding..."',
'for f in $SRCDIR/test/*.rtcm2; do '
'@for f in $SRCDIR/test/*.rtcm2; do '
'echo "Testing $${f}..."; '
'TMPFILE=`mktemp -t gpsd-test-XXXXXXXXXXXXXX.chk`; '
'$SRCDIR/gpsdecode -j <$${f} >$${TMPFILE}; '
'$SRCDIR/gpsdecode -u -j <$${f} >$${TMPFILE}; '
'diff -ub $${f}.chk $${TMPFILE}; '
'rm -f $${TMPFILE}; '
'done;',
'@echo "Testing idempotency of JSON dump/decode for RTCM2"',
'TMPFILE=`mktemp -t gpsd-test-XXXXXXXXXXXXXX.chk`; '
'$SRCDIR/gpsdecode -e -j <test/synthetic-rtcm2.json >$${TMPFILE}; '
'@TMPFILE=`mktemp -t gpsd-test-XXXXXXXXXXXXXX.chk`; '
'$SRCDIR/gpsdecode -u -e -j <test/synthetic-rtcm2.json >$${TMPFILE}; '
'grep -v "^#" test/synthetic-rtcm2.json | diff -ub - $${TMPFILE}; '
'rm -f $${TMPFILE}; ',
])
@@ -1380,18 +1445,41 @@ Utility('rtcm-makeregress', [gpsdecode], [

# Regression-test the AIVDM decoder.
aivdm_regress = Utility('aivdm-regress', [gpsdecode], [
'@echo "Testing AIVDM decoding..."',
'for f in $SRCDIR/test/*.aivdm; do '
'@echo "Testing AIVDM decoding w/ CSV format..."',
'@for f in $SRCDIR/test/*.aivdm; do '
'echo "Testing $${f}..."; '
'TMPFILE=`mktemp -t gpsd-test-XXXXXXXXXXXXXX.chk`; '
'$SRCDIR/gpsdecode -u -c <$${f} >$${TMPFILE}; '
'diff -ub $${f}.chk $${TMPFILE}; '
'diff -ub $${f}.chk $${TMPFILE} || echo "Test FAILED!"; '
'rm -f $${TMPFILE}; '
'done;',
'@echo "Testing AIVDM decoding w/ JSON unscaled format..."',
'@for f in $SRCDIR/test/*.aivdm; do '
'echo " Testing $${f}..."; '
'TMPFILE=`mktemp -t gpsd-test-XXXXXXXXXXXXXX.chk`; '
'$SRCDIR/gpsdecode -u -j <$${f} >$${TMPFILE}; '
'diff -ub $${f}.ju.chk $${TMPFILE} || echo "Test FAILED!"; '
'rm -f $${TMPFILE}; '
'done;',
'@echo "Testing idempotency of JSON dump/decode for AIS"',
'TMPFILE=`mktemp -t gpsd-test-XXXXXXXXXXXXXX.chk`; '
'$SRCDIR/gpsdecode -e -j <$SRCDIR/test/synthetic-ais.json >$${TMPFILE}; '
'grep -v "^#" $SRCDIR/test/synthetic-ais.json | diff -ub - $${TMPFILE}; '
'@echo "Testing AIVDM decoding w/ JSON scaled format..."',
'@for f in $SRCDIR/test/*.aivdm; do '
'echo " Testing $${f}..."; '
'TMPFILE=`mktemp -t gpsd-test-XXXXXXXXXXXXXX.chk`; '
'$SRCDIR/gpsdecode -j <$${f} >$${TMPFILE}; '
'diff -ub $${f}.js.chk $${TMPFILE} || echo "Test FAILED!"; '
'rm -f $${TMPFILE}; '
'done;',
'@echo "Testing idempotency of unscaled JSON dump/decode for AIS"',
'@TMPFILE=`mktemp -t gpsd-test-XXXXXXXXXXXXXX.chk`; '
'$SRCDIR/gpsdecode -u -e -j <$SRCDIR/test/sample.aivdm.ju.chk >$${TMPFILE}; '
'grep -v "^#" $SRCDIR/test/sample.aivdm.ju.chk | diff -ub - $${TMPFILE}; '
'rm -f $${TMPFILE}; ',
# Parse the unscaled json reference, dump it as scaled json,
# and finally compare it with the scaled json reference
'@echo "Testing idempotency of scaled JSON dump/decode for AIS"',
'@TMPFILE=`mktemp -t gpsd-test-XXXXXXXXXXXXXX.chk`; '
'$SRCDIR/gpsdecode -e -j <$SRCDIR/test/sample.aivdm.ju.chk >$${TMPFILE}; '
'grep -v "^#" $SRCDIR/test/sample.aivdm.js.chk | diff -ub - $${TMPFILE}; '
'rm -f $${TMPFILE}; ',
])

@@ -1399,6 +1487,8 @@ aivdm_regress = Utility('aivdm-regress', [gpsdecode], [
Utility('aivdm-makeregress', [gpsdecode], [
'for f in $SRCDIR/test/*.aivdm; do '
'$SRCDIR/gpsdecode -u -c <$${f} > $${f}.chk; '
'$SRCDIR/gpsdecode -u -j <$${f} > $${f}.ju.chk; '
'$SRCDIR/gpsdecode -j <$${f} > $${f}.js.chk; '
'done',
])

@@ -1424,7 +1514,7 @@ geoid_regress = Utility('geoid-regress', [test_geoid], [
])

# Regression-test the Maidenhead Locator
maidenhead_locator_regress = Utility('maidenhead-locator-regress', [], [
maidenhead_locator_regress = Utility('maidenhead-locator-regress', [python_built_extensions], [
'@echo "Testing the Maidenhead Locator conversion..."',
'$SRCDIR/test_maidenhead.py >/dev/null',
])
@@ -1452,16 +1542,18 @@ json_regress = Utility('json-regress', [test_json], [
])

# Run a valgrind audit on the daemon - not in normal tests
valgrind_audit = Utility('valgrind-audit', ['valgrind-audit.py'], 'valgrind-audit.py')
valgrind_audit = Utility('valgrind-audit',
['$SRCDIR/valgrind-audit.py', python_built_extensions, gpsd],
'./valgrind-audit.py'
)

# Run test builds on remote machines
flocktest = Utility("flocktest", [], "cd devtools; flocktest " + gitrepo)
flocktest = Utility("flocktest", [], "cd devtools; ./flocktest " + gitrepo)

# Run all normal regression tests
check = env.Alias('check', [
python_compilation_regress,
bits_regress,
gps_regress,
rtcm_regress,
aivdm_regress,
packet_regress,
@@ -1470,7 +1562,7 @@ check = env.Alias('check', [
time_regress,
unpack_regress,
json_regress,
])
] + gps_regress)

env.Alias('testregress', check)

@@ -1482,7 +1574,7 @@ env.Alias('testregress', check)
webpages = Split('''www/installation.html
www/gpscat.html www/gpsctl.html www/gpsdecode.html
www/gpsd.html www/gpsd_json.html www/gpsfake.html www/gpsmon.html
www/gpspipe.html www/gpsprof.html www/gps.html
www/gpspipe.html www/gpsprof.html www/gps.html www/gpsinit.html
www/libgpsd.html www/libgpsmm.html www/libgps.html
www/srec.html
www/AIVDM.html www/NMEA.html
@@ -1501,15 +1593,18 @@ www = env.Alias('www', webpages)
def validation_list(target, source, env):
for page in glob.glob("www/*.html"):
if not '-head' in page:
with open(page) as fp:
if "Valid HTML" in fp.read():
print os.path.join(website, os.path.basename(page))
fp = open(page)
if "Valid HTML" in fp.read():
print os.path.join(website, os.path.basename(page))
fp.close()
Utility("validation-list", [www], validation_list)

# How to update the website
upload_web = Utility("upload_web", [www],
['rsync --exclude="*.in" -avz www/ ' + webupload,
'scp README TODO NEWS ' + webupload])
'scp README TODO NEWS ' + webupload,
'chmod ug+w,a+x www/gps_report.cgi',
'scp www/gps_report.cgi ' + cgiupload + "gps_report.cgi"])

# When the URL declarations change, so must the generated web pages
for fn in glob.glob("www/*.in"):
@@ -1537,7 +1632,7 @@ if htmlbuilder:

# The internals manual.
# Doesn't capture dependencies on the subpages
env.HTML('www/internals.html', '$SRCDIR/doc/explanation.xml')
env.HTML('www/internals.html', '$SRCDIR/doc/internals.xml')

# The hardware page
env.Command('www/hardware.html', ['gpscap.py',
@@ -1570,15 +1665,15 @@ if env['python']:
# is plugged in.

Utility('udev-install', 'install', [
'mkdir -p ' + DESTDIR + '/lib/udev/rules.d',
'cp $SRCDIR/gpsd.rules ' + DESTDIR + '/lib/udev/rules.d/25-gpsd.rules',
'cp $SRCDIR/gpsd.hotplug ' + DESTDIR + '/lib/udev/',
'chmod a+x ' + DESTDIR + '/lib/udev/gpsd.hotplug',
'mkdir -p ' + DESTDIR + env['udevdir'] + '/rules.d',
'cp $SRCDIR/gpsd.rules ' + DESTDIR + env['udevdir'] + '/rules.d/25-gpsd.rules',
'cp $SRCDIR/gpsd.hotplug ' + DESTDIR + env['udevdir'],
'chmod a+x ' + DESTDIR + env['udevdir'] + '/gpsd.hotplug',
])

Utility('udev-uninstall', '', [
'rm -f /lib/udev/gpsd.hotplug',
'rm -f /lib/udev/rules.d/25-gpsd.rules',
'rm -f %s/gpsd.hotplug' % env['udevdir'],
'rm -f %s/rules.d/25-gpsd.rules' % env['udevdir'],
])

Utility('udev-test', '', [


+ 9
- 20
TODO View File

@@ -10,19 +10,13 @@ the "Upstream Bugs" page on the project website.

** Bugs in gpsd and its clients:

*** Old Earthmate support is currently broken

Support for the the pre-2003 version of the Earthmate using Zodiac
binary protocol is currently broken. Sometime after 2.96 the code
for dealing with the EARTHA handshake came unstuck.

*** Tracker bugs

See the GPSD bug tracker on the project website, but don't be
surprised if it's empty or very sparse. Our rate of new defects per
month is quite low.

** Dispatcher/network issues
*** Dispatcher/network issues

**** Reading AISHub data via UDP confuses xgps with short writes

@@ -32,12 +26,6 @@ packet aggregation issue as it doesn't happen with test logs.

*** Driver issues

**** There are portability issues in the rtcm2 driver

The rtcm2 binary driver fails port testing on the following
architectures: s390, s390x, and sparc. This is probably due
to the compiler not honoring #pragma pack(1).

**** gpsctl -b should work on UBX, but does not.

Presently this means there's no way to kick a UBX into returning
@@ -54,13 +42,20 @@ different types in them, and a copy of the RTCM3 standard at latest revision

This one is mine and Kurt Schwehr's. Support is currently nearly
complete; the only missing cases are a handful of IMO 236 and IMO 289
message 6 and 8 subtypes - specifically, 6/23, 8/21. 8/22, 8/24, and
message 6 and 8 subtypes - specifically, 6/23, 8/21, 8/22, 8/24, and
8/26.

**** Addressed case of AIS Types 25 and 26 is not handled.

We'd need machinery to shift a byte array 30 bits left...

**** JSON passthrough for AIS

Roy Barkas wants to be able to pass custom JSON up to GPSD in an
armored AIS sentence, so all his clients will get it. See
http://lists.nongnu.org/archive/html/gpsd-dev/2013-01/msg00022.html
for the full proposal.

** Ports

*** Windows port
@@ -170,12 +165,6 @@ handle all the quantities required, and it is actually in use in
production reference networks. RT-IGS is also a packet-oriented
format, rather than a file-oriented format like RINEX.

*** NOFLOAT build

We want to be able to build a minimalist version that doesn't require
floating-point arithmetic, for deployment on low-power ARM devices
without FPU.

*** Support for more survey / professional / up-scale receivers.

Devices such as the Javad JNSCore, Hemisphere Crescent, Septentrio


+ 31
- 17
ais_json.c View File

@@ -22,7 +22,7 @@ representations to libgps structures.

/* FIXME: kluges because we don't want to include gpsd.h here */
extern int gpsd_hexpack(/*@in@*/const char *, /*@out@*/char *, size_t);
int json_ais_read(const char *, char *, size_t, struct ais_t *,
int json_ais_read(const char *, char *, size_t, struct ais_t *,
/*@null@*/const char **);

/*@ -mustdefine @*/
@@ -97,13 +97,14 @@ int json_ais_read(const char *buf,
ais->type4.hour = AIS_HOUR_NOT_AVAILABLE;
ais->type4.minute = AIS_MINUTE_NOT_AVAILABLE;
ais->type4.second = AIS_SECOND_NOT_AVAILABLE;
// We use %09u for the date to allow for dodgy years (>9999) to go through
// cppcheck-suppress uninitvar
(void)sscanf(timestamp, "%4u-%02u-%02uT%02u:%02u:%02uZ",
(void)sscanf(timestamp, "%09u-%02u-%02uT%02u:%02u:%02uZ",
&ais->type4.year,
&ais->type4.month,
&ais->type4.day,
&ais->type4.hour,
&ais->type4.minute,
&ais->type4.minute,
&ais->type4.second);
}
} else if (strstr(buf, "\"type\":5,") != NULL) {
@@ -117,7 +118,7 @@ int json_ais_read(const char *buf,
(void)sscanf(eta, "%02u-%02uT%02u:%02uZ",
&ais->type5.month,
&ais->type5.day,
&ais->type5.hour,
&ais->type5.hour,
&ais->type5.minute);
}
} else if (strstr(buf, "\"type\":6,") != NULL) {
@@ -134,7 +135,7 @@ int json_ais_read(const char *buf,
(void)sscanf(departure, "%02u-%02uT%02u:%02uZ",
&ais->type6.dac1fid12.lmonth,
&ais->type6.dac1fid12.lday,
&ais->type6.dac1fid12.lhour,
&ais->type6.dac1fid12.lhour,
&ais->type6.dac1fid12.lminute);
ais->type6.dac1fid12.nmonth = AIS_MONTH_NOT_AVAILABLE;
ais->type6.dac1fid12.nday = AIS_DAY_NOT_AVAILABLE;
@@ -144,7 +145,7 @@ int json_ais_read(const char *buf,
(void)sscanf(eta, "%02u-%02uT%02u:%02uZ",
&ais->type6.dac1fid12.nmonth,
&ais->type6.dac1fid12.nday,
&ais->type6.dac1fid12.nhour,
&ais->type6.dac1fid12.nhour,
&ais->type6.dac1fid12.nminute);
}
imo = true;
@@ -157,16 +158,17 @@ int json_ais_read(const char *buf,
status = json_read_object(buf, json_ais6_fid16, endptr);
imo = true;
}
else if (strstr(buf, "\"fid\":18,") != NULL || strstr(buf, "\"fid\":11,") != NULL) {
else if (strstr(buf, "\"fid\":18,") != NULL) {
status = json_read_object(buf, json_ais6_fid18, endptr);
if (status == 0) {
ais->type6.dac1fid18.day = AIS_DAY_NOT_AVAILABLE;
ais->type6.dac1fid18.hour = AIS_HOUR_NOT_AVAILABLE;
ais->type6.dac1fid18.minute = AIS_MINUTE_NOT_AVAILABLE;
// cppcheck-suppress uninitvar
(void)sscanf(arrival, "%02uT%02u:%02uZ",
(void)sscanf(arrival, "%02u-%02uT%02u:%02uZ",
&ais->type6.dac1fid18.month,
&ais->type6.dac1fid18.day,
&ais->type6.dac1fid18.hour,
&ais->type6.dac1fid18.hour,
&ais->type6.dac1fid18.minute);
}
imo = true;
@@ -182,7 +184,7 @@ int json_ais_read(const char *buf,
(void)sscanf(arrival, "%02u-%02uT%02u:%02uZ",
&ais->type6.dac1fid20.month,
&ais->type6.dac1fid20.day,
&ais->type6.dac1fid20.hour,
&ais->type6.dac1fid20.hour,
&ais->type6.dac1fid20.minute);
}
imo = true;
@@ -202,7 +204,7 @@ int json_ais_read(const char *buf,
(void)sscanf(start, "%02u-%02uT%02u:%02uZ",
&ais->type6.dac1fid28.month,
&ais->type6.dac1fid28.day,
&ais->type6.dac1fid28.hour,
&ais->type6.dac1fid28.hour,
&ais->type6.dac1fid28.minute);
}
imo = true;
@@ -216,6 +218,12 @@ int json_ais_read(const char *buf,
imo = true;
}
}
else if (strstr(buf, "\"dac\":235,") != NULL || strstr(buf, "\"dac\":250,") != NULL) {
if (strstr(buf, "\"fid\":10,") != NULL) {
status = json_read_object(buf, json_ais6_fid10, endptr);
imo = true;
}
}
if (!imo) {
status = json_read_object(buf, json_ais6, endptr);
if (status == 0)
@@ -237,7 +245,7 @@ int json_ais_read(const char *buf,
// cppcheck-suppress uninitvar
(void)sscanf(timestamp, "%02uT%02u:%02uZ",
&ais->type8.dac1fid11.day,
&ais->type8.dac1fid11.hour,
&ais->type8.dac1fid11.hour,
&ais->type8.dac1fid11.minute);
}
imo = true;
@@ -253,7 +261,7 @@ int json_ais_read(const char *buf,
(void)sscanf(departure, "%02u-%02uT%02u:%02uZ",
&ais->type8.dac1fid13.fmonth,
&ais->type8.dac1fid13.fday,
&ais->type8.dac1fid13.fhour,
&ais->type8.dac1fid13.fhour,
&ais->type8.dac1fid13.fminute);
ais->type8.dac1fid13.tmonth = AIS_MONTH_NOT_AVAILABLE;
ais->type8.dac1fid13.tday = AIS_DAY_NOT_AVAILABLE;
@@ -263,7 +271,7 @@ int json_ais_read(const char *buf,
(void)sscanf(eta, "%02u-%02uT%02u:%02uZ",
&ais->type8.dac1fid13.tmonth,
&ais->type8.dac1fid13.tday,
&ais->type8.dac1fid13.thour,
&ais->type8.dac1fid13.thour,
&ais->type8.dac1fid13.tminute);
}
imo = true;
@@ -291,7 +299,7 @@ int json_ais_read(const char *buf,
(void)sscanf(start, "%02u-%02uT%02u:%02uZ",
&ais->type8.dac1fid27.month,
&ais->type8.dac1fid27.day,
&ais->type8.dac1fid27.hour,
&ais->type8.dac1fid27.hour,
&ais->type8.dac1fid27.minute);
}
imo = true;
@@ -307,9 +315,9 @@ int json_ais_read(const char *buf,
ais->type8.dac1fid31.hour = AIS_HOUR_NOT_AVAILABLE;
ais->type8.dac1fid31.minute = AIS_MINUTE_NOT_AVAILABLE;
// cppcheck-suppress uninitvar
(void)sscanf(eta, "%02uT%02u:%02uZ",
(void)sscanf(timestamp, "%02uT%02u:%02uZ",
&ais->type8.dac1fid31.day,
&ais->type8.dac1fid31.hour,
&ais->type8.dac1fid31.hour,
&ais->type8.dac1fid31.minute);
}
imo = true;
@@ -354,8 +362,14 @@ int json_ais_read(const char *buf,
status = json_read_object(buf, json_ais24, endptr);
} else if (strstr(buf, "\"type\":25,") != NULL) {
status = json_read_object(buf, json_ais25, endptr);
if (status == 0)
lenhex_unpack(data, &ais->type25.bitcount,
ais->type25.bitdata, sizeof(ais->type25.bitdata));
} else if (strstr(buf, "\"type\":26,") != NULL) {
status = json_read_object(buf, json_ais26, endptr);
if (status == 0)
lenhex_unpack(data, &ais->type26.bitcount,
ais->type26.bitdata, sizeof(ais->type26.bitdata));
} else if (strstr(buf, "\"type\":27,") != NULL) {
status = json_read_object(buf, json_ais27, endptr);
} else {


+ 49
- 14
ais_json.i View File

@@ -98,6 +98,28 @@
{NULL}
};

const struct json_attr_t json_ais6_fid10[] = {
AIS_HEADER
AIS_TYPE6
{"ana_int", t_uinteger, .addr.uinteger = &ais->type6.dac235fid10.ana_int,
.dflt.uinteger = 0},
{"ana_ext1", t_uinteger, .addr.uinteger = &ais->type6.dac235fid10.ana_ext1,
.dflt.uinteger = 0},
{"ana_ext2", t_uinteger, .addr.uinteger = &ais->type6.dac235fid10.ana_ext2,
.dflt.uinteger = 0},
{"racon", t_uinteger, .addr.uinteger = &ais->type6.dac235fid10.racon,
.dflt.uinteger = 0},
{"light", t_uinteger, .addr.uinteger = &ais->type6.dac235fid10.light,
.dflt.uinteger = 0},
{"alarm", t_boolean, .addr.boolean = &ais->type6.dac235fid10.alarm,
.dflt.boolean = false},
{"stat_ext", t_uinteger, .addr.uinteger = &ais->type6.dac235fid10.stat_ext,
.dflt.uinteger = 0},
{"off_pos", t_boolean, .addr.boolean = &ais->type6.dac235fid10.off_pos,
.dflt.boolean = false},
{NULL}
};

char departure[JSON_VAL_MAX+1];
const struct json_attr_t json_ais6_fid12[] = {
AIS_HEADER
@@ -144,6 +166,7 @@
.dflt.uinteger = 0},
{"subtype", t_uinteger,STRUCTOBJECT(struct cargo_t, subtype),
.dflt.uinteger = 0},
{NULL}
};
/*@-type@*//* STRUCTARRAY confuses splint */
const struct json_attr_t json_ais6_fid25[] = {
@@ -260,6 +283,7 @@
.dflt.integer = AIS_LON4_NOT_AVAILABLE},
{"lat", t_integer, STRUCTOBJECT(struct waypoint_t, lat),
.dflt.integer = AIS_LAT4_NOT_AVAILABLE},
{NULL}
};
/*@-type@*//* STRUCTARRAY confuses splint */
const struct json_attr_t json_ais6_fid28[] = {
@@ -307,6 +331,7 @@
.dflt.uinteger = DAC1FID32_CDIR_NOT_AVAILABLE},
{"cspeed", t_uinteger,STRUCTOBJECT(struct tidal_t, cspeed),
.dflt.uinteger = DAC1FID32_CSPEED_NOT_AVAILABLE},
{NULL}
};
/*@-type@*//* STRUCTARRAY confuses splint */
const struct json_attr_t json_ais6_fid32[] = {
@@ -359,12 +384,12 @@
.dflt.uinteger = DAC1FID11_WDIR_NOT_AVAILABLE},
{"wgustdir", t_uinteger, .addr.uinteger = &ais->type8.dac1fid11.wgustdir,
.dflt.uinteger = DAC1FID11_WDIR_NOT_AVAILABLE},
{"airtemp", t_integer, .addr.integer = &ais->type8.dac1fid11.airtemp,
.dflt.integer = DAC1FID11_AIRTEMP_NOT_AVAILABLE},
{"airtemp", t_uinteger, .addr.uinteger = &ais->type8.dac1fid11.airtemp,
.dflt.uinteger = DAC1FID11_AIRTEMP_NOT_AVAILABLE},
{"humidity", t_uinteger, .addr.uinteger = &ais->type8.dac1fid11.humidity,
.dflt.uinteger = DAC1FID11_HUMIDITY_NOT_AVAILABLE},
{"dewpoint", t_integer, .addr.integer = &ais->type8.dac1fid11.dewpoint,
.dflt.integer = DAC1FID11_DEWPOINT_NOT_AVAILABLE},
{"dewpoint", t_uinteger, .addr.uinteger = &ais->type8.dac1fid11.dewpoint,
.dflt.uinteger = DAC1FID11_DEWPOINT_NOT_AVAILABLE},
{"pressure", t_uinteger, .addr.uinteger = &ais->type8.dac1fid11.pressure,
.dflt.uinteger = DAC1FID11_PRESSURE_NOT_AVAILABLE},
{"pressuretend", t_uinteger, .addr.uinteger = &ais->type8.dac1fid11.pressuretend,
@@ -374,7 +399,7 @@
{"waterlevel", t_integer, .addr.integer = &ais->type8.dac1fid11.waterlevel,
.dflt.integer = DAC1FID11_WATERLEVEL_NOT_AVAILABLE},
{"leveltrend", t_uinteger, .addr.uinteger = &ais->type8.dac1fid11.leveltrend,
.dflt.uinteger = DAC1FID11_LEVELTREND_NOT_AVAILABLE},
.dflt.uinteger = DAC1FID11_WATERLEVELTREND_NOT_AVAILABLE},
{"cspeed", t_uinteger, .addr.uinteger = &ais->type8.dac1fid11.cspeed,
.dflt.uinteger = DAC1FID11_CSPEED_NOT_AVAILABLE},
{"cdir", t_uinteger, .addr.uinteger = &ais->type8.dac1fid11.cdir,
@@ -405,8 +430,8 @@
.dflt.uinteger = DAC1FID11_WAVEDIR_NOT_AVAILABLE},
{"seastate", t_uinteger, .addr.uinteger = &ais->type8.dac1fid11.seastate,
.dflt.uinteger = DAC1FID11_SEASTATE_NOT_AVAILABLE},
{"watertemp", t_integer, .addr.integer = &ais->type8.dac1fid11.watertemp,
.dflt.integer = DAC1FID11_WATERTEMP_NOT_AVAILABLE},
{"watertemp", t_uinteger, .addr.uinteger = &ais->type8.dac1fid11.watertemp,
.dflt.uinteger = DAC1FID11_WATERTEMP_NOT_AVAILABLE},
{"preciptype", t_uinteger, .addr.uinteger = &ais->type8.dac1fid11.preciptype,
.dflt.uinteger = DAC1FID11_PRECIPTYPE_NOT_AVAILABLE},
{"salinity", t_uinteger, .addr.uinteger = &ais->type8.dac1fid11.salinity,
@@ -477,6 +502,7 @@
.dflt.uinteger = AIS_SECOND_NOT_AVAILABLE},
{"speed", t_uinteger,STRUCTOBJECT(struct target_t, speed),
.dflt.uinteger = DAC1FID17_SPEED_NOT_AVAILABLE},
{NULL}
};
/*@-type@*//* STRUCTARRAY confuses splint */
const struct json_attr_t json_ais8_fid17[] = {
@@ -516,6 +542,7 @@
.dflt.integer = AIS_LON4_NOT_AVAILABLE},
{"lat", t_integer, STRUCTOBJECT(struct waypoint_t, lat),
.dflt.integer = AIS_LAT4_NOT_AVAILABLE},
{NULL}
};
/*@-type@*//* STRUCTARRAY confuses splint */
const struct json_attr_t json_ais8_fid27[] = {
@@ -555,9 +582,11 @@
.dflt.integer = DAC1FID31_LAT_NOT_AVAILABLE},
{"accuracy", t_boolean, .addr.boolean = &ais->type8.dac1fid31.accuracy,
.dflt.boolean = false},
{"timestamp", t_string, .addr.string = timestamp,
.len = sizeof(timestamp)},
{"wspeed", t_uinteger, .addr.uinteger = &ais->type8.dac1fid31.wspeed,
.dflt.uinteger = DAC1FID31_WIND_NOT_AVAILABLE},
{"wgust ", t_uinteger, .addr.uinteger = &ais->type8.dac1fid31.wgust ,
{"wgust", t_uinteger, .addr.uinteger = &ais->type8.dac1fid31.wgust,
.dflt.uinteger = DAC1FID31_WIND_NOT_AVAILABLE},
{"wdir", t_uinteger, .addr.uinteger = &ais->type8.dac1fid31.wdir,
.dflt.uinteger = DAC1FID31_DIR_NOT_AVAILABLE},
@@ -565,18 +594,22 @@
.dflt.uinteger = DAC1FID31_DIR_NOT_AVAILABLE},
{"airtemp", t_integer, .addr.integer = &ais->type8.dac1fid31.airtemp,
.dflt.integer = DAC1FID31_AIRTEMP_NOT_AVAILABLE},
{"humidity", t_uinteger, .addr.uinteger = &ais->type8.dac1fid31.humidity,
.dflt.uinteger = DAC1FID31_HUMIDITY_NOT_AVAILABLE},
{"dewpoint", t_integer, .addr.integer = &ais->type8.dac1fid31.dewpoint,
.dflt.integer = DAC1FID31_DEWPOINT_NOT_AVAILABLE},
{"pressure", t_uinteger, .addr.uinteger = &ais->type8.dac1fid31.pressure,
.dflt.uinteger = DAC1FID31_PRESSURE_NOT_AVAILABLE},
{"pressuretend", t_uinteger, .addr.uinteger = &ais->type8.dac1fid31.pressuretend,
.dflt.uinteger = DAC1FID31_PRESSURETREND_NOT_AVAILABLE},
{"visibility", t_uinteger, .addr.uinteger = &ais->type8.dac1fid31.visibility,
.dflt.uinteger = DAC1FID31_VISIBILITY_NOT_AVAILABLE},
.dflt.uinteger = DAC1FID31_PRESSURETEND_NOT_AVAILABLE},
{"visgreater", t_boolean, .addr.boolean = &ais->type8.dac1fid31.visgreater,
.dflt.boolean = false},
{"visibility", t_uinteger, .addr.uinteger = &ais->type8.dac1fid31.visibility,
.dflt.uinteger = DAC1FID31_VISIBILITY_NOT_AVAILABLE},
{"waterlevel", t_integer, .addr.integer = &ais->type8.dac1fid31.waterlevel,
.dflt.integer = DAC1FID31_WATERLEVEL_NOT_AVAILABLE},
{"leveltrend", t_uinteger, .addr.uinteger = &ais->type8.dac1fid31.leveltrend,
.dflt.uinteger = DAC1FID31_LEVELTREND_NOT_AVAILABLE},
.dflt.uinteger = DAC1FID31_WATERLEVELTREND_NOT_AVAILABLE},
{"cspeed", t_uinteger, .addr.uinteger = &ais->type8.dac1fid31.cspeed,
.dflt.uinteger = DAC1FID31_CSPEED_NOT_AVAILABLE},
{"cdir", t_uinteger, .addr.uinteger = &ais->type8.dac1fid31.cdir,
@@ -607,12 +640,14 @@
.dflt.uinteger = DAC1FID31_DIR_NOT_AVAILABLE},
{"seastate", t_uinteger, .addr.uinteger = &ais->type8.dac1fid31.seastate,
.dflt.uinteger = DAC1FID31_SEASTATE_NOT_AVAILABLE},
{"watertemp", t_integer, .addr.integer = &ais->type8.dac1fid31.watertemp,
.dflt.integer = DAC1FID31_WATERTEMP_NOT_AVAILABLE},
{"preciptype", t_uinteger, .addr.uinteger = &ais->type8.dac1fid31.preciptype,
.dflt.uinteger = DAC1FID31_PRECIPTYPE_NOT_AVAILABLE},
{"salinity", t_uinteger, .addr.uinteger = &ais->type8.dac1fid31.salinity,
.dflt.uinteger = DAC1FID31_SALINITY_NOT_AVAILABLE},
{"ice", t_boolean, .addr.boolean = &ais->type8.dac1fid31.ice,
.dflt.boolean = false},
{"ice", t_uinteger, .addr.uinteger = &ais->type8.dac1fid31.ice,
.dflt.uinteger = DAC1FID31_ICE_NOT_AVAILABLE},
{NULL}
};



+ 75
- 22
bits.c View File

@@ -17,7 +17,7 @@

#include "bits.h"

uint64_t ubits(char buf[], unsigned int start, unsigned int width, bool le)
uint64_t ubits(unsigned char buf[], unsigned int start, unsigned int width, bool le)
/* extract a (zero-origin) bitfield from the buffer as an unsigned big-endian uint64_t */
{
uint64_t fld = 0;
@@ -58,10 +58,10 @@ uint64_t ubits(char buf[], unsigned int start, unsigned int width, bool le)
return fld;
}

int64_t sbits(char buf[], unsigned int start, unsigned int width, bool le)
int64_t sbits(signed char buf[], unsigned int start, unsigned int width, bool le)
/* extract a bitfield from the buffer as a signed big-endian long */
{
uint64_t fld = ubits(buf, start, width, le);
uint64_t fld = ubits((unsigned char *)buf, start, width, le);

/*@ +relaxtypes */
if (fld & (1LL << (width - 1))) {
@@ -73,39 +73,92 @@ int64_t sbits(char buf[], unsigned int start, unsigned int width, bool le)
/*@ -relaxtypes */
}

union int_float {
int32_t i;
float f;
};

union long_double {
int64_t l;
double d;
};

float getlef32(const char *buf, int off)
{
union int_float i_f;

i_f.i = getles32(buf, off);
return i_f.f;
}

double getled64(const char *buf, int off)
{
union long_double l_d;

l_d.l = getles64(buf, off);
return l_d.d;
}

float getbef32(const char *buf, int off)
{
union int_float i_f;

i_f.i = getbes32(buf, off);
return i_f.f;
}

double getbed64(const char *buf, int off)
{
union long_double l_d;

l_d.l = getbes64(buf, off);
return l_d.d;
}

/*@-shiftimplementation@*/
void putbef32(char *buf, int off, float val)
{
union int_float i_f;

i_f.f = val;
/* this would be a putbe32 call if not for a signedness issue */
buf[off] = (char)(((i_f.i) >> 16) >> 8);
}
/*@+shiftimplementation@*/

#ifdef __UNUSED__
// cppcheck-suppress unusedFunction
u_int16_t swap_u16(u_int16_t i)
/* byte-swap a 16-bit unsigned int */
{
u_int8_t c1, c2;
c1 = i & 255;
c2 = (i >> 8) & 255;
return (c1 << 8) + c2;
}
// cppcheck-suppress unusedFunction
u_int32_t swap_u32(u_int32_t i)
u_int32_t swap_u32(u_int32_t i)
/* byte-swap a 32-bit unsigned int */
{
u_int8_t c1, c2, c3, c4;
u_int8_t c1, c2, c3, c4;
c1 = i & 255;
c2 = (i >> 8) & 255;
c3 = (i >> 16) & 255;
c4 = (i >> 24) & 255;
return ((u_int32_t)c1 << 24) + ((u_int32_t)c2 << 16) + ((u_int32_t)c3 << 8) + c4;
}
// cppcheck-suppress unusedFunction
u_int64_t swap_u64(u_int64_t i)
u_int64_t swap_u64(u_int64_t i)
/* byte-swap a 64-bit unsigned int */
{
u_int8_t c1, c2, c3, c4, c5, c6, c7, c8;
u_int8_t c1, c2, c3, c4, c5, c6, c7, c8;
c1 = i & 255;
c2 = (i >> 8) & 255;
c3 = (i >> 16) & 255;
@@ -114,14 +167,14 @@ u_int64_t swap_u64(u_int64_t i)
c6 = (i >> 40) & 255;
c7 = (i >> 48) & 255;
c8 = (i >> 56) & 255;
return ((u_int64_t)c1 << 56) +
((u_int64_t)c2 << 48) +
((u_int64_t)c3 << 40) +
((u_int64_t)c4 << 32) +
((u_int64_t)c5 << 24) +
((u_int64_t)c6 << 16) +
((u_int64_t)c7 << 8) +
return ((u_int64_t)c1 << 56) +
((u_int64_t)c2 << 48) +
((u_int64_t)c3 << 40) +
((u_int64_t)c4 << 32) +
((u_int64_t)c5 << 24) +
((u_int64_t)c6 << 16) +
((u_int64_t)c7 << 8) +
c8;
}
#endif /* __UNUSED__ */

+ 13
- 33
bits.h View File

@@ -4,9 +4,6 @@
* These macros extract bytes, words, longwords, floats, doubles, or
* bitfields of arbitrary length and size from a message that contains
* these items in either MSB-first or LSB-first byte order.
*
* By defining the GET_ORIGIN and PUT_ORIGIN macros before including
* this header, it's possible to change the origin of the indexing.
*
* We enforce data sizes of integral types in the casts on these.
* Both 32- and 64-bit systems with gcc are OK with this set.
@@ -19,58 +16,41 @@

#include <stdint.h>

union int_float {
int32_t i;
float f;
};

union long_double {
int64_t l;
double d;
};

#ifndef GET_ORIGIN
#define GET_ORIGIN 0
#endif
#ifndef PUT_ORIGIN
#define PUT_ORIGIN 0
#endif

/* these are independent of byte order */
#define getsb(buf, off) ((int8_t)buf[(off)-(GET_ORIGIN)])
#define getub(buf, off) ((uint8_t)buf[(off)-(GET_ORIGIN)])
#define putbyte(buf,off,b) do {buf[(off)-(PUT_ORIGIN)] = (unsigned char)(b);} while (0)
#define getsb(buf, off) ((int8_t)buf[off])
#define getub(buf, off) ((uint8_t)buf[off])
#define putbyte(buf,off,b) do {buf[off] = (unsigned char)(b);} while (0)

/* little-endian access */
#define getles16(buf, off) ((int16_t)(((uint16_t)getub((buf), (off)+1) << 8) | (uint16_t)getub((buf), (off))))
#define getleu16(buf, off) ((uint16_t)(((uint16_t)getub((buf), (off)+1) << 8) | (uint16_t)getub((buf), (off))))
#define getles32(buf, off) ((int32_t)(((uint16_t)getleu16((buf), (off)+2) << 16) | (uint16_t)getleu16((buf), (off))))
#define getleu32(buf, off) ((uint32_t)(((uint16_t)getleu16((buf),(off)+2) << 16) | (uint16_t)getleu16((buf), (off))))

#define putle16(buf, off, w) do {putbyte(buf, (off)+1, (uint)(w) >> 8); putbyte(buf, (off), (w));} while (0)
#define putle32(buf, off, l) do {putle16(buf, (off)+2, (uint)(l) >> 16); putle16(buf, (off), (l));} while (0)
#define getles64(buf, off) ((int64_t)(((uint64_t)getleu32(buf, (off)+4) << 32) | getleu32(buf, (off))))
#define getleu64(buf, off) ((uint64_t)(((uint64_t)getleu32(buf, (off)+4) << 32) | getleu32(buf, (off))))
extern float getlef32(const char *, int);
extern double getled64(const char *, int);

#define getlef(buf, off) (i_f.i = getles32(buf, off), i_f.f)
#define getled(buf, off) (l_d.l = getles64(buf, off), l_d.d)
#define putle16(buf, off, w) do {putbyte(buf, (off)+1, (uint)(w) >> 8); putbyte(buf, (off), (w));} while (0)
#define putle32(buf, off, l) do {putle16(buf, (off)+2, (uint)(l) >> 16); putle16(buf, (off), (l));} while (0)

/* SiRF and most other GPS protocols use big-endian (network byte order) */
/* big-endian access */
#define getbes16(buf, off) ((int16_t)(((uint16_t)getub(buf, (off)) << 8) | (uint16_t)getub(buf, (off)+1)))
#define getbeu16(buf, off) ((uint16_t)(((uint16_t)getub(buf, (off)) << 8) | (uint16_t)getub(buf, (off)+1)))
#define getbes32(buf, off) ((int32_t)(((uint16_t)getbeu16(buf, (off)) << 16) | getbeu16(buf, (off)+2)))
#define getbeu32(buf, off) ((uint32_t)(((uint16_t)getbeu16(buf, (off)) << 16) | getbeu16(buf, (off)+2)))
#define getbes64(buf, off) ((int64_t)(((uint64_t)getbeu32(buf, (off)) << 32) | getbeu32(buf, (off)+4)))
#define getbeu64(buf, off) ((uint64_t)(((uint64_t)getbeu32(buf, (off)) << 32) | getbeu32(buf, (off)+4)))
extern float getbef32(const char *, int);
extern double getbed64(const char *, int);

#define putbe16(buf,off,w) do {putbyte(buf, (off), (w) >> 8); putbyte(buf, (off)+1, (w));} while (0)
#define putbe32(buf,off,l) do {putbe16(buf, (off), (l) >> 16); putbe16(buf, (off)+2, (l));} while (0)

#define getbef(buf, off) (i_f.i = getbes32(buf, off), i_f.f)
#define getbed(buf, off) (l_d.l = getbes64(buf, off), l_d.d)
extern void putbef32(char *, int, float);

/* bitfield extraction */
extern uint64_t ubits(char buf[], unsigned int, unsigned int, bool);
extern int64_t sbits(char buf[], unsigned int, unsigned int, bool);
extern uint64_t ubits(unsigned char buf[], unsigned int, unsigned int, bool);
extern int64_t sbits(signed char buf[], unsigned int, unsigned int, bool);

#endif /* _GPSD_BITS_H_ */

+ 2
- 2
bsd_base64.c View File

@@ -107,9 +107,9 @@ static const char Pad64 = '=';
end of the data is performed using the '=' character.

Since all base64 input is an integral number of octets, only the
-------------------------------------------------
-------------------------------------------------
following cases can arise:
(1) the final quantum of encoding input is an integral
multiple of 24 bits; here, the final unit of encoded
output will be an integral multiple of 4 characters


+ 1
- 1
bsd_base64.h View File

@@ -7,7 +7,7 @@

#ifndef HAVE___B64_NTOP
# ifndef HAVE_B64_NTOP
int b64_ntop(unsigned char const *src, size_t srclength, char *target,
int b64_ntop(unsigned char const *src, size_t srclength, char *target,
size_t targsize);
int b64_pton(char const *src, unsigned char *target, size_t targsize);
# endif /* !HAVE_B64_NTOP */


+ 29
- 1
build.txt View File

@@ -146,10 +146,11 @@ process:
|============================================================================
|libxslt | xsltproc is used to build man pages from xml
|docbook-xsl | style file for xml to man translation
|xmlto | DocBook formatter program
|============================================================================

The build degrades gracefully in the absence of any of these. You should
be able to tell from configure messages which extensions you will get.
be able to tell from scons messages which extensions you will get.

Under Ubuntu and most other Debian-derived distributions, an easy way
to pick up the prerequisites is: "apt-get build-dep gpsd"
@@ -202,6 +203,20 @@ by specifying CC=gcc4 before the build command. The rtcm2.c file
confuses the gcc-3.4.[23] optimizer at -O2 level, making it generate
incorrect code.

If, while building, you see a complaint that looks like this:

--------------------------------------------------------------------
I/O error : Attempt to load network entity http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd
--------------------------------------------------------------------

it means the xmlto document formatter is failing to fetch a stylesheet it
needs over the network. Probably this means you are doing a source
build on a machine without live Internet access. The workaround
for this is to temporarily remove xmlto from your command path so GPSD
won't try building the documentation. The actual fix is to install
DocBook on your machine so there will be a local copy of the
stylesheet where xmlto can find it.

After building, please run 'scons testregress' to test the correctness
of the build. It is not necessary to install first, but you do need
to have "." in your $PATH to run regressions uninstalled. Python is
@@ -335,3 +350,16 @@ your cross-compiler is likely to have a different target prefix.
When you are cross-compiling, you'll need chrpath at version 0.14 or
later for cross-architecture support. If it's not yet packaged for
your environment, see http://alioth.debian.org/projects/chrpath/

== Autostarting the daemon ==

The preferred way to start gpsd is on-demand by a hotplug script
detecting USB device activations. Look at the gpsd.rules and
gpsd.hotplug files to see how this is accomplished. Relevant
productions in the build recipe are "udev-install" and
"udev-uninstall"; relevant build options include "udevdir".

If you for some reason need to start gpsd unconditionally at
boot time (in particular, if you need to support RS232 devices)
there's a model init.d script under packaging/deb and a systemd
setup under systemd/.

+ 11
- 11
cgps.c View File

@@ -13,7 +13,7 @@
/*
* The True North compass fails with current gpsd versions for reasons
* the dev team has been unable to diagnose due to not having test hardware.
* The support for it is conditioned out in order to simplify moving
* The support for it is conditioned out in order to simplify moving
* to the new JSON-based protocol and reduce startup time.
*/
#undef TRUENORTH
@@ -167,7 +167,7 @@ static void die(int sig)
}

/* Bye! */
exit(0);
exit(EXIT_SUCCESS);
}

static enum deg_str_type deg_type = deg_dd;
@@ -177,13 +177,13 @@ static void windowsetup(void)
/* inotialize curses and set up screen windows */
{
/* Set the window sizes per the following criteria:
*
*
* 1. Set the window size to display the maximum number of
* satellites possible, but not more than can be fit in a
* satellites possible, but not more than can be fit in a
* window the size of the GPS report window. We have to set
* the limit that way because MAXCHANNELS has been made large
* in order to prepare for survey-grade receivers..
*
*
* 2. If the screen size will not allow for the full complement of
* satellites to be displayed, set the windows sizes smaller, but
* not smaller than the number of lines necessary to display all of
@@ -191,7 +191,7 @@ static void windowsetup(void)
* will be truncated to fit the available window size. (TODO: If
* the satellite list is truncated, omit the satellites not used to
* obtain the current fix.)
*
*
* 3. If the screen is large enough to display all possible
* satellites (MAXCHANNELS - 2) with space still left at the bottom,
* add a window at the bottom in which to scroll raw gpsd data.
@@ -344,7 +344,7 @@ static void windowsetup(void)
static void resize(int sig UNUSED)
/* cope with terminal resize */
{
if (!isendwin())
if (!isendwin())
{
(void)endwin();
windowsetup();
@@ -626,7 +626,7 @@ static void update_gps_panel(struct gps_data_t *gpsdata)
(double)(timestamp()-gpsdata->fix.time));
else
(void)snprintf(scr, sizeof(scr), "n/a");
(void)mvwprintw(datawin, 14, DATAWIN_VALUE_OFFSET + 5, "%-*s", 22,
(void)mvwprintw(datawin, 14, DATAWIN_VALUE_OFFSET + 5, "%-*s", 22,
scr);
/* Fill in the grid square (esr thought *this* one was interesting). */
/*@-branchstate@*/
@@ -672,7 +672,7 @@ static void usage(char *prog)
" Valid only for USA (Lower 48 + AK) and Western Europe.\n",
prog);

exit(1);
exit(EXIT_FAILURE);
}

/*
@@ -755,7 +755,7 @@ int main(int argc, char *argv[])
case 'V':
(void)fprintf(stderr, "cgps: %s (revision %s)\n",
VERSION, REVISION);
exit(0);
exit(EXIT_SUCCESS);
case 'l':
switch (optarg[0]) {
case 'd':
@@ -790,7 +790,7 @@ int main(int argc, char *argv[])
(void)fprintf(stderr,
"cgps: no gpsd running or network error: %d, %s\n",
errno, gps_errstr(errno));
exit(2);
exit(EXIT_FAILURE);
}

/* note: we're assuming BSD-style reliable signals here */


+ 3
- 0
control View File

@@ -16,8 +16,11 @@ Description: monitoring daemon for GPSes, AIS radios, and other navigation aids
and test/profiling tools.

XBS-Destinations: ~, savannah, freecode

XBS-Web-Directory: www

XBS-IRC-Channel: irc://chat.freenode.net/#gpsd

XBS-Project-Tag-List: Communications, Scientific/Engineering, Geographical



+ 69
- 71
crc24q.c View File

@@ -5,7 +5,7 @@
*
* x^24+ x^23+ x^18+ x^17+ x^14+ x^11+ x^10+ x^7+ x^6+ x^5+ x^4+ x^3+ x+1
*
* This corresponds to a mask of 0x1864CFB. For a primer on CRC theory,
* This corresponds to a mask of 0x1864CFB. For a primer on CRC theory,
* including detailed discussion of how and why the error polynomial is
* expressed by this mask, see <http://www.ross.net/crc/>.
*
@@ -39,12 +39,10 @@
#include <stdio.h>
#include <stdlib.h>

unsigned table[256];

#define CRCSEED 0 /* could be NZ to detect leading zeros */
#define CRCPOLY 0x1864CFB /* encodes all info about the polynomial */
#define CRCPOLY 0x1864CFBu /* encodes all info about the polynomial */

static void crc_init(unsigned table[256])
static void crc_init(unsigned int table[256])
{
unsigned i, j;
unsigned h;
@@ -72,75 +70,75 @@ int main(int argc, char *argv[])
putchar('\n');
}

exit(0);
exit(EXIT_SUCCESS);
}
#endif

static const unsigned crc24q[256] = {
0x00000000, 0x01864CFB, 0x028AD50D, 0x030C99F6,
0x0493E6E1, 0x0515AA1A, 0x061933EC, 0x079F7F17,
0x08A18139, 0x0927CDC2, 0x0A2B5434, 0x0BAD18CF,
0x0C3267D8, 0x0DB42B23, 0x0EB8B2D5, 0x0F3EFE2E,
0x10C54E89, 0x11430272, 0x124F9B84, 0x13C9D77F,
0x1456A868, 0x15D0E493, 0x16DC7D65, 0x175A319E,
0x1864CFB0, 0x19E2834B, 0x1AEE1ABD, 0x1B685646,
0x1CF72951, 0x1D7165AA, 0x1E7DFC5C, 0x1FFBB0A7,
0x200CD1E9, 0x218A9D12, 0x228604E4, 0x2300481F,
0x249F3708, 0x25197BF3, 0x2615E205, 0x2793AEFE,
0x28AD50D0, 0x292B1C2B, 0x2A2785DD, 0x2BA1C926,
0x2C3EB631, 0x2DB8FACA, 0x2EB4633C, 0x2F322FC7,
0x30C99F60, 0x314FD39B, 0x32434A6D, 0x33C50696,
0x345A7981, 0x35DC357A, 0x36D0AC8C, 0x3756E077,
0x38681E59, 0x39EE52A2, 0x3AE2CB54, 0x3B6487AF,
0x3CFBF8B8, 0x3D7DB443, 0x3E712DB5, 0x3FF7614E,
0x4019A3D2, 0x419FEF29, 0x429376DF, 0x43153A24,
0x448A4533, 0x450C09C8, 0x4600903E, 0x4786DCC5,
0x48B822EB, 0x493E6E10, 0x4A32F7E6, 0x4BB4BB1D,
0x4C2BC40A, 0x4DAD88F1, 0x4EA11107, 0x4F275DFC,
0x50DCED5B, 0x515AA1A0, 0x52563856, 0x53D074AD,
0x544F0BBA, 0x55C94741, 0x56C5DEB7, 0x5743924C,
0x587D6C62, 0x59FB2099, 0x5AF7B96F, 0x5B71F594,
0x5CEE8A83, 0x5D68C678, 0x5E645F8E, 0x5FE21375,
0x6015723B, 0x61933EC0, 0x629FA736, 0x6319EBCD,
0x648694DA, 0x6500D821, 0x660C41D7, 0x678A0D2C,
0x68B4F302, 0x6932BFF9, 0x6A3E260F, 0x6BB86AF4,
0x6C2715E3, 0x6DA15918, 0x6EADC0EE, 0x6F2B8C15,
0x70D03CB2, 0x71567049, 0x725AE9BF, 0x73DCA544,
0x7443DA53, 0x75C596A8, 0x76C90F5E, 0x774F43A5,
0x7871BD8B, 0x79F7F170, 0x7AFB6886, 0x7B7D247D,
0x7CE25B6A, 0x7D641791, 0x7E688E67, 0x7FEEC29C,
0x803347A4, 0x81B50B5F, 0x82B992A9, 0x833FDE52,
0x84A0A145, 0x8526EDBE, 0x862A7448, 0x87AC38B3,
0x8892C69D, 0x89148A66, 0x8A181390, 0x8B9E5F6B,
0x8C01207C, 0x8D876C87, 0x8E8BF571, 0x8F0DB98A,
0x90F6092D, 0x917045D6, 0x927CDC20, 0x93FA90DB,
0x9465EFCC, 0x95E3A337, 0x96EF3AC1, 0x9769763A,
0x98578814, 0x99D1C4EF, 0x9ADD5D19, 0x9B5B11E2,
0x9CC46EF5, 0x9D42220E, 0x9E4EBBF8, 0x9FC8F703,
0xA03F964D, 0xA1B9DAB6, 0xA2B54340, 0xA3330FBB,
0xA4AC70AC, 0xA52A3C57, 0xA626A5A1, 0xA7A0E95A,
0xA89E1774, 0xA9185B8F, 0xAA14C279, 0xAB928E82,
0xAC0DF195, 0xAD8BBD6E, 0xAE872498, 0xAF016863,
0xB0FAD8C4, 0xB17C943F, 0xB2700DC9, 0xB3F64132,
0xB4693E25, 0xB5EF72DE, 0xB6E3EB28, 0xB765A7D3,
0xB85B59FD, 0xB9DD1506, 0xBAD18CF0, 0xBB57C00B,
0xBCC8BF1C, 0xBD4EF3E7, 0xBE426A11, 0xBFC426EA,
0xC02AE476, 0xC1ACA88D, 0xC2A0317B, 0xC3267D80,
0xC4B90297, 0xC53F4E6C, 0xC633D79A, 0xC7B59B61,
0xC88B654F, 0xC90D29B4, 0xCA01B042, 0xCB87FCB9,
0xCC1883AE, 0xCD9ECF55, 0xCE9256A3, 0xCF141A58,
0xD0EFAAFF, 0xD169E604, 0xD2657FF2, 0xD3E33309,
0xD47C4C1E, 0xD5FA00E5, 0xD6F69913, 0xD770D5E8,
0xD84E2BC6, 0xD9C8673D, 0xDAC4FECB, 0xDB42B230,
0xDCDDCD27, 0xDD5B81DC, 0xDE57182A, 0xDFD154D1,
0xE026359F, 0xE1A07964, 0xE2ACE092, 0xE32AAC69,
0xE4B5D37E, 0xE5339F85, 0xE63F0673, 0xE7B94A88,
0xE887B4A6, 0xE901F85D, 0xEA0D61AB, 0xEB8B2D50,
0xEC145247, 0xED921EBC, 0xEE9E874A, 0xEF18CBB1,
0xF0E37B16, 0xF16537ED, 0xF269AE1B, 0xF3EFE2E0,
0xF4709DF7, 0xF5F6D10C, 0xF6FA48FA, 0xF77C0401,
0xF842FA2F, 0xF9C4B6D4, 0xFAC82F22, 0xFB4E63D9,
0xFCD11CCE, 0xFD575035, 0xFE5BC9C3, 0xFFDD8538,
static const int unsigned crc24q[256] = {
0x00000000u, 0x01864CFBu, 0x028AD50Du, 0x030C99F6u,
0x0493E6E1u, 0x0515AA1Au, 0x061933ECu, 0x079F7F17u,
0x08A18139u, 0x0927CDC2u, 0x0A2B5434u, 0x0BAD18CFu,
0x0C3267D8u, 0x0DB42B23u, 0x0EB8B2D5u, 0x0F3EFE2Eu,
0x10C54E89u, 0x11430272u, 0x124F9B84u, 0x13C9D77Fu,
0x1456A868u, 0x15D0E493u, 0x16DC7D65u, 0x175A319Eu,
0x1864CFB0u, 0x19E2834Bu, 0x1AEE1ABDu, 0x1B685646u,
0x1CF72951u, 0x1D7165AAu, 0x1E7DFC5Cu, 0x1FFBB0A7u,
0x200CD1E9u, 0x218A9D12u, 0x228604E4u, 0x2300481Fu,
0x249F3708u, 0x25197BF3u, 0x2615E205u, 0x2793AEFEu,
0x28AD50D0u, 0x292B1C2Bu, 0x2A2785DDu, 0x2BA1C926u,
0x2C3EB631u, 0x2DB8FACAu, 0x2EB4633Cu, 0x2F322FC7u,
0x30C99F60u, 0x314FD39Bu, 0x32434A6Du, 0x33C50696u,
0x345A7981u, 0x35DC357Au, 0x36D0AC8Cu, 0x3756E077u,
0x38681E59u, 0x39EE52A2u, 0x3AE2CB54u, 0x3B6487AFu,
0x3CFBF8B8u, 0x3D7DB443u, 0x3E712DB5u, 0x3FF7614Eu,
0x4019A3D2u, 0x419FEF29u, 0x429376DFu, 0x43153A24u,
0x448A4533u, 0x450C09C8u, 0x4600903Eu, 0x4786DCC5u,
0x48B822EBu, 0x493E6E10u, 0x4A32F7E6u, 0x4BB4BB1Du,
0x4C2BC40Au, 0x4DAD88F1u, 0x4EA11107u, 0x4F275DFCu,
0x50DCED5Bu, 0x515AA1A0u, 0x52563856u, 0x53D074ADu,
0x544F0BBAu, 0x55C94741u, 0x56C5DEB7u, 0x5743924Cu,
0x587D6C62u, 0x59FB2099u, 0x5AF7B96Fu, 0x5B71F594u,
0x5CEE8A83u, 0x5D68C678u, 0x5E645F8Eu, 0x5FE21375u,
0x6015723Bu, 0x61933EC0u, 0x629FA736u, 0x6319EBCDu,
0x648694DAu, 0x6500D821u, 0x660C41D7u, 0x678A0D2Cu,
0x68B4F302u, 0x6932BFF9u, 0x6A3E260Fu, 0x6BB86AF4u,
0x6C2715E3u, 0x6DA15918u, 0x6EADC0EEu, 0x6F2B8C15u,
0x70D03CB2u, 0x71567049u, 0x725AE9BFu, 0x73DCA544u,
0x7443DA53u, 0x75C596A8u, 0x76C90F5Eu, 0x774F43A5u,
0x7871BD8Bu, 0x79F7F170u, 0x7AFB6886u, 0x7B7D247Du,
0x7CE25B6Au, 0x7D641791u, 0x7E688E67u, 0x7FEEC29Cu,
0x803347A4u, 0x81B50B5Fu, 0x82B992A9u, 0x833FDE52u,
0x84A0A145u, 0x8526EDBEu, 0x862A7448u, 0x87AC38B3u,
0x8892C69Du, 0x89148A66u, 0x8A181390u, 0x8B9E5F6Bu,
0x8C01207Cu, 0x8D876C87u, 0x8E8BF571u, 0x8F0DB98Au,
0x90F6092Du, 0x917045D6u, 0x927CDC20u, 0x93FA90DBu,
0x9465EFCCu, 0x95E3A337u, 0x96EF3AC1u, 0x9769763Au,
0x98578814u, 0x99D1C4EFu, 0x9ADD5D19u, 0x9B5B11E2u,
0x9CC46EF5u, 0x9D42220Eu, 0x9E4EBBF8u, 0x9FC8F703u,
0xA03F964Du, 0xA1B9DAB6u, 0xA2B54340u, 0xA3330FBBu,
0xA4AC70ACu, 0xA52A3C57u, 0xA626A5A1u, 0xA7A0E95Au,
0xA89E1774u, 0xA9185B8Fu, 0xAA14C279u, 0xAB928E82u,
0xAC0DF195u, 0xAD8BBD6Eu, 0xAE872498u, 0xAF016863u,
0xB0FAD8C4u, 0xB17C943Fu, 0xB2700DC9u, 0xB3F64132u,
0xB4693E25u, 0xB5EF72DEu, 0xB6E3EB28u, 0xB765A7D3u,
0xB85B59FDu, 0xB9DD1506u, 0xBAD18CF0u, 0xBB57C00Bu,
0xBCC8BF1Cu, 0xBD4EF3E7u, 0xBE426A11u, 0xBFC426EAu,
0xC02AE476u, 0xC1ACA88Du, 0xC2A0317Bu, 0xC3267D80u,
0xC4B90297u, 0xC53F4E6Cu, 0xC633D79Au, 0xC7B59B61u,
0xC88B654Fu, 0xC90D29B4u, 0xCA01B042u, 0xCB87FCB9u,
0xCC1883AEu, 0xCD9ECF55u, 0xCE9256A3u, 0xCF141A58u,
0xD0EFAAFFu, 0xD169E604u, 0xD2657FF2u, 0xD3E33309u,
0xD47C4C1Eu, 0xD5FA00E5u, 0xD6F69913u, 0xD770D5E8u,
0xD84E2BC6u, 0xD9C8673Du, 0xDAC4FECBu, 0xDB42B230u,
0xDCDDCD27u, 0xDD5B81DCu, 0xDE57182Au, 0xDFD154D1u,
0xE026359Fu, 0xE1A07964u, 0xE2ACE092u, 0xE32AAC69u,
0xE4B5D37Eu, 0xE5339F85u, 0xE63F0673u, 0xE7B94A88u,
0xE887B4A6u, 0xE901F85Du, 0xEA0D61ABu, 0xEB8B2D50u,
0xEC145247u, 0xED921EBCu, 0xEE9E874Au, 0xEF18CBB1u,
0xF0E37B16u, 0xF16537EDu, 0xF269AE1Bu, 0xF3EFE2E0u,
0xF4709DF7u, 0xF5F6D10Cu, 0xF6FA48FAu, 0xF77C0401u,
0xF842FA2Fu, 0xF9C4B6D4u, 0xFAC82F22u, 0xFB4E63D9u,
0xFCD11CCEu, 0xFD575035u, 0xFE5BC9C3u, 0xFFDD8538u,
};

unsigned crc24q_hash(unsigned char *data, int len)


+ 1
- 1
daemon.c View File

@@ -28,7 +28,7 @@ int daemon(int nochdir, int noclose)
case 0: /* child side */
break;
default: /* parent side */
exit(0);
exit(EXIT_SUCCESS);
}
/*@ +type @*/



+ 40
- 10
devtools/ais.py View File

<
@@ -306,6 +306,35 @@ type5 = (
spare(1),
)

type6_dac_or_fid_unknown = (
bitfield("data", 920, 'raw', None, "Data"),
)

type6_dispatch = {}
type6_dispatch[0] = type6_dac_or_fid_unknown

# DAC 235 and 250 (UK, Rep. of Ireland)
type6_dac235_dispatch = {}
type6_dac235_dispatch[0] = type6_dac_or_fid_unknown

type6_dac235_fid10 = (
bitfield("ana_int", 10, 'unsigned', None, "Supply voltage"),
bitfield("ana_ext1", 10, 'unsigned', None, "Analogue (Ext#1)"),
bitfield("ana_ext2", 10, 'unsigned', None, "Analogue (Ext#2)"),
bitfield("racon", 2, 'unsigned', None, "RACON status"),
bitfield("light", 2, 'unsigned', None, "Light status"),
bitfield("health", 1, 'unsigned', None, "Health"),
bitfield("stat_ext", 8, 'unsigned', None, "Status (ext)"),
bitfield("off_pos", 1, 'unsigned', None, "Position status"),
)
type6_dac235_dispatch[10] = type6_dac235_fid10

type6_dac235 = (
dispatch("fid", type6_dac235_dispatch, lambda m: m if m in type6_dac235_dispatch else 0),
)
type6_dispatch[235] = type6_dac235
type6_dispatch[250] = type6_dac235

type6 = (
bitfield("seqno", 2, 'unsigned', None, "Sequence Number"),
bitfield("dest_mmsi", 30, 'unsigned', None, "Destination MMSI"),
@@ -313,7 +342,7 @@ type6 = (
spare(1),
bitfield("dac", 10, 'unsigned', 0, "DAC"),
bitfield("fid", 6, 'unsigned', 0, "Functional ID"),
bitfield("data", 920, 'raw', None, "Data"),
dispatch("dac", type6_dispatch, lambda m: m if m in type6_dispatch else 0),
)

type7 = (
@@ -812,7 +841,7 @@ type25 = (
conditional=lambda i, v: v["addressed"]),
bitfield("app_id", 16, 'unsigned', 0, "Application ID",
conditional=lambda i, v: v["structured"]),
bitfield("data", None, 'raw', None, "Data"),
bitfield("data", 0, 'raw', None, "Data"),
)

# No type 26 handling yet,
@@ -835,7 +864,7 @@ type27 = (