Devuan fork of gpsd
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

293 lines
9.6 KiB

  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <!--
  3. This file is Copyright (c) 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. "">
  9. <refentry id='gpsctl.1'>
  10. <refentryinfo><date>29 Oct 2006</date></refentryinfo>
  11. <refmeta>
  12. <refentrytitle>gpsctl</refentrytitle>
  13. <manvolnum>1</manvolnum>
  14. <refmiscinfo class="source">The GPSD Project</refmiscinfo>
  15. <refmiscinfo class="manual">GPSD Documentation</refmiscinfo>
  16. </refmeta>
  17. <refnamediv id='name'>
  18. <refname>gpsctl</refname>
  19. <refpurpose>control the modes of a GPS</refpurpose>
  20. </refnamediv>
  21. <refsynopsisdiv id='synopsis'>
  22. <cmdsynopsis>
  23. <command>gpsctl</command>
  24. <arg choice='opt'>-h </arg>
  25. <group>
  26. <arg choice='plain'>-b</arg>
  27. <arg choice='plain'>-n</arg>
  28. <arg choice='plain'>-r</arg>
  29. </group>
  30. <arg choice='opt'>-x <replaceable>control</replaceable></arg>
  31. <arg choice='opt'>-e </arg>
  32. <arg choice='opt'>-f </arg>
  33. <arg choice='opt'>-l </arg>
  34. <arg choice='opt'>-s <replaceable>speed</replaceable></arg>
  35. <arg choice='opt'>-t <replaceable>devicetype</replaceable></arg>
  36. <arg choice='opt'>-R </arg>
  37. <arg choice='opt'>-D <replaceable>debuglevel</replaceable></arg>
  38. <arg choice='opt'>-V </arg>
  39. <arg choice='opt'><replaceable>serial-port</replaceable></arg>
  40. </cmdsynopsis>
  41. </refsynopsisdiv>
  42. <refsect1 id='description'><title>DESCRIPTION</title>
  43. <para><application>gpsctl</application> can switch a dual-mode GPS
  44. between NMEA and vendor-binary modes. It can also be used to set the
  45. device baudrate. Note: Not all devices have these capabilities.</para>
  46. <para>If you have only one GPS attached to your machine, and gpsd is
  47. running, it is not necessary to specify the device;
  48. <application>gpsctl</application> does its work through
  49. <application>gpsd</application>, which will locate it for you.</para>
  50. <para>When <application>gpsd</application> is not running, the device
  51. specification is required, and you will need to be running as root or
  52. be a member of the device's owning group in order to have write access
  53. to the device. On many Unix variants the owning group will be named
  54. 'dialout'.</para>
  55. <para>The program accepts the following options:</para>
  56. <variablelist remap='TP'>
  57. <varlistentry>
  58. <term>-b</term>
  59. <listitem>
  60. <para>Put the GPS into native (binary) mode.</para>
  61. </listitem>
  62. </varlistentry>
  63. <varlistentry>
  64. <term>-c</term>
  65. <listitem>
  66. <para>Change the GPS's cycle time. Units are seconds. Note, most
  67. GPSes have a fixed cycle time of 1 second.</para>
  68. </listitem>
  69. </varlistentry>
  70. <varlistentry>
  71. <term>-e</term>
  72. <listitem>
  73. <para>Generate the packet from any other arguments specified and ship
  74. it to standard output instead of the device. This switch can be used
  75. with the <option>-t</option> option without specifying a device. Note:
  76. the packet data for a binary prototype will be raw, not ASCII-ized in
  77. any way.</para>
  78. </listitem>
  79. </varlistentry>
  80. <varlistentry>
  81. <term>-f</term>
  82. <listitem>
  83. <para>Force low-level access (not through the daemon).</para>
  84. </listitem>
  85. </varlistentry>
  86. <varlistentry>
  87. <term>-l</term>
  88. <listitem>
  89. <para>List a table showing which option switches can be applied
  90. to which device types, and exit.</para>
  91. </listitem>
  92. </varlistentry>
  93. <varlistentry>
  94. <term>-n</term>
  95. <listitem>
  96. <para>Put GPS into NMEA mode.</para>
  97. </listitem>
  98. </varlistentry>
  99. <varlistentry>
  100. <term>-r</term>
  101. <listitem>
  102. <para>Reset the GPS. Device port and type must be specified.</para>
  103. </listitem>
  104. </varlistentry>
  105. <varlistentry>
  106. <term>-s</term>
  107. <listitem>
  108. <para>Set the baud rate at which the GPS emits packets.</para>
  109. <para>Use this option with caution. On USB and Bluetooth GPSes it is
  110. also possible for serial mode setting to fail either because the
  111. serial adaptor chip does not support non-8N1 modes or because the
  112. device firmware does not properly synchronize the serial adaptor chip
  113. with the UART on the GPS chipset when the speed changes. These
  114. failures can hang your device, possibly requiring a GPS power cycle or (in
  115. extreme cases) physically disconnecting the NVRAM backup battery.</para>
  116. </listitem>
  117. </varlistentry>
  118. <varlistentry>
  119. <term>-t</term>
  120. <listitem>
  121. <para>Force the device type.</para>
  122. </listitem>
  123. </varlistentry>
  124. <varlistentry>
  125. <term>-x</term>
  126. <listitem>
  127. <para>Send a specified control string to the GPS;
  128. <application>gpsctl</application> will provide packet headers and
  129. trailers and checksum as appropriate for binary packet types, and
  130. whatever checksum and trailer is required for text packet types. (You
  131. must include the leading $ for NMEA packets.) When sending to a UBX
  132. device, the first two bytes of the string supplied will become the
  133. message class and type, and the remainder the payload. When sending to
  134. a Navcom NCT or Trimble TSIP device, the first byte is interpreted as
  135. the command ID and the rest as payload. When sending to a Zodiac
  136. device, the first two bytes are used as a message ID of type
  137. little-endian short, and the remainder as payload in byte pairs
  138. interpreted as little-endian short. For all other supported binary
  139. GPSes (notably including SiRF) the string is taken as the entire
  140. message payload and wrapped with appropriate header, trailer and
  141. checksum bytes. C-style backslash escapes in the string, notably \xNN
  142. for hex, will be interpreted; additionally, \e will be replaced with
  143. ESC. This switch implies <option>-f</option>.</para>
  144. </listitem>
  145. </varlistentry>
  146. <varlistentry>
  147. <term>-T</term>
  148. <listitem>
  149. <para>Change the sampling timeout. Defaults to 8 seconds, which should
  150. always be sufficient to get an identifying packet from a device
  151. emitting at the normal rate of 1 per second.</para>
  152. </listitem>
  153. </varlistentry>
  154. <varlistentry>
  155. <term>-R</term>
  156. <listitem>
  157. <para>Remove the GPSD shared-memory segment used for SHM export. This
  158. option will normally only be of interest to GPSD developers.</para>
  159. </listitem>
  160. </varlistentry>
  161. <varlistentry>
  162. <term>-h</term>
  163. <listitem>
  164. <para>Display program usage and exit.</para>
  165. </listitem>
  166. </varlistentry>
  167. <varlistentry>
  168. <term>-D</term>
  169. <listitem>
  170. <para>Set level of debug messages.</para>
  171. </listitem>
  172. </varlistentry>
  173. <varlistentry>
  174. <term>-V</term>
  175. <listitem>
  176. <para>Display program version and exit.</para>
  177. </listitem>
  178. </varlistentry>
  179. </variablelist>
  180. <para>The argument of the forcing option, <option>-t</option>, should be a
  181. string which is contained in exactly one of the known driver
  182. names; for a list, do <command>gpsctl -l</command>.</para>
  183. <para>Forcing the device type behaves somewhat differently depending
  184. on whether this tool is going through the daemon or not. In high-level
  185. mode, if the device that daemon selects for you doesn't match the
  186. driver you specified, <application>gpsctl</application> exits with
  187. a warning. (This may be useful in scripts.)</para>
  188. <para>In low-level mode, if the device identifies as a Generic NMEA,
  189. use the selected driver instead. This will be useful if you have a
  190. GPS device of known type that is in NMEA mode and not responding to
  191. probes. (This option was originally implemented for talking to
  192. SiRFStar I chips, which don't respond to the normal SiRF ID
  193. probe.)</para>
  194. <para>If no options are given, the program will display a message
  195. identifying the GPS type of the selected device and exit.</para>
  196. <para>Reset (-r) operations must stand alone; others can be combined.
  197. Multiple options will be executed in this order: mode changes (-b and
  198. -n) first, speed changes (-s) second, and control-string sends (-c)
  199. last.</para>
  200. </refsect1>
  201. <refsect1 id='environment'><title>ENVIRONMENT VARIABLES</title>
  202. <para>By setting the environment variable <envar>GPSD_SHM_KEY</envar>,
  203. you can control the key value used to designate the shared-memory
  204. segment removed with the -R option. This will be useful mainly when
  205. isolating test instances of <application>gpsd</application> from
  206. production ones.</para>
  207. </refsect1>
  208. <refsect1 id='examples'><title>EXAMPLES</title>
  209. <variablelist>
  210. <varlistentry>
  211. <term><command>gpsctl /dev/ttyUSB0</command></term>
  212. <listitem>
  213. <para>Attempt to identify the device on USB serial device 0. Time out
  214. after the default number of seconds. Adding the <option>-f</option> will
  215. force low-level access and suppress the normal complaint when this
  216. tool can't find a GPSD to work through.</para>
  217. </listitem>
  218. </varlistentry>
  219. <varlistentry>
  220. <term>gpsctl -f -n -s 9600 /dev/ttyUSB0</term>
  221. <listitem>
  222. <para>Use low-level operations (not going through a gpsd instance) to
  223. switch a GPS to NMEA mode at 9600bps. The tool will identify the
  224. GPS type itself.</para>
  225. </listitem>
  226. </varlistentry>
  227. </variablelist>
  228. </refsect1>
  229. <refsect1 id='bugs'><title>BUGS</title>
  230. <para>SiRF GPSes can only be identified by the success of an attempt
  231. to flip them into SiRF binary mode. Thus, the process of probing one of
  232. these running in NMEA will change its behavior.</para>
  233. <para>Baud rate and mode changes work in direct mode but are not
  234. reliable in client mode. This will be fixed in a future release.</para>
  235. </refsect1>
  236. <refsect1 id='see_also'><title>SEE ALSO</title>
  237. <para>
  238. <citerefentry><refentrytitle>gpsd</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
  239. <citerefentry><refentrytitle>gpsdctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
  240. <citerefentry><refentrytitle>gps</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
  241. <citerefentry><refentrytitle>libgps</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
  242. <citerefentry><refentrytitle>libgpsmm</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
  243. <citerefentry><refentrytitle>gpsprof</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
  244. <citerefentry><refentrytitle>gpsfake</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
  245. </para>
  246. </refsect1>
  247. <refsect1 id='maintainer'><title>AUTHOR</title>
  248. <para>Eric S. Raymond <email></email>.</para>
  249. </refsect1>
  250. </refentry>