gpsd.xml 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920
  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 speed to the GNSS device.
  229. The default is to autobaud.</para></listitem>
  230. </varlistentry>
  231. <varlistentry>
  232. <term>-V, --version</term>
  233. <listitem>
  234. <para>Dump version and exit.</para>
  235. </listitem>
  236. </varlistentry>
  237. </variablelist>
  238. <para>Arguments are interpreted as the names of data sources.
  239. Normally, a data source is the device pathname of a local device from
  240. which the daemon may expect GPS data. But there are three other
  241. special source types recognized, for a total of four:</para>
  242. <variablelist>
  243. <varlistentry>
  244. <term>Local serial or USB device</term>
  245. <listitem>
  246. <para>A normal Unix device name of a serial or USB device to which a
  247. sensor is attached. Example:
  248. <filename>/dev/ttyUSB0</filename>.</para>
  249. </listitem>
  250. </varlistentry>
  251. <varlistentry>
  252. <term>Local PPS device</term>
  253. <listitem>
  254. <para>A normal Unix device name of a PPS device to which a PPS source
  255. is attached. The device name must start with "/dev/pps" and a local
  256. serial or USB GPS device must also be available. Example:
  257. <filename>/dev/pps0</filename>.</para>
  258. </listitem>
  259. </varlistentry>
  260. <varlistentry>
  261. <term>TCP feed</term>
  262. <listitem>
  263. <para>A URI with the prefix "tcp://", followed by a hostname, a
  264. colon, and a port number. The daemon will open a socket to the
  265. indicated address and port and read data packets from it, which will
  266. be interpreted as though they had been issued by a serial device. Example:
  267. <filename>tcp://data.aishub.net:4006</filename>.</para>
  268. </listitem>
  269. </varlistentry>
  270. <varlistentry>
  271. <term>UDP feed</term>
  272. <listitem>
  273. <para>A URI with the prefix "udp://", followed by a hostname, a
  274. colon, and a port number. The daemon will open a socket listening for
  275. UDP datagrams arriving in the indicated address and port, which will
  276. be interpreted as though they had been issued by a serial device. Example:
  277. <filename>udp://127.0.0.1:5000</filename>.</para>
  278. </listitem>
  279. </varlistentry>
  280. <varlistentry>
  281. <term>Ntrip caster</term>
  282. <listitem>
  283. <para>A URI with the prefix "ntrip://" followed by the name of an
  284. Ntrip caster (Ntrip is a protocol for broadcasting differential-GPS
  285. fixes over the net). For Ntrip services that require authentication, a
  286. prefix of the form "username:password@" can be added before the name
  287. of the Ntrip broadcaster. For Ntrip service, you must specify which
  288. stream to use; the stream is given in the form "/streamname". An
  289. example DGPSIP URI could be "dgpsip://dgpsip.example.com" and a Ntrip
  290. URI could be
  291. "ntrip://foo:bar@ntrip.example.com:80/example-stream". Corrections
  292. from the caster will be sent to each attached GPS with the capability
  293. to accept them.</para>
  294. </listitem>
  295. </varlistentry>
  296. <varlistentry>
  297. <term>DGPSIP server</term>
  298. <listitem>
  299. <para>A URI with the prefix "dgpsip://" followed by a hostname, a
  300. colon, and an optional colon-separated port number (defaulting to
  301. 2101). The daemon will handshake with the DGPSIP server and
  302. read RTCM2 correction data from it. Corrections
  303. from the server will be set to each attached GPS with the capability
  304. to accept them. Example:
  305. <filename>dgpsip://dgps.wsrcc.com:2101</filename>.</para>
  306. </listitem>
  307. </varlistentry>
  308. <varlistentry>
  309. <term>Remote gpsd feed</term>
  310. <listitem>
  311. <para>A URI with the prefix "gpsd://", followed by a hostname and
  312. optionally a colon and a port number (if the port is absent the
  313. default <application>gpsd</application> port will be used). Then
  314. followed optionally by a second colon and the remote device name The
  315. daemon will open a socket to the indicated address and port and emulate a
  316. <application>gpsd</application> client, collecting JSON reports from
  317. the remote <application>gpsd</application> instance that will be
  318. passed to local clients. Example:
  319. <filename>gpsd://gpsd.io:2947:/dev/ttyAMA0</filename>.</para>
  320. </listitem>
  321. </varlistentry>
  322. <varlistentry>
  323. <term>NMEA2000 CAN data</term>
  324. <listitem>
  325. <para>A URI with the prefix "nmea2000://", followed by a CAN
  326. devicename. Only Linux socket CAN interfaces are supported. The
  327. interface must be configured to receive CAN messages
  328. before <application>gpsd</application> can be started. If
  329. there is more than one unit on the CAN bus that provides GPS data,
  330. <application>gpsd</application> chooses the unit from which a GPS message
  331. is first seen. Example: <filename>nmea2000://can0</filename>.
  332. </para>
  333. </listitem>
  334. </varlistentry>
  335. </variablelist>
  336. <para>(The "ais:://" source type supported in some older versions of
  337. the daemon has been retired in favor of the more general
  338. "tcp://".)</para>
  339. <para>Additionally, two serial device names have a side effect:</para>
  340. <variablelist>
  341. <varlistentry>
  342. <term>/dev/ttyAMA0</term>
  343. <listitem>
  344. <para>The UART device on a Raspberry Pi. Has the side effect of
  345. opening /dev/pps0 for RFC2783 1PPS data.</para>
  346. </listitem>
  347. </varlistentry>
  348. <varlistentry>
  349. <term>/dev/gpsd0</term>
  350. <listitem>
  351. <para>Generic GPS device 0. Has the side effect of
  352. opening /dev/pps0 for RFC2783 1PPS data.</para>
  353. </listitem>
  354. </varlistentry>
  355. </variablelist>
  356. <para>
  357. Note, however, that if /dev/pps0 is the fake "ktimer" PPS, then /dev/pps1
  358. will be used instead.
  359. </para>
  360. <para>Internally, the daemon maintains a device pool holding the
  361. pathnames of devices and remote servers known to the
  362. daemon. Initially, this list is the list of device-name arguments
  363. specified on the command line. That list may be empty, in which case
  364. the daemon will have no devices on its search list until they are
  365. added by a control-socket command (see <xref linkend='devices'/> for
  366. details on this). Daemon startup will abort with an error if neither
  367. any devices nor a control socket are specified.</para>
  368. <para>When a device is activated (i.e. a client requests data from it),
  369. gpsd attempts to execute a hook from
  370. <filename>/etc/gpsd/device-hook</filename> with first command line argument
  371. set to the pathname of the device and the second to
  372. <option>ACTIVATE</option>. On deactivation, it does the same passing
  373. <option>DEACTIVATE</option> for the second argument.</para>
  374. <para><application>gpsd</application> can export data to client applications
  375. in three ways: via a sockets interface, via a shared-memory segment, and
  376. via D-Bus. The next three major sections describe these interfaces.</para>
  377. </refsect1>
  378. <refsect1 id='sockets'><title>THE SOCKET INTERFACE</title>
  379. <para>Clients may communicate with the daemon via textual request and
  380. responses over a socket. It is a bad idea for applications to speak the protocol
  381. directly: rather, they should use the
  382. <application>libgps</application> client library and take appropriate
  383. care to conditionalize their code on the major and minor protocol
  384. version symbols.</para>
  385. <para>The request-response protocol for the socket interface is fully
  386. documented in
  387. <citerefentry><refentrytitle>gpsd_json</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
  388. </refsect1>
  389. <refsect1 id='shm'><title>SHARED-MEMORY AND DBUS INTERFACES</title>
  390. <para><application>gpsd</application> has two other (read-only)
  391. interfaces.</para>
  392. <para>Whenever the daemon recognizes a packet from any attached
  393. device, it writes the accumulated state from that device to a shared
  394. memory segment. The C and C++ client libraries shipped with GPSD can
  395. read this segment. Client methods, and various restrictions associated
  396. with the read-only nature of this interface, are documented at
  397. <citerefentry><refentrytitle>libgps</refentrytitle><manvolnum>3</manvolnum></citerefentry>. The
  398. shared-memory interface is intended primarily for embedded deployments
  399. in which <application>gpsd</application> monitors a single device, and
  400. its principal advantage is that a daemon instance configured with
  401. shared memory but without the sockets interface loses a significant
  402. amount of runtime weight.</para>
  403. <para>The daemon may be configured to emit a D-Bus signal each time an
  404. attached device delivers a fix. The signal path is <filename>path
  405. /org/gpsd</filename>, the signal interface is "org.gpsd", and the
  406. signal name is "fix". The signal payload layout is as follows:</para>
  407. <table frame="all" pgwide="0"><title>Satellite object</title>
  408. <tgroup cols="2" align="left" colsep="1" rowsep="1">
  409. <thead>
  410. <row>
  411. <entry>Type</entry>
  412. <entry><para>Description</para></entry>
  413. </row>
  414. </thead>
  415. <tbody>
  416. <row>
  417. <entry>DBUS_TYPE_DOUBLE</entry>
  418. <entry><para>Time (seconds since Unix epoch)</para></entry>
  419. </row>
  420. <row>
  421. <entry>DBUS_TYPE_INT32</entry>
  422. <entry><para>mode</para></entry>
  423. </row>
  424. <row>
  425. <entry>DBUS_TYPE_DOUBLE</entry>
  426. <entry><para>Time uncertainty (seconds).</para></entry>
  427. </row>
  428. <row>
  429. <entry>DBUS_TYPE_DOUBLE</entry>
  430. <entry><para>Latitude in degrees.</para></entry>
  431. </row>
  432. <row>
  433. <entry>DBUS_TYPE_DOUBLE</entry>
  434. <entry><para>Longitude in degrees.</para></entry>
  435. </row>
  436. <row>
  437. <entry>DBUS_TYPE_DOUBLE</entry>
  438. <entry><para>Horizontal uncertainty in meters, 95% confidence.</para></entry>
  439. </row>
  440. <row>
  441. <entry>DBUS_TYPE_DOUBLE</entry>
  442. <entry><para>Altitude in meters.</para></entry>
  443. </row>
  444. <row>
  445. <entry>DBUS_TYPE_DOUBLE</entry>
  446. <entry><para>Altitude uncertainty in meters, 95% confidence.</para></entry>
  447. </row>
  448. <row>
  449. <entry>DBUS_TYPE_DOUBLE</entry>
  450. <entry><para>Course in degrees from true north.</para></entry>
  451. </row>
  452. <row>
  453. <entry>DBUS_TYPE_DOUBLE</entry>
  454. <entry><para>Course uncertainty in meters, 95% confidence.</para></entry>
  455. </row>
  456. <row>
  457. <entry>DBUS_TYPE_DOUBLE</entry>
  458. <entry><para>Speed, meters per second.</para></entry>
  459. </row>
  460. <row>
  461. <entry>DBUS_TYPE_DOUBLE</entry>
  462. <entry><para>Speed uncertainty in meters per second,
  463. 95% confidence.</para></entry>
  464. </row>
  465. <row>
  466. <entry>DBUS_TYPE_DOUBLE</entry>
  467. <entry><para>Climb, meters per second.</para></entry>
  468. </row>
  469. <row>
  470. <entry>DBUS_TYPE_DOUBLE</entry>
  471. <entry><para>Climb uncertainty in meters per second,
  472. 95% confidence.</para></entry>
  473. </row>
  474. <row>
  475. <entry>DBUS_TYPE_STRING</entry>
  476. <entry><para>Device name</para></entry>
  477. </row>
  478. </tbody>
  479. </tgroup>
  480. </table>
  481. </refsect1>
  482. <refsect1 id='devices'><title>GPS DEVICE MANAGEMENT</title>
  483. <para><application>gpsd</application> maintains an internal list of
  484. GPS devices (the "device pool"). If you specify devices on the
  485. command line, the list is initialized with those pathnames; otherwise
  486. the list starts empty. Commands to add and remove GPS device paths
  487. from the daemon's device list must be written to a local Unix-domain
  488. socket which will be accessible only to programs running as root.
  489. This control socket will be located wherever the -F option specifies
  490. it.</para>
  491. <para>A device may will also be dropped from the pool if GPSD gets a zero
  492. length read from it. This end-of-file condition indicates that the
  493. device has been disconnected.</para>
  494. <para>When <application>gpsd</application> is properly installed along
  495. with hotplug notifier scripts feeding it device-add commands over the
  496. control socket, <application>gpsd</application> should require no
  497. configuration or user action to find devices.</para>
  498. <para>Sending SIGHUP to a running <application>gpsd</application>
  499. forces it to close all GPSes and all client connections. It will then
  500. attempt to reconnect to any GPSes on its device list and resume
  501. listening for client connections. This may be useful if your GPS
  502. enters a wedged or confused state but can be soft-reset by pulling
  503. down DTR.</para>
  504. <para>When <application>gpsd</application> is called with no initial
  505. devices (thus, expecting devices to be passed to it by notifications to
  506. the control socket), and reaches a state where there are no devices
  507. connected and no subscribers <emphasis>after</emphasis> after some
  508. devices have been seen, it shuts down gracefully. It is expected that
  509. future device hotplug events will reactivate it.</para>
  510. <para>To point <application>gpsd</application> at a device that may be
  511. a GPS, write to the control socket a plus sign ('+') followed by the
  512. device name followed by LF or CR-LF. Thus, to point the daemon at
  513. <filename>/dev/foo</filename>. send "+/dev/foo\n". To tell the daemon
  514. that a device has been disconnected and is no longer available, send a
  515. minus sign ('-') followed by the device name followed by LF or
  516. CR-LF. Thus, to remove <filename>/dev/foo</filename> from the search
  517. list, send "-/dev/foo\n".</para>
  518. <para>To send a control string to a specified device, write to the
  519. control socket a '!', followed by the device name, followed by '=',
  520. followed by the control string.</para>
  521. <para>To send a binary control string to a specified device, write to the
  522. control socket a '&amp;', followed by the device name, followed by '=',
  523. followed by the control string in paired hex digits.</para>
  524. <para>Your client may await a response, which will be a line beginning
  525. with either "OK" or "ERROR". An ERROR response to an 'add' command means
  526. the device did not emit data recognizable as GPS packets; an ERROR
  527. response to a remove command means the specified device was not in
  528. <application>gpsd</application>'s device pool. An ERROR response to a
  529. '!' command means the daemon did not recognize the devicename
  530. specified.</para>
  531. <para>The control socket is intended for use by hotplug scripts and
  532. other device-discovery services. This control channel is separate
  533. from the public <application>gpsd</application> service port, and only
  534. locally accessible, in order to prevent remote denial-of-service and
  535. spoofing attacks.</para>
  536. </refsect1>
  537. <refsect1 id='accuracy'><title>ACCURACY</title>
  538. <para>The base User Estimated Range Error (UERE) of GPSes is 8 meters
  539. or less at 66% confidence, 15 meters or less at 95% confidence. Actual
  540. horizontal error will be UERE times a dilution factor dependent on current
  541. satellite position. Altitude determination is more sensitive to
  542. variability in ionospheric signal lag than latitude/longitude is, and is
  543. also subject to errors in the estimation of local mean sea level; base
  544. error is 12 meters at 66% confidence, 23 meters at 95% confidence.
  545. Again, this will be multiplied by a vertical dilution of precision
  546. (VDOP) dependent on satellite geometry, and VDOP is typically larger
  547. than HDOP. Users should <emphasis>not</emphasis> rely on GPS altitude for
  548. life-critical tasks such as landing an airplane.</para>
  549. <para>These errors are intrinsic to the design and physics of the GPS
  550. system. <application>gpsd</application> does its internal
  551. computations at sufficient accuracy that it will add no measurable
  552. position error of its own.</para>
  553. <para>DGPS correction will reduce UERE by a factor of 4, provided you
  554. are within about 100 miles (160 km) of a DGPS ground station from which you
  555. are receiving corrections.</para>
  556. <para>On a 4800bps connection, the time latency of fixes provided by
  557. <application>gpsd</application> will be one second or less 95% of the
  558. time. Most of this lag is due to the fact that GPSes normally emit
  559. fixes once per second, thus expected latency is 0.5sec. On the
  560. personal-computer hardware available in 2005 and later, computation
  561. lag induced by <application>gpsd</application> will be negligible, on
  562. the order of a millisecond. Nevertheless, latency can introduce
  563. significant errors for vehicles in motion; at 50 km/h (31 mi/h) of speed
  564. over ground, 1 second of lag corresponds to 13.8 meters change in
  565. position between updates.</para>
  566. <para>The time reporting of the GPS system itself has an intrinsic
  567. accuracy limit of 14 nanoseconds, but this can only be approximated by
  568. specialized receivers using that send the high-accuracy PPS
  569. (Pulse-Per-Second) over RS232 to cue a clock crystal. Most GPS
  570. receivers only report time to a precision of 0.01s or 0.001s,
  571. and with no accuracy guarantees below 1sec.</para>
  572. <para>If your GPS uses a SiRF chipset at firmware level 231, reported
  573. UTC time may be off by the difference between whatever default
  574. leap-second offset has been compiled in and whatever leap-second
  575. correction is currently applicable, from startup until complete
  576. subframe information is received. Firmware levels 232 and up don't
  577. have this problem. You may run <application>gpsd</application> at
  578. debug level 4 to see the chipset type and firmware revision
  579. level.</para>
  580. <para>There are exactly two circumstances under which
  581. <application>gpsd</application> relies on the host-system
  582. clock:</para>
  583. <para>In the GPS broadcast signal, GPS time is represented using a
  584. week number that rolls over after 2^10 or 2^13 weeks (about 19.6
  585. years, or 157 years), depending on the spacecraft. Receivers are
  586. required to disambiguate this to the correct date, but may have
  587. difficulty due to not knowing time to within half this interval, or
  588. may have bugs. Users have reported incorrect dates which appear to be
  589. due to this issue. <application>gpsd</application> uses the startup
  590. time of the daemon detect and compensate for rollovers while it is
  591. running, but otherwise reports the date as it is reported by the
  592. receiver without attempting to correct it.</para>
  593. <para>If you are using an NMEA-only GPS (that is, not using SiRF or
  594. Garmin or Zodiac binary mode), <application>gpsd</application> relies
  595. on the system clock to tell it the current century. If the system clock
  596. returns an invalid value near zero, and the GPS does not emit GPZDA at
  597. the start of its update cycle (which most consumer-grade NMEA GPSes do
  598. not) then the century part of the dates
  599. <application>gpsd</application> delivers may be wrong. Additionally,
  600. near the century turnover, a range of dates as wide in seconds as the
  601. accuracy of your system clock may be referred to the wrong
  602. century.</para>
  603. </refsect1>
  604. <refsect1 id='ntp'><title>USE WITH NTP</title>
  605. <para>gpsd can provide reference clock information to
  606. <application>ntpd</application>, to keep the system clock synchronized
  607. to the time provided by the GPS receiver.</para>
  608. <para>On Linux, <application>gpsd</application> includes support for
  609. interpreting the PPS pulses emitted at the start of every clock second
  610. on the carrier-detect lines of some serial GPSes; this pulse can be
  611. used to update NTP at much higher accuracy than message time provides.
  612. You can determine whether your GPS emits this pulse by running at -D 5
  613. and watching for carrier-detect state change messages in the logfile.
  614. In addition, if your kernel provides the RFC 2783 kernel PPS API then
  615. <application>gpsd</application> will use that for extra
  616. accuracy.</para>
  617. <para>Detailed instructions for using GPSD to set up a high-quality
  618. time service can be found among the documentation on the GPSD
  619. website.</para>
  620. </refsect1>
  621. <refsect1 id='dbus'><title>USE WITH D-BUS</title>
  622. <para>On operating systems that support D-BUS,
  623. <application>gpsd</application> can be built to broadcast GPS fixes to
  624. D-BUS-aware applications. As D-BUS is still at a pre-1.0 stage, we
  625. will not attempt to document this interface here. Read the
  626. <application>gpsd</application> source code to learn more.</para>
  627. </refsect1>
  628. <refsect1 id='security'><title>SECURITY AND PERMISSIONS ISSUES</title>
  629. <para><application>gpsd</application>, if given the -G flag, will
  630. listen for connections from any reachable host, and then disclose the
  631. current position. Before using the -G flag, consider whether you
  632. consider your computer's location to be sensitive data to be kept
  633. private or something that you wish to publish.</para>
  634. <para><application>gpsd</application> must start up as root in order
  635. to open the NTPD shared-memory segment, open its logfile, and create
  636. its local control socket. Before doing any processing of GPS data, it
  637. tries to drop root privileges by setting its UID to "nobody" (or another
  638. configured userid) and its group ID to the group of the initial
  639. GPS passed on the command line &mdash; or, if that device doesn't exist,
  640. to the group of <filename>/dev/ttyS0</filename>.</para>
  641. <para>Privilege-dropping is a hedge against the possibility that
  642. carefully crafted data, either presented from a client socket or from
  643. a subverted serial device posing as a GPS, could be used to induce
  644. misbehavior in the internals of <application>gpsd</application>.
  645. It ensures that any such compromises cannot be used for privilege
  646. elevation to root.</para>
  647. <para>The assumption behind <application>gpsd</application>'s
  648. particular behavior is that all the tty devices to which a GPS might
  649. be connected are owned by the same non-root group and allow group
  650. read/write, though the group may vary because of distribution-specific
  651. or local administrative practice. If this assumption is false,
  652. <application>gpsd</application> may not be able to open GPS devices in
  653. order to read them (such failures will be logged).</para>
  654. <para>In order to fend off inadvertent denial-of-service attacks by
  655. port scanners (not to mention deliberate ones),
  656. <application>gpsd</application> will time out inactive client
  657. connections. Before the client has issued a command that requests a
  658. channel assignment, a short timeout (60 seconds) applies. There is no
  659. timeout for clients in watcher or raw modes; rather,
  660. <application>gpsd</application> drops these clients if they fail to
  661. read data long enough for the outbound socket write buffer to fill.
  662. Clients with an assigned device in polling mode are subject to a
  663. longer timeout (15 minutes).</para>
  664. </refsect1>
  665. <refsect1 id='limitations'><title>LIMITATIONS</title>
  666. <para>If multiple NMEA talkers are feeding RMC, GLL, and GGA sentences
  667. to the same serial device (possible with an RS422 adapter hooked up to
  668. some marine-navigation systems), a 'TPV' response may mix an altitude
  669. from one device's GGA with latitude/longitude from another's RMC/GLL
  670. after the second sentence has arrived.</para>
  671. <para><application>gpsd</application> may change control settings on
  672. your GPS (such as the emission frequency of various sentences or
  673. packets) and not restore the original settings on exit. This is a
  674. result of inadequacies in NMEA and the vendor binary GPS protocols,
  675. which often do not give clients any way to query the values of control
  676. settings in order to be able to restore them later.</para>
  677. <para>When using SiRF chips, the VDOP/TDOP/GDOP figures and associated
  678. error estimates are computed by <application>gpsd</application> rather
  679. than reported by the chip. The computation does not exactly match
  680. what SiRF chips do internally, which includes some satellite weighting
  681. using parameters <application>gpsd</application> cannot see.</para>
  682. <para>Autobauding on the Trimble GPSes can take as long as 5 seconds
  683. if the device speed is not matched to the GPS speed.</para>
  684. <para>Generation of position error estimates (eph, epv, epd, eps, epc)
  685. from the incomplete data handed back by GPS reporting protocols
  686. involves both a lot of mathematical black art and fragile
  687. device-dependent assumptions. This code has been bug-prone in the
  688. past and problems may still lurk there.</para>
  689. <para>AIDVM decoding of types 16-17, 22-23, and 25-26 is unverified.</para>
  690. <para>GPSD presently fully recognizes only the 2.1 level of RTCM2
  691. (message types 1, 3, 4, 5, 6, 7, 9, 16). The 2.3 message types 13, 14,
  692. and 31 are recognized and reported. Message types 8, 10-12, 15-27,
  693. 28-30 (undefined), 31-37, 38-58 (undefined), and 60-63 are not yet
  694. supported.</para>
  695. <para>The ISGPS used for RTCM2 and subframes decoder logic is
  696. sufficiently convoluted to confuse some compiler optimizers, notably
  697. in GCC 3.x at -O2, into generating bad code.</para>
  698. <para>Devices meant to use PPS for high-precision timekeeping may
  699. fail if they are specified after startup by a control-socket command,
  700. as opposed to on the daemon's original command line. Root privileges
  701. are dropped early, and some Unix variants require them in order to set
  702. the PPS line discipline. Under Linux the POSIX capability to set the
  703. line discipline is retained, but other platforms cannot use this
  704. code.</para>
  705. <para>USB GPS devices often do not identify themselves through the USB
  706. subsystem; they typically present as the class 00h (undefined) or
  707. class FFh (vendor-specific) of USB-to-serial adapters. Because of
  708. this, the Linux hotplug scripts must tell
  709. <application>gpsd</application> to sniff data from every USB-to-serial
  710. adapter that goes active and is known to be of a type used in
  711. GPSes. No such device is sent configuration strings until after it has
  712. been identified as a GPS, and <application>gpsd</application> never
  713. opens a device that is opened by another process. But there is a tiny
  714. window for non-GPS devices not opened; if the application that wants
  715. them loses a race with GPSD its device open will fail and have to be
  716. retried after GPSD sniffs the device (normally less than a second
  717. later).</para>
  718. </refsect1>
  719. <refsect1 id='files'><title>FILES</title>
  720. <variablelist>
  721. <varlistentry>
  722. <term><filename>/dev/ttyS0</filename></term>
  723. <listitem>
  724. <para>Prototype TTY device. After startup,
  725. <application>gpsd</application> sets its group ID to the owning group of this
  726. device if no GPS device was specified on the command line does not
  727. exist.</para>
  728. </listitem>
  729. </varlistentry>
  730. <varlistentry>
  731. <term><filename>/etc/gpsd/device-hook</filename></term>
  732. <listitem>
  733. <para>Optional file containing the device activation/deactivation script.
  734. Note that while <filename>/etc/gpsd</filename> is the default system
  735. configuration directory, it is possible to build the GPSD source code
  736. with different assumptions. See above for further details on the
  737. device-hook mechanism.</para>
  738. </listitem>
  739. </varlistentry>
  740. </variablelist>
  741. </refsect1>
  742. <refsect1 id='environment'><title>ENVIRONMENT VARIABLES</title>
  743. <para>By setting the environment variable <envar>GPSD_SHM_KEY</envar>,
  744. you can control the key value used to create the shared-memory segment
  745. used for communication with the client library. This will be useful
  746. mainly when isolating test instances of
  747. <application>gpsd</application> from production ones.</para>
  748. </refsect1>
  749. <refsect1 id='standards'><title>APPLICABLE STANDARDS</title>
  750. <para>The official NMEA protocol standards for NMEA0183 and NMEA2000
  751. are available from the National Marine Electronics Association, but are
  752. proprietary and expensive; the maintainers of
  753. <application>gpsd</application> have made a point of not looking at
  754. them. The GPSD project website links to several documents that collect
  755. publicly disclosed information about the protocol.</para>
  756. <para><application>gpsd</application> parses the following NMEA
  757. sentences: RMC, GGA, GLL, GSA, GSV, VTG, ZDA, GBS, HDT, DBT, GST. It
  758. recognizes these with either the normal GP talker-ID prefix, or with
  759. the GN prefix used by GLONASS, or with the II prefix emitted by
  760. Seahawk Autohelm marine navigation systems, or with the IN prefix
  761. emitted by some Garmin units, or with the EC prefix emitted by ECDIS
  762. units, or with the SD prefix emitted by depth sounders, or with the HC
  763. and TI prefix emitted by some Airmar equipment. It recognizes some
  764. vendor extensions: the PGRME emitted by some Garmin GPS models, the
  765. OHPR emitted by Oceanserver digital compasses, the PTNTHTM emitted by
  766. True North digital compasses, the PMTK omitted by some San Jose
  767. Navigation GPSes, and the PASHR sentences emitted by some Ashtech
  768. GPSes.</para>
  769. <para>Note that <application>gpsd</application> JSON returns pure decimal
  770. degrees, not the hybrid degree/minute format described in the NMEA
  771. standard.</para>
  772. <para>Differential-GPS corrections are conveyed by the RTCM
  773. protocols. The applicable standard for RTCM-104 V2 is <citetitle>RTCM
  774. Recommended Standards for Differential GNSS (Global Navigation
  775. Satellite) Service</citetitle> RTCM Paper 136-2001/SC 104-STD. The
  776. applicable standard for RTCM-104 V3 is <citetitle>RTCM Standard
  777. 10403.1 for Differential GNSS Services - Version 3</citetitle> RTCM
  778. Paper 177-2006-SC104-STD. Ordering instructions for the RTCM standards
  779. are accessible from the website of the Radio Technical Commission for Maritime
  780. Services under "Publications".</para>
  781. <para>AIS is defined by ITU Recommendation M.1371,
  782. <citetitle>Technical Characteristics for a Universal Shipborne
  783. Automatic Identification System Using Time Division Multiple
  784. Access</citetitle>. The AIVDM/AIVDO format understood by this program
  785. is defined by IEC-PAS 61162-100, <citetitle>Maritime navigation and
  786. radiocommunication equipment and systems</citetitle>. A more accessible
  787. description of both can be found at <citetitle>AIVDM/AIVDO Protocol
  788. Decoding</citetitle>, on the references page of the GPSD project
  789. website.</para>
  790. <para>Subframe data is defined by IS-GPS-200E, <citetitle>GLOBAL
  791. POSITIONING SYSTEM WING (GPSW) SYSTEMS ENGINEERING &amp; INTEGRATION,
  792. INTERFACE SPECIFICATION IS-GPS-200 Revision E</citetitle>. The format
  793. understood by this program is defined in Section 20 (Appendix II) of
  794. the IS-GPS-200E, <citetitle>GPS NAVIGATION DATA STRUCTURE FOR DATA,
  795. D(t)</citetitle></para>
  796. <para>JSON is specified by RFC 7159, <citetitle>The JavaScript Object
  797. Notation (JSON) Data Interchange Format</citetitle>.</para>
  798. <para>The API for PPS time service is specified by RFC 2783,
  799. <citetitle>Pulse-Per-Second API for UNIX-like Operating Systems,
  800. Version 1.0</citetitle></para>
  801. </refsect1>
  802. <refsect1 id='see_also'><title>SEE ALSO</title>
  803. <para>
  804. <citerefentry><refentrytitle>gpsdctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
  805. <citerefentry><refentrytitle>gps</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
  806. <citerefentry><refentrytitle>libgps</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
  807. <citerefentry><refentrytitle>gpsd_json</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
  808. <citerefentry><refentrytitle>libgpsmm</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
  809. <citerefentry><refentrytitle>gpsprof</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
  810. <citerefentry><refentrytitle>gpsfake</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
  811. <citerefentry><refentrytitle>gpsctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
  812. <citerefentry><refentrytitle>gpscat</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
  813. </para>
  814. </refsect1>
  815. <refsect1 id='maintainer'><title>AUTHORS</title>
  816. <para>Authors: Eric S. Raymond, Chris Kuethe, Gary Miller. Former
  817. authors whose bits have been plowed under by code turnover: Remco
  818. Treffcorn, Derrick Brashear, Russ Nelson. This manual page by Eric S. Raymond
  819. <email>esr@thyrsus.com</email>.</para>
  820. </refsect1>
  821. </refentry>