GPSFAKE(1)
okay bestie, quick vibe check: this is gpsfake(1), straight out of the GPSD Documentation, and it is the test harness era. ๐
if you've ever wanted to fake a GNSS receiver and watch gpsd believe it, welcome home. ๐ฐ๏ธโจ
๐ธ NAME ๐ธ
gpsfake โ test harness for gpsd, simulating a GNSS receiver. that's it, that's the whole personality. ๐
โจ SYNOPSIS โจ
gpsfake [OPTIONS] infile
gpsfake -h
gpsfake -V
๐ DESCRIPTION ๐
so gpsfake is a test harness for gpsd and all its little client besties. here's the whole plot: it opens a pty (pseudo-TTY), launches a gpsd instance that fully believes the slave side of that pty is its GNSS device, and then keeps feeding the contents of one or more test logfiles through the master side to the GNSS receiver. and if you hand it multiple logfiles? the sentences from them get interleaved in the order you specified the files. no cap. ๐ฆ
gpsfake does not require root privileges, but it will run just fine as root. it can even run concurrently with a production gpsd instance without causing problems โ as long as you use the -P option. that's the rule. running under sudo will cause minor loss of functionality. ๐ญ
the logfiles may contain packets in any supported format, including in particular NMEA, SiRF, TSIP, or Zodiac. leading lines beginning with # are treated as comments and ignored โ except in these special cases:
these ones are interpreted directly by gpsfake:
- a comment of the form
#Serial: [0-9] [78][NOE][12]may be used to set serial parameters for the log โ baud rate, word length, stop bits. - a comment of the form
#Transport: UDPmay be used to fake a UDP source rather than the normal pty. - a comment of the form
#Transport: TCPmay be used to fake a TCP source rather than the normal pty.
and this one is interpreted directly by gpsd:
- a comment of the form
# Date: yyyy-mm-dd(ISO8601 date format) may be used to set the initial date for the log.
the gpsd instance is run in foreground. the thread sending fake GNSS data to the daemon is run in background. one does the performing, one does the behind-the-scenes work. main character energy and supporting cast energy. ๐
๐ OPTIONS ๐
-?,-h,--helpโ print a usage message and exit. the classic "help me" moment.-1,--singleshotโ the logfile is interpreted once only, rather than repeatedly. this one is intended to facilitate regression testing. one and done, slay.-b,--batonโ enable a twirling-baton progress indicator on standard error. at termination, it reports elapsed time. it's giving rhythmic gymnastics. ๐-c COUNT,--cycle COUNTโ sets the delay between sentences in seconds. fractional values of seconds are legal. the default is zero (no delay).-d LVL,--debug LVLโ pass a-Doption to the daemon: so-D 4is shorthand for-o="-D 4".-g,-G,--gdb,--lldbโ use the monitor facility to run thegpsdinstance withingpsfakeunder the control ofgdborlldb, respectively. they also disable the timeout on daemon inactivity, to allow for breakpointing. if necessary, the timeout can be reenabled by a subsequent-Wor--wait. ifxtermand$DISPLAYare available, these options launch the debugger in a separatextermwindow, to separate the debugger dialog from the program output โ but otherwise run it directly. in thegdbcase,-tuiis used withxtermbut not otherwise, since curses and program output don't play nicely together. althoughlldblacks an equivalent option, some versions have a'gui'command.-i,--promptmeโ single-step through logfiles. it dumps the line or packet number (and the sentence if the protocol is textual) followed by"? ". only when the user keys Enter is the line actually fed togpsd. you're literally the one pressing play. ๐-l,--linedumpโ print a line or packet number just before each sentence is fed to the daemon. if the sentence is textual (e.g.NMEA), the text is printed as well. if not, the packet will be printed in hexadecimal (except forRTCMpackets, which aren't dumped at all). this option is useful for checking thatgpsfakeis getting packet boundaries right.-m PROG,--monitor PROGโ specify a monitor program (PROG) inside which the daemon should be run. this option is intended to be used withvalgrind(1),gdb(1)and similar programs.-n,--nowaitโ pass-nto the daemon to start the daemon reading the GNSS receiver without waiting for a client (equivalent to-o="-n").-o="OPTS",--option="OPTS"โ specify options to pass to the daemon. the equal sign (=) and quotes are required so thatgpsdoptions are not confused withgpsfakeoptions. to start the daemon reading the GNSS receiver without waiting for a client use-o="-n"(equivalent to the-n) which passes-nto thegpsddaemon. the option-o="-D 4"passes a-D 4to the daemon, equivalent to the using-D 4.-p,--pipeโ sets watcher mode and dump theNMEAandGPSDnotifications generated by the log to standard output. this is useful for regression testing.-P PORT,--port PORTโ sets the daemon's listening port to PORT. that's your concurrency golden ticket, btw. ๐ซถ-q,--quietโ tellgpsfaketo suppress normal progress output and thus act in a quiet manner. shhh. ๐คซ-r STR,--clientinit STRโ specify an initialization command to use in pipe mode. the default is?WATCH={"enable":true,"json":true}.-s SPEED,--speed SPEEDโ sets the baud rate for the slave tty. the default is4800.-S,--slowโ tellsgpsfaketo insert realistic delays in the test input rather than trying to stuff it through the daemon as fast as possible. this will make the test(s) run much slower, but avoids flaky failures due to machine load and possible race conditions in the pty layer. slow and steady wins the regression suite. ๐ข-t,--tcpโ forces the test framework to use TCP rather than pty devices. besides being a test of TCP source handling, this may be useful for testing from within chroot jails where access to pty devices is locked out.-T,--sysinfoโ makesgpsfakeprint some system information and then exit.-u,--udpโ forces the test framework to use UDP rather than pty devices. besides being a test of UDP source handling, this may be useful for testing from within chroot jails where access to pty devices is locked out.-v,--verboseโ enable verbose progress reports to stderr. use multiple times to increase verbosity. it is mainly useful for debugginggpsfakeitself.-w SEC,--wait SECโ set the timeout on daemon inactivity, in seconds. the default timeout is60seconds, and a value of0suppresses the timeout altogether. note that the actual timeout is longer due to internal delays, typically by about20seconds.-x,--predumpโ dump packets asgpsfakegathers them. it is mainly useful for debugginggpsfakeitself.
the last argument(s) must be the name of a file or files containing the data to be cycled at the device. gpsfake will print a notification each time it cycles. ๐
normally, gpsfake creates a pty for each logfile and passes the slave side of the device to the daemon. but if the header comment in the logfile contains the string "UDP", packets are instead shipped via UDP port 5000 to the address 192.168.0.1.255. you can monitor the packet with tcpdump this way:
tcpdump -s0 -n -A -i lo udp and port 5000
๐ฎ MAGIC COMMENTS ๐ฎ
certain magic comments in test load headers can change the conditions of the test. these are:
Serial
may contain a serial-port setting such as 4800 7N2 โ baud rate followed by 7 or 8 for byte length, N or O or E for parity and 1 or 2 for stop bits. the test is run with those settings on the slave port that the daemon sees.
Transport
values 'TCP' and 'UDP' force the use of TCP and UDP feeds respectively (the default is a pty).
Delay-Cookie
must be followed by two whitespace-separated fields, a delimiter character and a numeric delay in seconds. instead of being broken up by packet boundaries, the test load is split on the delimiters. the delay is performed after each feed. can be useful for imposing write boundaries in the middle of packets.
๐ง CUSTOM TESTS ๐ง
gpsfake is a trivial wrapper around a Python module, also named gpsfake, that can be used to fully script sessions involving a gpsd instance, any number of client sessions, and any number of fake GPSes feeding the daemon instance with data from specified sentence logs.
source and embedded documentation for this module is shipped with the gpsd development tools. you can use it to torture test either gpsd itself or any gpsd-aware client application. ๐
logfiles for the use with gpsfake can be retrieved using gpspipe, gpscat, or cgps from the gpsd distribution, or any other application which is able to create a compatible output.
๐ ENVIRONMENT ๐
WRITE_PAD
for unknown reasons gpsfake may sometimes time out and fail. set the WRITE_PAD environment value to a larger value to avoid this issue. a starting point might be "WRITE_PAD = 0.005". values as large os 0.200 may be required.
GPSD_HOME
if gpsfake exits with "Cannot execute gpsd: executable not found." the environment variable GPSD_HOME can be set to the path where gpsd can be found. (instead of adding that folder to the PATH environment variable
โญ RETURN VALUES โญ
0โ on success. ate. ๐1โ on failure.
๐ซถ SEE ALSO ๐ซถ
gpsd(8), gps(1), gpspipe(1), gpscat(1), cgps(1), tcpdump(1), gdb(1), lldb(1), valgrind(1)
๐ RESOURCES ๐
project web site: https://gpsd.io/
๐ COPYING ๐
this file is Copyright 2013 by the GPSD project SPDX-License-Identifier: BSD-2-clause
๐ AUTHOR ๐
Eric S. Raymond
and that's the whole page, bestie ๐ this was GPSD, Version 3.27.5, dated 2025-11-04, and it's the gpsfake(1) manual โ go fake a receiver, you've got this. ๐โจ
๐ฆ where this page comes from
- arch rolling: gpsd 3.27.5-1 ยท BSD
- fedora 44: gpsd-clients 1:3.27.5-3.fc44 ยท BSD-2-Clause
- fedora 44: gpsd-clients 1:3.27.5-5.fc44 ยท BSD-2-Clause
- nixos 26.05: gpsd 3.27.5
- nixpkgs unstable: gpsd 3.27.5
- opensuse-leap 16.0: gpsd-devel 3.27.5-160000.1.1 ยท BSD-3-Clause
- opensuse-leap 16.0: gpsd-devel 3.27.5-160000.1.1 ยท BSD-3-Clause
- opensuse-leap 16.0: gpsd-devel 3.27.5-160000.1.1 ยท BSD-3-Clause
- opensuse-leap 16.0: gpsd-devel 3.27.5-160000.1.1 ยท BSD-3-Clause
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms