gpsd.xml 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. This file is Copyright 2010 by the GPSD project
  4. SPDX-License-Identifier: BSD-2-clause
  5. -->
  6. <!DOCTYPE refentry PUBLIC
  7. "-//OASIS//DTD DocBook XML V4.1.2//EN"
  8. "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
  9. ]>
  10. <refentry id='gpsd.8'>
  11. <refentryinfo><date>30 March 2020</date></refentryinfo>
  12. <refmeta>
  13. <refentrytitle>gpsd</refentrytitle>
  14. <manvolnum>8</manvolnum>
  15. <refmiscinfo class="source">The GPSD Project</refmiscinfo>
  16. <refmiscinfo class="manual">GPSD Documentation</refmiscinfo>
  17. </refmeta>
  18. <refnamediv id='name'>
  19. <refname>gpsd</refname>
  20. <refpurpose>interface daemon for GPS receivers</refpurpose>
  21. </refnamediv>
  22. <refsynopsisdiv id='synopsis'>
  23. <cmdsynopsis>
  24. <command>gpsd</command>
  25. <arg choice='opt'>-b </arg>
  26. <arg choice='opt'>-D <replaceable>debuglevel</replaceable></arg>
  27. <arg choice='opt'>-F <replaceable>control-socket</replaceable></arg>
  28. <arg choice='opt'>-f <replaceable>framing</replaceable></arg>
  29. <arg choice='opt'>-G </arg>
  30. <arg choice='opt'>-h </arg>
  31. <arg choice='opt'>-l </arg>
  32. <arg choice='opt'>-n </arg>
  33. <arg choice='opt'>-N </arg>
  34. <arg choice='opt'>-P <replaceable>pidfile</replaceable></arg>
  35. <arg choice='opt'>-r </arg>
  36. <arg choice='opt'>-S <replaceable>listener-port</replaceable></arg>
  37. <arg choice='opt'>-s <replaceable>speed</replaceable></arg>
  38. <arg choice='opt'>-V </arg>
  39. <arg rep='repeat'>
  40. <group><replaceable>source-name</replaceable></group>
  41. </arg>
  42. </cmdsynopsis>
  43. </refsynopsisdiv>
  44. <refsect1 id='quickstart'><title>QUICK START</title>
  45. <para>If you have a GPS attached on the lowest-numbered USB port of a
  46. Linux system, and want to read reports from it on TCP/IP port 2947, it
  47. will normally suffice to do this:</para>
  48. <programlisting>
  49. gpsd /dev/ttyUSB0
  50. </programlisting>
  51. <para>For the lowest-numbered serial port:</para>
  52. <programlisting>
  53. gpsd /dev/ttyS0
  54. </programlisting>
  55. <para>Change the device number as appropriate if you need to use a
  56. different port. Command-line flags enable verbose logging, a control
  57. port, and other optional extras but should not be needed for basic
  58. operation; the one exception, on very badly designed hardware, might
  59. be <option>-b</option> (which see).</para>
  60. <para>On Linux systems supporting udev, <application>gpsd</application>
  61. is normally started automatically when a USB plugin event fires (if it
  62. is not already running) and is handed the name of the newly active
  63. device. In that case no invocation is required at all.</para>
  64. <para>For your initial tests set your GPS hardware to speak NMEA, as
  65. <application>gpsd</application> is guaranteed to be able to process
  66. that. If your GPS has a native or binary mode with better performance
  67. that <application>gpsd</application> knows how to speak,
  68. <application>gpsd</application> will autoconfigure that mode.</para>
  69. <para>You can verify correct operation by first starting
  70. <application>gpsd</application> and then
  71. <application>xgps</application>, the X windows test client.</para>
  72. <para>If you have problems, the GPSD project maintains a FAQ to
  73. assist troubleshooting.</para>
  74. </refsect1>
  75. <refsect1 id='description'><title>DESCRIPTION</title>
  76. <para><application>gpsd</application> is a monitor daemon that collects
  77. information from GPSes, differential-GPS radios, or AIS receivers
  78. attached to the host machine. Each GPS, DGPS radio, or AIS receiver
  79. is expected to be direct-connected to the host via a USB or RS232C
  80. serial device. The serial device may be specified to
  81. <application>gpsd</application> at startup, or it may be set via a
  82. command shipped down a local control socket (e.g. by a USB hotplug
  83. script). Given a GPS device by either means,
  84. <application>gpsd</application> discovers the correct port speed and
  85. protocol for it.</para>
  86. <para><application>gpsd</application> should be able to query any GPS
  87. that speaks either the standard textual NMEA 0183 protocol, or the
  88. (differing) extended NMEA dialects used by MKT-3301, iTrax, Motorola
  89. OnCore, Sony CXD2951, and Ashtech/Thales devices. It can also
  90. interpret the binary protocols used by EverMore, Garmin, Navcom,
  91. Rockwell/Zodiac, SiRF, Trimble, and u-blox ANTARIS devices. Under Linux
  92. it can read NMEA2000 packets through the kernel CAN socket. It can read
  93. heading and attitude information from the Oceanserver 5000 or TNT
  94. Revolution digital compasses.</para>
  95. <para>The GPS reporting formats supported by your instance of
  96. <application>gpsd</application> may differ depending on how it was
  97. compiled; general-purpose versions support many, but it can be built
  98. with protocol subsets down to a singleton for use in constrained
  99. environments. For a list of the GPS protocols supported by your
  100. instance, see the output of <command>gpsd -l</command></para>
  101. <para><application>gpsd</application> effectively hides the
  102. differences among the GPS types it supports. It also knows about and
  103. uses commands that tune these GPSes for lower latency. By using
  104. <application>gpsd</application> as an intermediary, applications
  105. avoid contention for serial devices.</para>
  106. <para><application>gpsd</application> can use differential-GPS
  107. corrections from a DGPS radio or over the net, from a ground station
  108. running a DGPSIP server or a Ntrip broadcaster that reports RTCM-104
  109. data; this will shrink position errors by roughly a factor of four.
  110. When <application>gpsd</application> opens a serial device emitting
  111. RTCM-104, it automatically recognizes this and uses the device as a
  112. correction source for all connected GPSes that accept RTCM corrections
  113. (this is dependent on the type of the GPS; not all GPSes have the
  114. firmware capability to accept RTCM correction packets). See
  115. <xref linkend='accuracy'/> and <xref linkend='files'/> for discussion.</para>
  116. <para>Client applications will communicate with <application>gpsd</application>
  117. via a TCP/IP port, port 2947 by default. Both IPv4 and IPv6 connections
  118. are supported and a client may connect via either.</para>
  119. <para>The program accepts the following options:</para>
  120. <variablelist remap='TP'>
  121. <varlistentry>
  122. <term>-b, --readonly</term>
  123. <listitem><para>Broken-device-safety mode, otherwise known as
  124. read-only mode. A few bluetooth and USB receivers lock up or become
  125. totally inaccessible when probed or reconfigured; see the hardware
  126. compatibility list on the GPSD project website for details. This
  127. switch prevents gpsd from writing to a receiver. This means that
  128. <application>gpsd</application> cannot configure the receiver for
  129. optimal performance, but it also means that
  130. <application>gpsd</application> cannot break the receiver. A better
  131. solution would be for Bluetooth to not be so fragile. A platform
  132. independent method to identify serial-over-Bluetooth devices would
  133. also be nice.</para></listitem>
  134. </varlistentry>
  135. <varlistentry>
  136. <term>-D, --debug</term>
  137. <listitem>
  138. <para>Set debug level. Default is 0. At debug levels 2 and above,
  139. <application>gpsd</application> reports incoming sentence and actions
  140. to standard error if <application>gpsd</application> is in the foreground
  141. (-N) or to syslog if in the background.</para>
  142. </listitem>
  143. </varlistentry>
  144. <varlistentry>
  145. <term>-F, --sockfile</term>
  146. <listitem>
  147. <para>Create a control socket for device addition and removal
  148. commands. Default is None. You must specify a valid pathname on your
  149. local filesystem; this will be created as a Unix-domain socket to which
  150. you can write commands that edit the daemon's internal device list.</para>
  151. </listitem>
  152. </varlistentry>
  153. <varlistentry>
  154. <term>-f, --framing</term>
  155. <listitem><para>Fix the framing to the GNSS device.
  156. The framing parameter is of the form: [78][ENO][012].
  157. Most GNSS are 8N1. Some Trimble default to 8O1.
  158. The default is to search for the correct framing.</para></listitem>
  159. </varlistentry>
  160. <varlistentry>
  161. <term>-G, --listenany</term>
  162. <listitem><para>This flag causes <application>gpsd</application> to
  163. listen on all addresses (INADDR_ANY) rather than just the loop back
  164. (INADDR_LOOPBACK) address. For the sake of privacy and security, TPV
  165. information is now private to the local machine until the user makes
  166. an effort to expose this to the world.</para></listitem>
  167. </varlistentry>
  168. <varlistentry>
  169. <term>-h, --help</term>
  170. <listitem><para>Display help message and terminate.</para></listitem>
  171. </varlistentry>
  172. <varlistentry>
  173. <term>-l, --drivers</term>
  174. <listitem><para>List all drivers compiled into this
  175. <application>gpsd</application> instance. The letters to the left of
  176. each driver name are the <application>gpsd</application>
  177. control commands supported by that driver.</para>
  178. </listitem>
  179. </varlistentry>
  180. <varlistentry>
  181. <term>-n, --nowait</term>
  182. <listitem>
  183. <para>Don't wait for a client to connect before polling whatever GPS
  184. is associated with it. Some RS232 GPSes wait in a standby mode
  185. (drawing less power) when the host machine is not asserting DTR, and
  186. some cellphone and handheld embedded GPSes have similar behaviors.
  187. Accordingly, waiting for a watch request to open the device may save
  188. battery power. (This capability is rare in consumer-grade devices).
  189. You should use this option if you plan to use gpsd to provide reference
  190. clock information to ntpd through a memory-shared segment.
  191. </para>
  192. </listitem>
  193. </varlistentry>
  194. <varlistentry>
  195. <term>-N, --foreground</term>
  196. <listitem><para>Don't daemonize; run in foreground.
  197. This switch is mainly useful for debugging.</para>
  198. </listitem>
  199. </varlistentry>
  200. <varlistentry>
  201. <term>-p, --passive</term>
  202. <listitem>
  203. <para>Passive mode. Do not autoconfigure the receiver, but allow
  204. manual configuration changes.</para>
  205. </listitem>
  206. </varlistentry>
  207. <varlistentry>
  208. <term>-P, --pidfile</term>
  209. <listitem>
  210. <para>Specify the name and path to record the daemon's process ID.</para>
  211. </listitem>
  212. </varlistentry>
  213. <varlistentry>
  214. <term>-r, --badtime</term>
  215. <listitem><para>Use GPS time even with no current fix. Some GPSs have
  216. battery powered Real Time Clocks (RTC's) built in, making them a valid time
  217. source even before a fix is acquired. This can be useful on a Raspberry Pi,
  218. or other device that has no battery powered RTC, and thus has no valid
  219. time at startup.</para></listitem>
  220. </varlistentry>
  221. <varlistentry>
  222. <term>-S, --port</term>
  223. <listitem><para>Set TCP/IP port on which to listen for GPSD clients
  224. (default is 2947).</para></listitem>
  225. </varlistentry>
  226. <varlistentry>
  227. <term>-s, --speed</term>
  228. <listitem><para>Fix the serial port speed to the GNSS device. Allowed
  229. speeds are: 4800, 9600, 19200, 38400, 57600, 115200, 230400, and 460800.
  230. The default is to autobaud. Note that some devices with integrated USB
  231. ignore port speed.</para></listitem>
  232. </varlistentry>
  233. <varlistentry>
  234. <term>-V, --version</term>
  235. <listitem>
  236. <para>Dump version and exit.</para>
  237. </listitem>
  238. </varlistentry>
  239. </variablelist>
  240. <para>Arguments are interpreted as the names of data sources.
  241. Normally, a data source is the device pathname of a local device from
  242. which the daemon may expect GPS data. But there are three other
  243. special source types recognized, for a total of four:</para>
  244. <variablelist>
  245. <varlistentry>
  246. <term>Local serial or USB device</term>
  247. <listitem>
  248. <para>A normal Unix device name of a serial or USB device to which a
  249. sensor is attached. Example:
  250. <filename>/dev/ttyUSB0</filename>.</para>
  251. </listitem>
  252. </varlistentry>
  253. <varlistentry>
  254. <term>Local PPS device</term>
  255. <listitem>
  256. <para>A normal Unix device name of a PPS device to which a PPS source
  257. is attached. The device name must start with "/dev/pps" and a local
  258. serial or USB GPS device must also be available. Example:
  259. <filename>/dev/pps0</filename>.</para>
  260. </listitem>
  261. </varlistentry>
  262. <varlistentry>
  263. <term>TCP feed</term>
  264. <listitem>
  265. <para>A URI with the prefix "tcp://", followed by a hostname, a
  266. colon, and a port number. The daemon will open a socket to the
  267. indicated address and port and read data packets from it, which will
  268. be interpreted as though they had been issued by a serial device. Example:
  269. <filename>tcp://data.aishub.net:4006</filename>.</para>
  270. </listitem>
  271. </varlistentry>
  272. <varlistentry>
  273. <term>UDP feed</term>
  274. <listitem>
  275. <para>A URI with the prefix "udp://", followed by a hostname, a
  276. colon, and a port number. The daemon will open a socket listening for
  277. UDP datagrams arriving in the indicated address and port, which will
  278. be interpreted as though they had been issued by a serial device. Example:
  279. <filename>udp://127.0.0.1:5000</filename>.</para>
  280. </listitem>
  281. </varlistentry>
  282. <varlistentry>
  283. <term>Ntrip caster</term>
  284. <listitem>
  285. <para>A URI with the prefix "ntrip://" followed by the name of an
  286. Ntrip caster (Ntrip is a protocol for broadcasting differential-GPS
  287. fixes over the net). For Ntrip services that require authentication, a
  288. prefix of the form "username:password@" can be added before the name
  289. of the Ntrip broadcaster. For Ntrip service, you must specify which
  290. stream to use; the stream is given in the form "/streamname". An
  291. example DGPSIP URI could be "dgpsip://dgpsip.example.com" and a Ntrip
  292. URI could be
  293. "ntrip://foo:bar@ntrip.example.com:80/example-stream". Corrections
  294. from the caster will be sent to each attached GPS with the capability
  295. to accept them.</para>
  296. </listitem>
  297. </varlistentry>
  298. <varlistentry>
  299. <term>DGPSIP server</term>
  300. <listitem>
  301. <para>A URI with the prefix "dgpsip://" followed by a hostname, a
  302. colon, and an optional colon-separated port number (defaulting to
  303. 2101). The daemon will handshake with the DGPSIP server and
  304. read RTCM2 correction data from it. Corrections
  305. from the server will be set to each attached GPS with the capability
  306. to accept them. Example:
  307. <filename>dgpsip://dgps.wsrcc.com:2101</filename>.</para>
  308. </listitem>
  309. </varlistentry>
  310. <varlistentry>
  311. <term>Remote gpsd feed</term>
  312. <listitem>
  313. <para>A URI with the prefix "gpsd://", followed by a hostname and
  314. optionally a colon and a port number (if the port is absent the
  315. default <application>gpsd</application> port will be used). Then
  316. followed optionally by a second colon and the remote device name The
  317. daemon will open a socket to the indicated address and port and emulate a
  318. <application>gpsd</application> client, collecting JSON reports from
  319. the remote <application>gpsd</application> instance that will be
  320. passed to local clients. Example:
  321. <filename>gpsd://gpsd.io:2947:/dev/ttyAMA0</filename>.</para>
  322. </listitem>
  323. </varlistentry>
  324. <varlistentry>
  325. <term>NMEA2000 CAN data</term>
  326. <listitem>
  327. <para>A URI with the prefix "nmea2000://", followed by a CAN
  328. devicename. Only Linux socket CAN interfaces are supported. The
  329. interface must be configured to receive CAN messages
  330. before <application>gpsd</application> can be started. If
  331. there is more than one unit on the CAN bus that provides GPS data,
  332. <application>gpsd</application> chooses the unit from which a GPS message
  333. is first seen. Example: <filename>nmea2000://can0</filename>.
  334. </para>
  335. </listitem>
  336. </varlistentry>
  337. </variablelist>
  338. <para>(The "ais:://" source type supported in some older versions of
  339. the daemon has been retired in favor of the more general
  340. "tcp://".)</para>
  341. <para>Additionally, two serial device names have a side effect:</para>
  342. <variablelist>
  343. <varlistentry>
  344. <term>/dev/ttyAMA0</term>
  345. <listitem>
  346. <para>The UART device on a Raspberry Pi. Has the side effect of
  347. opening /dev/pps0 for RFC2783 1PPS data.</para>
  348. </listitem>
  349. </varlistentry>
  350. <varlistentry>
  351. <term>/dev/gpsd0</term>
  352. <listitem>
  353. <para>Generic GPS device 0. Has the side effect of
  354. opening /dev/pps0 for RFC2783 1PPS data.</para>
  355. </listitem>
  356. </varlistentry>
  357. </variablelist>
  358. <para>
  359. Note, however, that if /dev/pps0 is the fake "ktimer" PPS, then /dev/pps1
  360. will be used instead.
  361. </para>
  362. <para>Internally, the daemon maintains a device pool holding the
  363. pathnames of devices and remote servers known to the
  364. daemon. Initially, this list is the list of device-name arguments
  365. specified on the command line. That list may be empty, in which case
  366. the daemon will have no devices on its search list until they are
  367. added by a control-socket command (see <xref linkend='devices'/> for
  368. details on this). Daemon startup will abort with an error if neither
  369. any devices nor a control socket are specified.</para>
  370. <para>When a device is activated (i.e. a client requests data from it),
  371. gpsd attempts to execute a hook from
  372. <filename>/etc/gpsd/device-hook</filename> with first command line argument
  373. set to the pathname of the device and the second to
  374. <option>ACTIVATE</option>. On deactivation, it does the same passing
  375. <option>DEACTIVATE</option> for the second argument.</para>
  376. <para><application>gpsd</application> can export data to client applications
  377. in three ways: via a sockets interface, via a shared-memory segment, and
  378. via D-Bus. The next three major sections describe these interfaces.</para>
  379. </refsect1>
  380. <refsect1 id='sockets'><title>THE SOCKET INTERFACE</title>
  381. <para>Clients may communicate with the daemon via textual request and
  382. responses over a socket. It is a bad idea for applications to speak the protocol
  383. directly: rather, they should use the
  384. <application>libgps</application> client library and take appropriate
  385. care to conditionalize their code on the major and minor protocol
  386. version symbols.</para>
  387. <para>The request-response protocol for the socket interface is fully
  388. documented in
  389. <citerefentry><refentrytitle>gpsd_json</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
  390. </refsect1>
  391. <refsect1 id='shm'><title>SHARED-MEMORY AND DBUS INTERFACES</title>
  392. <para><application>gpsd</application> has two other (read-only)
  393. interfaces.</para>
  394. <para>Whenever the daemon recognizes a packet from any attached
  395. device, it writes the accumulated state from that device to a shared
  396. memory segment. The C and C++ client libraries shipped with GPSD can
  397. read this segment. Client methods, and various restrictions associated
  398. with the read-only nature of this interface, are documented at
  399. <citerefentry><refentrytitle>libgps</refentrytitle><manvolnum>3</manvolnum></citerefentry>. The
  400. shared-memory interface is intended primarily for embedded deployments
  401. in which <application>gpsd</application> monitors a single device, and
  402. its principal advantage is that a daemon instance configured with
  403. shared memory but without the sockets interface loses a significant
  404. amount of runtime weight.</para>
  405. <para>The daemon may be configured to emit a D-Bus signal each time an
  406. attached device delivers a fix. The signal path is <filename>path
  407. /org/gpsd</filename>, the signal interface is "org.gpsd", and the
  408. signal name is "fix". The signal payload layout is as follows:</para>
  409. <table frame="all" pgwide="0"><title>Satellite object</title>
  410. <tgroup cols="2" align="left" colsep="1" rowsep="1">
  411. <thead>
  412. <row>
  413. <entry>Type</entry>
  414. <entry><para>Description</para></entry>
  415. </row>
  416. </thead>
  417. <tbody>
  418. <row>
  419. <entry>DBUS_TYPE_DOUBLE</entry>
  420. <entry><para>Time (seconds since Unix epoch)</para></entry>
  421. </row>
  422. <row>
  423. <entry>DBUS_TYPE_INT32</entry>
  424. <entry><para>mode</para></entry>
  425. </row>
  426. <row>
  427. <entry>DBUS_TYPE_DOUBLE</entry>
  428. <entry><para>Time uncertainty (seconds).</para></entry>
  429. </row>
  430. <row>
  431. <entry>DBUS_TYPE_DOUBLE</entry>
  432. <entry><para>Latitude in degrees.</para></entry>
  433. </row>
  434. <row>
  435. <entry>DBUS_TYPE_DOUBLE</entry>
  436. <entry><para>Longitude in degrees.</para></entry>
  437. </row>
  438. <row>
  439. <entry>DBUS_TYPE_DOUBLE</entry>
  440. <entry><para>Horizontal uncertainty in meters, 95% confidence.</para></entry>
  441. </row>
  442. <row>
  443. <entry>DBUS_TYPE_DOUBLE</entry>
  444. <entry><para>Altitude MSL in meters.</para></entry>
  445. </row>
  446. <row>
  447. <entry>DBUS_TYPE_DOUBLE</entry>
  448. <entry><para>Altitude uncertainty in meters, 95% confidence.</para></entry>
  449. </row>
  450. <row>
  451. <entry>DBUS_TYPE_DOUBLE</entry>
  452. <entry><para>Course in degrees from true north.</para></entry>
  453. </row>
  454. <row>
  455. <entry>DBUS_TYPE_DOUBLE</entry>
  456. <entry><para>Course uncertainty in meters, 95% confidence.</para></entry>
  457. </row>
  458. <row>
  459. <entry>DBUS_TYPE_DOUBLE</entry>
  460. <entry><para>Speed, meters per second.</para></entry>
  461. </row>
  462. <row>
  463. <entry>DBUS_TYPE_DOUBLE</entry>
  464. <entry><para>Speed uncertainty in meters per second,
  465. 95% confidence.</para></entry>
  466. </row>
  467. <row>
  468. <entry>DBUS_TYPE_DOUBLE</entry>
  469. <entry><para>Climb, meters per second.</para></entry>
  470. </row>
  471. <row>
  472. <entry>DBUS_TYPE_DOUBLE</entry>
  473. <entry><para>Climb uncertainty in meters per second,
  474. 95% confidence.</para></entry>
  475. </row>
  476. <row>
  477. <entry>DBUS_TYPE_STRING</entry>
  478. <entry><para>Device name</para></entry>
  479. </row>
  480. </tbody>
  481. </tgroup>
  482. </table>
  483. </refsect1>
  484. <refsect1 id='devices'><title>GPS DEVICE MANAGEMENT</title>
  485. <para><application>gpsd</application> maintains an internal list of
  486. GPS devices (the "device pool"). If you specify devices on the
  487. command line, the list is initialized with those pathnames; otherwise
  488. the list starts empty. Commands to add and remove GPS device paths
  489. from the daemon's device list must be written to a local Unix-domain
  490. socket which will be accessible only to programs running as root.
  491. This control socket will be located wherever the -F option specifies
  492. it.</para>
  493. <para>A device may will also be dropped from the pool if GPSD gets a zero
  494. length read from it. This end-of-file condition indicates that the
  495. device has been disconnected.</para>
  496. <para>When <application>gpsd</application> is properly installed along
  497. with hotplug notifier scripts feeding it device-add commands over the
  498. control socket, <application>gpsd</application> should require no
  499. configuration or user action to find devices.</para>
  500. <para>Sending SIGHUP to a running <application>gpsd</application>
  501. forces it to close all GPSes and all client connections. It will then
  502. attempt to reconnect to any GPSes on its device list and resume
  503. listening for client connections. This may be useful if your GPS
  504. enters a wedged or confused state but can be soft-reset by pulling
  505. down DTR.</para>
  506. <para>When <application>gpsd</application> is called with no initial
  507. devices (thus, expecting devices to be passed to it by notifications to
  508. the control socket), and reaches a state where there are no devices
  509. connected and no subscribers <emphasis>after</emphasis> after some
  510. devices have been seen, it shuts down gracefully. It is expected that
  511. future device hotplug events will reactivate it.</para>
  512. <para>To point <application>gpsd</application> at a device that may be
  513. a GPS, write to the control socket a plus sign ('+') followed by the
  514. device name followed by LF or CR-LF. Thus, to point the daemon at
  515. <filename>/dev/foo</filename>. send "+/dev/foo\n". To tell the daemon
  516. that a device has been disconnected and is no longer available, send a
  517. minus sign ('-') followed by the device name followed by LF or
  518. CR-LF. Thus, to remove <filename>/dev/foo</filename> from the search
  519. list, send "-/dev/foo\n".</para>
  520. <para>To send a control string to a specified device, write to the
  521. control socket a '!', followed by the device name, followed by '=',
  522. followed by the control string.</para>
  523. <para>To send a binary control string to a specified device, write to the
  524. control socket a '&amp;', followed by the device name, followed by '=',
  525. followed by the control string in paired hex digits.</para>
  526. <para>Your client may await a response, which will be a line beginning
  527. with either "OK" or "ERROR". An ERROR response to an 'add' command means
  528. the device did not emit data recognizable as GPS packets; an ERROR
  529. response to a remove command means the specified device was not in
  530. <application>gpsd</application>'s device pool. An ERROR response to a
  531. '!' command means the daemon did not recognize the devicename
  532. specified.</para>
  533. <para>The control socket is intended for use by hotplug scripts and
  534. other device-discovery services. This control channel is separate
  535. from the public <application>gpsd</application> service port, and only
  536. locally accessible, in order to prevent remote denial-of-service and
  537. spoofing attacks.</para>
  538. </refsect1>
  539. <refsect1 id='accuracy'><title>ACCURACY</title>
  540. <para>The base User Estimated Range Error (UERE) of GPSes is 8 meters
  541. or less at 66% confidence, 15 meters or less at 95% confidence. Actual
  542. horizontal error will be UERE times a dilution factor dependent on current
  543. satellite position. Altitude determination is more sensitive to
  544. variability in ionospheric signal lag than latitude/longitude is, and is
  545. also subject to errors in the estimation of local mean sea level; base
  546. error is 12 meters at 66% confidence, 23 meters at 95% confidence.
  547. Again, this will be multiplied by a vertical dilution of precision
  548. (VDOP) dependent on satellite geometry, and VDOP is typically larger
  549. than HDOP. Users should <emphasis>not</emphasis> rely on GPS altitude for
  550. life-critical tasks such as landing an airplane.</para>
  551. <para>These errors are intrinsic to the design and physics of the GPS
  552. system. <application>gpsd</application> does its internal
  553. computations at sufficient accuracy that it will add no measurable
  554. position error of its own.</para>
  555. <para>DGPS correction will reduce UERE by a factor of 4, provided you
  556. are within about 100 miles (160 km) of a DGPS ground station from which you
  557. are receiving corrections.</para>
  558. <para>On a 4800bps connection, the time latency of fixes provided by
  559. <application>gpsd</application> will be one second or less 95% of the
  560. time. Most of this lag is due to the fact that GPSes normally emit
  561. fixes once per second, thus expected latency is 0.5sec. On the
  562. personal-computer hardware available in 2005 and later, computation
  563. lag induced by <application>gpsd</application> will be negligible, on
  564. the order of a millisecond. Nevertheless, latency can introduce
  565. significant errors for vehicles in motion; at 50 km/h (31 mi/h) of speed
  566. over ground, 1 second of lag corresponds to 13.8 meters change in
  567. position between updates.</para>
  568. <para>The time reporting of the GPS system itself has an intrinsic
  569. accuracy limit of 14 nanoseconds, but this can only be approximated by
  570. specialized receivers using that send the high-accuracy PPS
  571. (Pulse-Per-Second) over RS232 to cue a clock crystal. Most GPS
  572. receivers only report time to a precision of 0.01s or 0.001s,
  573. and with no accuracy guarantees below 1sec.</para>
  574. <para>If your GPS uses a SiRF chipset at firmware level 231, reported
  575. UTC time may be off by the difference between whatever default
  576. leap-second offset has been compiled in and whatever leap-second
  577. correction is currently applicable, from startup until complete
  578. subframe information is received. Firmware levels 232 and up don't
  579. have this problem. You may run <application>gpsd</application> at
  580. debug level 4 to see the chipset type and firmware revision
  581. level.</para>
  582. <para>There are exactly two circumstances under which
  583. <application>gpsd</application> relies on the host-system
  584. clock:</para>
  585. <para>In the GPS broadcast signal, GPS time is represented using a
  586. week number that rolls over after 2^10 or 2^13 weeks (about 19.6
  587. years, or 157 years), depending on the spacecraft. Receivers are
  588. required to disambiguate this to the correct date, but may have
  589. difficulty due to not knowing time to within half this interval, or
  590. may have bugs. Users have reported incorrect dates which appear to be
  591. due to this issue. <application>gpsd</application> uses the startup
  592. time of the daemon detect and compensate for rollovers while it is
  593. running, but otherwise reports the date as it is reported by the
  594. receiver without attempting to correct it.</para>
  595. <para>If you are using an NMEA-only GPS (that is, not using SiRF or
  596. Garmin or Zodiac binary mode), <application>gpsd</application> relies
  597. on the system clock to tell it the current century. If the system clock
  598. returns an invalid value near zero, and the GPS does not emit GPZDA at
  599. the start of its update cycle (which most consumer-grade NMEA GPSes do
  600. not) then the century part of the dates
  601. <application>gpsd</application> delivers may be wrong. Additionally,
  602. near the century turnover, a range of dates as wide in seconds as the
  603. accuracy of your system clock may be referred to the wrong
  604. century.</para>
  605. </refsect1>
  606. <refsect1 id='ntp'><title>USE WITH NTP</title>
  607. <para>gpsd can provide reference clock information to
  608. <application>ntpd</application>, to keep the system clock synchronized
  609. to the time provided by the GPS receiver.</para>
  610. <para>On Linux, <application>gpsd</application> includes support for
  611. interpreting the PPS pulses emitted at the start of every clock second
  612. on the carrier-detect lines of some serial GPSes; this pulse can be
  613. used to update NTP at much higher accuracy than message time provides.
  614. You can determine whether your GPS emits this pulse by running at -D 5
  615. and watching for carrier-detect state change messages in the logfile.
  616. In addition, if your kernel provides the RFC 2783 kernel PPS API then
  617. <application>gpsd</application> will use that for extra
  618. accuracy.</para>
  619. <para>Detailed instructions for using GPSD to set up a high-quality
  620. time service can be found among the documentation on the GPSD
  621. website.</para>
  622. </refsect1>
  623. <refsect1 id='dbus'><title>USE WITH D-BUS</title>
  624. <para>On operating systems that support D-BUS,
  625. <application>gpsd</application> can be built to broadcast GPS fixes to
  626. D-BUS-aware applications. As D-BUS is still at a pre-1.0 stage, we
  627. will not attempt to document this interface here. Read the
  628. <application>gpsd</application> source code to learn more.</para>
  629. </refsect1>
  630. <refsect1 id='security'><title>SECURITY AND PERMISSIONS ISSUES</title>
  631. <para><application>gpsd</application>, if given the -G flag, will
  632. listen for connections from any reachable host, and then disclose the
  633. current position. Before using the -G flag, consider whether you
  634. consider your computer's location to be sensitive data to be kept
  635. private or something that you wish to publish.</para>
  636. <para><application>gpsd</application> must start up as root in order
  637. to open the NTPD shared-memory segment, open its logfile, and create
  638. its local control socket. Before doing any processing of GPS data, it
  639. tries to drop root privileges by setting its UID to "nobody" (or another
  640. configured userid) and its group ID to the group of the initial
  641. GPS passed on the command line &mdash; or, if that device doesn't exist,
  642. to the group of <filename>/dev/ttyS0</filename>.</para>
  643. <para>Privilege-dropping is a hedge against the possibility that
  644. carefully crafted data, either presented from a client socket or from
  645. a subverted serial device posing as a GPS, could be used to induce
  646. misbehavior in the internals of <application>gpsd</application>.
  647. It ensures that any such compromises cannot be used for privilege
  648. elevation to root.</para>
  649. <para>The assumption behind <application>gpsd</application>'s
  650. particular behavior is that all the tty devices to which a GPS might
  651. be connected are owned by the same non-root group and allow group
  652. read/write, though the group may vary because of distribution-specific
  653. or local administrative practice. If this assumption is false,
  654. <application>gpsd</application> may not be able to open GPS devices in
  655. order to read them (such failures will be logged).</para>
  656. <para>In order to fend off inadvertent denial-of-service attacks by
  657. port scanners (not to mention deliberate ones),
  658. <application>gpsd</application> will time out inactive client
  659. connections. Before the client has issued a command that requests a
  660. channel assignment, a short timeout (60 seconds) applies. There is no
  661. timeout for clients in watcher or raw modes; rather,
  662. <application>gpsd</application> drops these clients if they fail to
  663. read data long enough for the outbound socket write buffer to fill.
  664. Clients with an assigned device in polling mode are subject to a
  665. longer timeout (15 minutes).</para>
  666. </refsect1>
  667. <refsect1 id='limitations'><title>LIMITATIONS</title>
  668. <para>If multiple NMEA talkers are feeding RMC, GLL, and GGA sentences
  669. to the same serial device (possible with an RS422 adapter hooked up to
  670. some marine-navigation systems), a 'TPV' response may mix an altitude
  671. from one device's GGA with latitude/longitude from another's RMC/GLL
  672. after the second sentence has arrived.</para>
  673. <para><application>gpsd</application> may change control settings on
  674. your GPS (such as the emission frequency of various sentences or
  675. packets) and not restore the original settings on exit. This is a
  676. result of inadequacies in NMEA and the vendor binary GPS protocols,
  677. which often do not give clients any way to query the values of control
  678. settings in order to be able to restore them later.</para>
  679. <para>When using SiRF chips, the VDOP/TDOP/GDOP figures and associated
  680. error estimates are computed by <application>gpsd</application> rather
  681. than reported by the chip. The computation does not exactly match
  682. what SiRF chips do internally, which includes some satellite weighting
  683. using parameters <application>gpsd</application> cannot see.</para>
  684. <para>Autobauding on the Trimble GPSes can take as long as 5 seconds
  685. if the device speed is not matched to the GPS speed.</para>
  686. <para>Generation of position error estimates (eph, epv, epd, eps, epc)
  687. from the incomplete data handed back by GPS reporting protocols
  688. involves both a lot of mathematical black art and fragile
  689. device-dependent assumptions. This code has been bug-prone in the
  690. past and problems may still lurk there.</para>
  691. <para>AIDVM decoding of types 16-17, 22-23, and 25-26 is unverified.</para>
  692. <para>GPSD presently fully recognizes only the 2.1 level of RTCM2
  693. (message types 1, 3, 4, 5, 6, 7, 9, 16). The 2.3 message types 13, 14,
  694. and 31 are recognized and reported. Message types 8, 10-12, 15-27,
  695. 28-30 (undefined), 31-37, 38-58 (undefined), and 60-63 are not yet
  696. supported.</para>
  697. <para>The ISGPS used for RTCM2 and subframes decoder logic is
  698. sufficiently convoluted to confuse some compiler optimizers, notably
  699. in GCC 3.x at -O2, into generating bad code.</para>
  700. <para>Devices meant to use PPS for high-precision timekeeping may
  701. fail if they are specified after startup by a control-socket command,
  702. as opposed to on the daemon's original command line. Root privileges
  703. are dropped early, and some Unix variants require them in order to set
  704. the PPS line discipline. Under Linux the POSIX capability to set the
  705. line discipline is retained, but other platforms cannot use this
  706. code.</para>
  707. <para>USB GPS devices often do not identify themselves through the USB
  708. subsystem; they typically present as the class 00h (undefined) or
  709. class FFh (vendor-specific) of USB-to-serial adapters. Because of
  710. this, the Linux hotplug scripts must tell
  711. <application>gpsd</application> to sniff data from every USB-to-serial
  712. adapter that goes active and is known to be of a type used in
  713. GPSes. No such device is sent configuration strings until after it has
  714. been identified as a GPS, and <application>gpsd</application> never
  715. opens a device that is opened by another process. But there is a tiny
  716. window for non-GPS devices not opened; if the application that wants
  717. them loses a race with GPSD its device open will fail and have to be
  718. retried after GPSD sniffs the device (normally less than a second
  719. later).</para>
  720. </refsect1>
  721. <refsect1 id='files'><title>FILES</title>
  722. <variablelist>
  723. <varlistentry>
  724. <term><filename>/dev/ttyS0</filename></term>
  725. <listitem>
  726. <para>Prototype TTY device. After startup,
  727. <application>gpsd</application> sets its group ID to the owning group of this
  728. device if no GPS device was specified on the command line does not
  729. exist.</para>
  730. </listitem>
  731. </varlistentry>
  732. <varlistentry>
  733. <term><filename>/etc/gpsd/device-hook</filename></term>
  734. <listitem>
  735. <para>Optional file containing the device activation/deactivation script.
  736. Note that while <filename>/etc/gpsd</filename> is the default system
  737. configuration directory, it is possible to build the GPSD source code
  738. with different assumptions. See above for further details on the
  739. device-hook mechanism.</para>
  740. </listitem>
  741. </varlistentry>
  742. </variablelist>
  743. </refsect1>
  744. <refsect1 id='environment'><title>ENVIRONMENT VARIABLES</title>
  745. <para>By setting the environment variable <envar>GPSD_SHM_KEY</envar>,
  746. you can control the key value used to create the shared-memory segment
  747. used for communication with the client library. This will be useful
  748. mainly when isolating test instances of
  749. <application>gpsd</application> from production ones.</para>
  750. </refsect1>
  751. <refsect1 id='standards'><title>APPLICABLE STANDARDS</title>
  752. <para>The official NMEA protocol standards for NMEA0183 and NMEA2000
  753. are available from the National Marine Electronics Association, but are
  754. proprietary and expensive; the maintainers of
  755. <application>gpsd</application> have made a point of not looking at
  756. them. The GPSD project website links to several documents that collect
  757. publicly disclosed information about the protocol.</para>
  758. <para><application>gpsd</application> parses the following NMEA
  759. sentences: RMC, GGA, GLL, GSA, GSV, VTG, ZDA, GBS, HDT, DBT, GST. It
  760. recognizes these with either the normal GP talker-ID prefix, or with
  761. the GN prefix used by GLONASS, or with the II prefix emitted by
  762. Seahawk Autohelm marine navigation systems, or with the IN prefix
  763. emitted by some Garmin units, or with the EC prefix emitted by ECDIS
  764. units, or with the SD prefix emitted by depth sounders, or with the HC
  765. and TI prefix emitted by some Airmar equipment. It recognizes some
  766. vendor extensions: the PGRME emitted by some Garmin GPS models, the
  767. OHPR emitted by Oceanserver digital compasses, the PTNTHTM emitted by
  768. True North digital compasses, the PMTK omitted by some San Jose
  769. Navigation GPSes, and the PASHR sentences emitted by some Ashtech
  770. GPSes.</para>
  771. <para>Note that <application>gpsd</application> JSON returns pure decimal
  772. degrees, not the hybrid degree/minute format described in the NMEA
  773. standard.</para>
  774. <para>Differential-GPS corrections are conveyed by the RTCM
  775. protocols. The applicable standard for RTCM-104 V2 is <citetitle>RTCM
  776. Recommended Standards for Differential GNSS (Global Navigation
  777. Satellite) Service</citetitle> RTCM Paper 136-2001/SC 104-STD. The
  778. applicable standard for RTCM-104 V3 is <citetitle>RTCM Standard
  779. 10403.1 for Differential GNSS Services - Version 3</citetitle> RTCM
  780. Paper 177-2006-SC104-STD. Ordering instructions for the RTCM standards
  781. are accessible from the website of the Radio Technical Commission for Maritime
  782. Services under "Publications".</para>
  783. <para>AIS is defined by ITU Recommendation M.1371,
  784. <citetitle>Technical Characteristics for a Universal Shipborne
  785. Automatic Identification System Using Time Division Multiple
  786. Access</citetitle>. The AIVDM/AIVDO format understood by this program
  787. is defined by IEC-PAS 61162-100, <citetitle>Maritime navigation and
  788. radiocommunication equipment and systems</citetitle>. A more accessible
  789. description of both can be found at <citetitle>AIVDM/AIVDO Protocol
  790. Decoding</citetitle>, on the references page of the GPSD project
  791. website.</para>
  792. <para>Subframe data is defined by IS-GPS-200E, <citetitle>GLOBAL
  793. POSITIONING SYSTEM WING (GPSW) SYSTEMS ENGINEERING &amp; INTEGRATION,
  794. INTERFACE SPECIFICATION IS-GPS-200 Revision E</citetitle>. The format
  795. understood by this program is defined in Section 20 (Appendix II) of
  796. the IS-GPS-200E, <citetitle>GPS NAVIGATION DATA STRUCTURE FOR DATA,
  797. D(t)</citetitle></para>
  798. <para>JSON is specified by RFC 7159, <citetitle>The JavaScript Object
  799. Notation (JSON) Data Interchange Format</citetitle>.</para>
  800. <para>The API for PPS time service is specified by RFC 2783,
  801. <citetitle>Pulse-Per-Second API for UNIX-like Operating Systems,
  802. Version 1.0</citetitle></para>
  803. </refsect1>
  804. <refsect1 id='see_also'><title>SEE ALSO</title>
  805. <para>
  806. <citerefentry><refentrytitle>gpsdctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
  807. <citerefentry><refentrytitle>gps</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
  808. <citerefentry><refentrytitle>libgps</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
  809. <citerefentry><refentrytitle>gpsd_json</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
  810. <citerefentry><refentrytitle>libgpsmm</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
  811. <citerefentry><refentrytitle>gpsprof</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
  812. <citerefentry><refentrytitle>gpsfake</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
  813. <citerefentry><refentrytitle>gpsctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
  814. <citerefentry><refentrytitle>gpscat</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
  815. </para>
  816. </refsect1>
  817. <refsect1 id='maintainer'><title>AUTHORS</title>
  818. <para>Authors: Eric S. Raymond, Chris Kuethe, Gary Miller. Former
  819. authors whose bits have been plowed under by code turnover: Remco
  820. Treffcorn, Derrick Brashear, Russ Nelson. This manual page by Eric S. Raymond
  821. <email>esr@thyrsus.com</email>.</para>
  822. </refsect1>
  823. </refentry>