Skip to content

fix: answer UBX MON-HW and CFG-CFG during ublox init - #11

Merged
edcdavid merged 1 commit into
mainfrom
fix/lptpd-ublox-monitoring
Oct 23, 2026
Merged

edcdavid merged 1 commit into
mainfrom
fix/lptpd-ublox-monitoring

Conversation

@edcdavid

Copy link
Copy Markdown
Collaborator

Problem

linuxptp-daemon initializes its GNSS monitor through ubxtool. Its init sequence polls UBX-MON-HW and then sends CFG-CFG (ubxtool -p SAVE), waiting for a response to both. The mock only answered MON-VER and ACKed CFG-MSG/CFG-VALSET, so ublox.NewUblox timed out:

failed to initialize GNSS monitoring via ublox ... timed out waiting for ublox poll response UBX-MON-HW

It retried forever, no GNSS data ever reached the GM state machine, isSourceLost() stayed false, and a T-GM with gnss-sim never left clock class 6 (no holdover/CC7).

Fix

  • Reply to a UBX-MON-HW (0x0A/0x09) poll with a well-formed 60-byte payload (healthy aStatus/aPower).
  • ACK UBX-CFG-CFG (0x06/0x09) with UBX-ACK-ACK.

NAV-STATUS/NAV-CLOCK polling, periodic NAV emission on open, and CFG-VALSET ACKs were already present.

Testing

  • make builds cleanly for 6.17.0-40-generic.
  • DKMS install + reload, then direct UBX probes on /dev/gnss confirm: MON-VER (70 B), MON-HW (60 B), CFG-CFG ACK {06 09}, CFG-VALSET ACK, NAV-STATUS with gpsFix 3.
  • Extended scripts/test-gnss-ubx.sh with MON-HW (payload length) and CFG-CFG SAVE ACK cases; also fixed its lsmod | grep -q check under pipefail and made NAV sampling drain buffered frames first. Suite passes 45/46; the remaining GGA case is only affected when a gnss-sim instance is concurrently writing to the same /dev/gnss node.

linuxptp-daemon's ublox initialization polls MON-HW and then sends
CFG-CFG (SAVE), waiting for both. The mock only handled MON-VER and
CFG-MSG/CFG-VALSET, so GNSS monitoring never started and T-GM stayed
at clock class 6 instead of entering holdover (CC7) with gnss-sim.

Reply with a valid MON-HW payload and ACK CFG-CFG. Extend the UBX
test script with both cases, fix its lsmod pipefail check, and drain
buffered NAV frames before sampling fix state.
@edcdavid
edcdavid merged commit 863b8e0 into main Oct 23, 2026
25 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant