gpsctl.adoc 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. = gpsctl(1)
  2. :author: Eric S. Raymond
  3. :date: 20 January 2021
  4. :email: <esr@thyrsus.com.>
  5. :keywords: gps, gpsd, gpsctl
  6. :manmanual: GPSD Documentation
  7. :mansource: GPSD, Version {gpsdver}
  8. :robots: index,follow
  9. :sectlinks:
  10. :toc: macro
  11. :type: manpage
  12. :webfonts!:
  13. include::../www/inc-menu.adoc[]
  14. == NAME
  15. gpsctl - control the modes of a GNSS receiver
  16. == SYNOPSIS
  17. *gpsctl* [OPTIONS] [serial-port]
  18. *gpsctl* -h
  19. *gpsctl* -V
  20. == DESCRIPTION
  21. *gpsctl* can switch a dual-mode GNSS receiver between NMEA and
  22. vendor-binary modes. It can also be used to set the device baud
  23. rate. Note: Not all devices have these capabilities.
  24. If you have only one GNSS receiver attached to your machine, and *gpsd*
  25. is running, it is not necessary to specify the device; *gpsctl* does its
  26. work through *gpsd*, which will locate it for you.
  27. When *gpsd* is running, *gpsctl* may be run as any user, or as root.
  28. When *gpsd* is not running, the device specification is required, and you
  29. will need to be running as root or be a member of the device's owning
  30. group in order to have write access to the device. On many Unix variants
  31. the owning group will be named 'dialout'.
  32. Running under *sudo* will cause some loss of functionality.
  33. == OPTIONS
  34. The program accepts the following options:
  35. *-?*, *-h*, *--help*::
  36. Display program usage and exit.
  37. *-b*, *--binary*::
  38. Put the GNSS receiver into native (binary) mode.
  39. *-c RATE*, *--rate RATE*::
  40. Change the receivers's cycle time. Units are seconds. Note, most
  41. receivers have a fixed cycle time of 1 second.
  42. *-D LVL*, *--debug LVL*::
  43. Set level of debug messages.
  44. *-e*, *--echo*::
  45. Generate the packet from any other arguments specified and ship it to
  46. standard output instead of the device. This switch can be used with
  47. the *-t* option without specifying a device. Note: the packet data
  48. for a binary prototype will be raw, not ASCII-ized in any way.
  49. *-f*, *--force*::
  50. Force low-level access (not through the daemon).
  51. *-l*, *--list*::
  52. List a table showing which option switches can be applied to which
  53. device types, and exit.
  54. *-n*, *--nmea*::
  55. Put the GNSS receiver into NMEA mode.
  56. *-r*, *--reset*::
  57. Reset the GNSS receiver. Device port and type must be specified.
  58. *-R*, *--rmshm*::
  59. Remove the GPSD shared-memory segment used for SHM export. This option
  60. will normally only be of interest to GPSD developers.
  61. *-s SPEED*, *--speed SPEED*::
  62. Set the baud rate at which the receiver emits packets.
  63. Use the *-s* option with caution. On USB and Bluetooth GPSes it is also
  64. possible for serial mode setting to fail either because the serial
  65. adaptor chip does not support non-8N1 modes or because the device
  66. firmware does not properly synchronize the serial adaptor chip with
  67. the UART on the GPS chipset when the speed changes. These failures can
  68. hang your device, possibly requiring a GPS power cycle or (in extreme
  69. cases) physically disconnecting the NVRAM backup battery.
  70. *-t TYPE*, *--type TYPE*::
  71. Force the device type.
  72. *-T TIMEOUT*, *--timeout TIMEOUT*::
  73. Change the sampling timeout. Defaults to 8 seconds, which should
  74. always be sufficient to get an identifying packet from a device
  75. emitting at the normal rate of 1 per second.
  76. *-V*, *--version*::
  77. Display program version and exit.
  78. *-x STR*, *--ship STR*::
  79. Send a specified control string to the GPS, *gpsctl* will provide packet
  80. headers and trailers and checksum as appropriate for binary packet
  81. types, and whatever checksum and trailer is required for text packet
  82. types. (You must include the leading $ for NMEA packets.) When sending
  83. to a UBX device, the first two bytes of the string supplied will
  84. become the message class and type, and the remainder the payload. When
  85. sending to a Navcom NCT or Trimble TSIP device, the first byte is
  86. interpreted as the command ID and the rest as payload. When sending to
  87. a Zodiac device, the first two bytes are used as a message ID of type
  88. little-endian short, and the remainder as payload in byte pairs
  89. interpreted as little-endian short. For all other supported binary
  90. GPSes (notably including SiRF) the string is taken as the entire
  91. message payload and wrapped with appropriate header, trailer and
  92. checksum bytes. C-style backslash escapes in the string, notably \xNN
  93. for hex, will be interpreted; additionally, \e will be replaced with
  94. ESC. This switch implies *-f*.
  95. The argument of the forcing option, *-t*, should be a string which is
  96. contained in exactly one of the known driver names; for a list, do
  97. *gpsctl -l*.
  98. Forcing the device type behaves somewhat differently depending on
  99. whether this tool is going through the daemon or not. In high-level
  100. mode, if the device that daemon selects for you doesn't match the driver
  101. you specified, *gpsctl* exits with a warning. (This may be useful in
  102. scripts.)
  103. In low-level mode, if the device identifies as a Generic NMEA, use the
  104. selected driver instead. This will be useful if you have a GPS device of
  105. known type that is in NMEA mode and not responding to probes. (This
  106. option was originally implemented for talking to SiRFStar I chips, which
  107. don't respond to the normal SiRF ID probe.)
  108. If no options are given, the program will display a message identifying
  109. the GPS type of the selected device and exit.
  110. Reset (*-r*) operations must stand alone; others can be combined.
  111. Multiple options will be executed in this order: mode changes (*-b*
  112. and -*n*) first, speed changes (*-s*) second, and control-string
  113. sends (*-c*) last.
  114. [[environment]]
  115. == ENVIRONMENT VARIABLES
  116. By setting the environment variable *GPSD_SHM_KEY*, you can control
  117. the key value used to designate the shared-memory segment removed with
  118. the -R option. This will be useful mainly when isolating test instances
  119. of *gpsd* from production ones.
  120. == EXAMPLES
  121. *gpsctl /dev/ttyUSB0*::
  122. Attempt to identify the device on USB serial device 0. Time out after
  123. the default number of seconds. Adding the *-f* will force low-level
  124. access and suppress the normal complaint when this tool can't find a
  125. GPSD to work through.
  126. *gpsctl -f -n -s 9600 /dev/ttyUSB0*::
  127. Use low-level operations (not going through a *gpsd* instance) to switch
  128. a GPS to NMEA mode at 9600bps. The tool will identify the GPS type
  129. itself.
  130. == BUGS
  131. SiRF GPSes can only be identified by the success of an attempt to flip
  132. them into SiRF binary mode. Thus, the process of probing one of these
  133. running in NMEA will change its behavior.
  134. Baud rate and mode changes work in direct mode but are not reliable in
  135. client mode. This will be fixed in a future release.
  136. == RETURN VALUES
  137. *0*:: on success.
  138. *1*:: on failure
  139. == SEE ALSO
  140. *gpsd*(8), *gpsdctl*(1), *gps*(1), *ubxtool*(1), *zerk*(1)
  141. == RESOURCES
  142. *Project web site:* {gpsdweb}
  143. == COPYING
  144. This file is Copyright 2013 by the GPSD project +
  145. SPDX-License-Identifier: BSD-2-clause