Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Gpsd Knowledge Patch?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/nevaberry-gpsd-knowledge-patch)
---
name: gpsd-knowledge-patch
description: gpsd
version: "3.27"
license: MIT
metadata:
author: Nevaberry
---
# GPSD compatibility and operation
Load this skill when building or upgrading GPSD, writing clients, interpreting
receiver reports, configuring receivers, capturing observations, or setting up
time service. Use the topic references for complete command details, receiver
conditions, protocol fields, and migration history.
## Reference index
| Reference | Topics |
| --- | --- |
| [Release compatibility](references/release-compatibility-and-security.md) | Source pins, API migrations, deprecations, build changes, tool and protocol compatibility |
| [Installation and building](references/installation-and-building.md) | Matching packages, dependencies, SCons, cross-builds, regression tests, platform setup |
| [Client programming](references/client-programming.md) | Socket watches, C/C++/Python reads, freshness, shared memory, D-Bus, endpoints and units |
| [Daemon architecture](references/daemon-architecture.md) | Device activation, control socket, subscriber constraints, identity, correction forwarding |
| [Daemon operation](references/daemon-operation.md) | Serial settings, network inputs, SocketCAN, hotplug, capabilities, diagnostics and timeouts |
| [JSON protocol](references/json-protocol.md) | Framing, WATCH/POLL/DEVICE, TPV/SKY, attitude, timing, RTCM, AIS and SUBFRAME |
| [Data pipeline tools](references/data-pipeline-tools.md) | gpscat, gpspipe, gps2udp, gpsdecode, gpsfake and gpsrinex |
| [Monitoring and profiling](references/monitoring-and-profiling-tools.md) | cgps, gpsmon controls, packet logs, position and timing profiles |
| [NMEA protocols](references/nmea-protocols.md) | Escapes, fix quality, constellation and signal IDs, residuals, attitude and depth |
| [Precise point positioning](references/precise-point-positioning.md) | Raw observations, receiver setup, capture duration, CSRS-PPP, RTX and GAPS |
| [Receiver hardware and control](references/receiver-hardware-and-control.md) | gpsctl framing, driver selection, receiver-specific setup, PPS wiring and firmware |
| [Time service](references/time-service.md) | PPS, SHM allocation, ntpd, NTPsec, chrony, calibration and PTP |
| [Troubleshooting](references/troubleshooting.md) | systemd, udev, tty access, suspend, SiRF behavior, SBAS and reproducible captures |
| [ubxtool](references/ubxtool.md) | Protocol discovery, configuration layers, rates, logging, survey-in, signals and timepulse |
## Upgrades and deprecations
Keep the daemon, libraries, and clients on the same release. When switching
from distro packages to source, remove the old GPSD daemon, client packages,
and libraries first. Use distro packages or the matching source build for
the Python client; the PyPI `gpsd` package is an obsolete third-party client.
For source pins, the corrected API version, and the `cgps` API match check, consult
[release compatibility](references/release-compatibility-and-security.md).
### C client migrations
| Older interface | Migration |
| --- | --- |
| `gps_data_t.status` | Read `session.fix.status` in the embedded `gps_fix_t`. |
| `STATUS_NO_FIX`, `STATUS_FIX`, `STATUS_DGPS_FIX` | Use `STATUS_UNK`, `STATUS_GPS`, `STATUS_DGPS`, respectively. |
| `timestamp_t` | Update stored and passed timestamps to `timespec_t`. |
| `epe` outside the fix | The field moved into `gps_fix_t`. |
| `session.separation` | Read `session.fix.geoid_sep`. |
| Deprecated `gps_fix_t.altitude` | Use `gps_fix_t.altHAE` or `gps_fix_t.altMSL`. |
| `gpsd_hexpack()`, `gpsd_hexdump()` | Use public `gps_hexpack()` and `gps_hexdump()` from `gps.h`. |
Satellite elevation and azimuth are `double`; unknown elevation, azimuth and
signal strength use `NaN`. Check `elevation`, `azimuth` and `ss` with
`isfinite()`. Guard supported interfaces with `GPSD_API_MAJOR_VERSION` and
`GPSD_API_MINOR_VERSION` from `gps.h`.
### Build and tool changes
- `gpsmon` and the `Lexer()` FFI interface are deprecated; check lexer callers
when updating integrations that use that entry point.
- NTPsec's `ntploggps` moved into GPSD as `gpslogntp`; update package
dependencies and script invocations that used the old command.
- The removed `reconfigure` build option's `reconfigure=no` deployment setting
is replaced by `gpsd -p`; `controlsend` was also removed.
- Runtime `-s` and `-f` replace `FIXED_PORT_SPEED` and `FIXED_STOP_BITS`.
- On upgrade to 3.21, remove old `packet*.so` extensions from the GPSD Python
installation; that release switched to Python code with FFI in `packet.py`.
- SPARTN v2 support is initial and disabled by default; allow for that build
choice when deploying a daemon that needs SPARTN v2 input.
## Start a client and consume reports
A socket starts with `VERSION`. `WATCH` returns `DEVICES` and the effective
watch policy; a later `DEVICE` can identify the driver before a fix exists.
An unrestricted watch includes devices added by hotplug.
For cached polling, enable watching without `json:true`, allow time to collect
reports, then poll:
```text
?WATCH={"enable":true};
?POLL;
```
Use `gps_stream()` to update a C watch. `WATCH_ENABLE` alone defaults to JSON;
`WATCH_RARE` requests hex-encoded binary, while `WATCH_RAW` requests literal
binary. A raw buffer may have no NUL terminator.
```c
gps_stream(&session, WATCH_ENABLE | WATCH_JSON | WATCH_DEVICE, "/dev/ttyUSB0");
```
`gps_read(&session, NULL, 0)` returns a byte count, `0` for no data, or `-1`
for failure. Clear `errno` before the read when distinguishing system errors
from closure or unavailable shared memory, which can leave it clear.
Clear `session.set` before a read when tracking updates. For JSON, `PACKET_SET`
marks a complete decoded report. Check field bits, timestamps and finite values.
`gps_waiting()` uses microseconds. Allow at least two receiver cycles for its
timeout and service the stream more often than one cycle to avoid backlog
and eventual disconnect. C reads can merge several AIS reports into reused
storage; consume individual wire reports when every AIS message matters.
Python `session.read()` returns `0` while successful and nonzero at termination.
`session.response` is text, `session.bresponse` is bytes, and decoded JSON is
available through `session.data`, with `session.data["class"]` identifying it.
## Interpret JSON without assuming a complete fix
Requests begin with `?` and are limited to 80 characters before the newline.
Responses use CRLF framing with a default 10,240-character limit including
CRLF; handle overlong reports as potentially invalid JSON. Omit optional
command properties whose values would otherwise be `null`.
Only `class` and `mode` are guaranteed in TPV; one epoch can produce several
TPVs. A SKY report can contain only `class`. Check timestamps and modes inside
POLL's cached reports; an NMEA fix can be partially assembled or a cycle behind.
Wait for three consecutive 3D fixes before trusting TPV `time` as UTC, and
allow for a seconds-scale error until the receiver knows the leap-second
offset. Use `altHAE` or `altMSL`; deprecated `alt` is undefined.
`altMSL = altHAE - geoidSep`, with possible errors up to 12 m in gpsd's
interpolated EGM2008 separation when the receiver omits it.
Use `gnssid` and constellation-local `svid` when present; include `sigid`
for individual signals. `nSat` counts entries in the `satellites` array.
Treat `ep*`, `eph` and `sep` estimates as relative quality indicators because
confidence varies by receiver and missing estimates can come from the sky view.
## Activate and control receivers
Registered devices normally open when selected by a watch and can close after
the last watcher leaves. Nowait mode opens a device when it is added.
`gpsd -p` suppresses automatic configuration while allowing manual changes.
Use `gpsd -b` for receivers that hang during baud-rate probing.
A client-socket reconfiguration request requires the requesting client to be
the receiver's sole subscriber. For `gpsctl` baud-rate and protocol changes,
release the port and use `gpsctl -f` with the device path and write access.
Daemon-mediated `gpsctl -x` needs the complete packet, including framing and
checksum; direct mode adds the driver's framing and checksum.
For hotplug-only startup, create the control socket with `-F`; it is disabled
by default and required when starting with an empty device list.
```sh
gpsd -F /run/gpsd.sock
```
When testing under systemd, stop both `gpsd.socket` and `gpsd.service` before
launching a foreground daemon; a connection to an active socket can start it
again. See [troubleshooting](references/troubleshooting.md) for listeners and udev.
## Configure u-blox receivers
Poll `MON-VER` and use `PROTVER` for `-P`, retaining the minor version. The
default is protocol 10; command-line options follow `UBXOPTS` and can override it.
Poll settings after changes: a receiver can ACK an ignored command or omit the
ACK for a valid command. `-p RESET` can leave flash settings in place.
For protocol 27 and newer, use configuration items. Gen9 retains some legacy
commands depending on firmware, while Gen10 uses items for configuration.
| Operation | Layer semantics |
| --- | --- |
| `-g ITEM[,LAYER]` | One index: 0 RAM, 1 battery-backed RAM, 2 flash, 7 firmware defaults; omission requests all four. |
| `-z ITEM,VALUE,MASK` | Bitmask: 1 RAM, 2 battery-backed RAM, 4 flash; 7 writes all three where supported. |
| `-x ITEM[,MASK]` | Deletes stored overrides, by default from battery-backed RAM and flash. |
Use mask 1 for a test change. Legacy `CFG-CFG` is deprecated from protocol
23.01; configuration-item receivers should write desired storage layers
explicitly. Verify saved changes again after a power cycle.
## Capture, replay and produce observations
Use `gpspipe -R` alone for byte-exact binary captures intended for decoding;
`-r` selects received or synthesized NMEA and `-w` selects GPSD JSON.
Replay loops by default; `gpsfake -1` runs once and `-P PORT` selects the test
daemon's listening port. Multiple captures can become separate live devices.
RINEX requires supported pseudorange and carrier-phase observations. For UBX
receivers, enable binary output before disabling NMEA so packets keep arriving.
Verify `UBX-RXM-RAWX` output after enabling raw measurements on receivers
that implement it. Offline conversion reads decoded GPSD JSON:
```sh
gpspipe -R -x 14400 gps.example.org > receiver.ubx
gpsdecode < receiver.ubx > receiver.json
gpsrinex -F receiver.json -i 30 -n 480 -f session.obs
```
Keep gpsd running between setup and capture for UBX generations 7 and 8 and
GREIS; repeat setup from the beginning if it restarts. See the
[PPP reference](references/precise-point-positioning.md) for service-specific
observation codes, duration and upload requirements.
## Set up time service
Use `gpsd -n` so reference-clock sampling starts without a watch client.
GPSD expects the pulse before its time report and the report burst to end
before the next pulse; an overlong burst can mispair pulse and timestamp.
Match ntpd refclock units to the active `NTPn` channels in `ntpshmmon`.
Use one ntpd consumer per unit because its read clears the record's ready flag;
`ntpshmmon` can run alongside it. Have chronyd create its SOCK refclock sockets
before gpsd starts, and set `precision` explicitly for chrony SHM inputs.
Native NTPsec GPSD `mode 1` requires valid paired in-band time and PPS.
Experimental `mode 2` falls back to in-band time after 120 seconds without
valid paired samples and returns to strict mode after 40 seconds of stable PPS.
See [time service](references/time-service.md) for allocation, calibration,
sample limits, secondary PPS units and PTP configuration.