From 5738473c0390ee319dfc95d6fda5a48f54bd0045 Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Mon, 19 Aug 2024 12:59:21 +0200 Subject: [PATCH] fix ts2phc to reset NMEA parser after RMC message (RHEL-54724) Resolves: RHEL-54724 --- linuxptp-nmeareset.patch | 26 ++++++++++++++++++++++++++ linuxptp.spec | 2 ++ 2 files changed, 28 insertions(+) create mode 100644 linuxptp-nmeareset.patch diff --git a/linuxptp-nmeareset.patch b/linuxptp-nmeareset.patch new file mode 100644 index 0000000..e0f0407 --- /dev/null +++ b/linuxptp-nmeareset.patch @@ -0,0 +1,26 @@ +commit 293ca74b9df22a75951eea72426869a7ee9eb023 +Author: Miroslav Lichvar +Date: Tue Jun 11 16:17:36 2024 +0200 + + ts2phc: Reset parser after RMC message. + + When the receiver was configured to generate only RMC messages, every + other message was skipped due to the parser not being in the right + state to process another message. Reset the parser to correctly parse + every valid message. + + Signed-off-by: Miroslav Lichvar + Reviewed-by: Jacob Keller + +diff --git a/nmea.c b/nmea.c +index 44c7c01..7f1d9a2 100644 +--- a/nmea.c ++++ b/nmea.c +@@ -171,6 +171,7 @@ int nmea_parse(struct nmea_parser *np, const char *ptr, int buflen, + while (buflen) { + if (!nmea_parse_symbol(np, *ptr)) { + if (!nmea_scan_rmc(np, result)) { ++ nmea_reset(np); + *parsed = count + 1; + return 0; + } diff --git a/linuxptp.spec b/linuxptp.spec index bd0609d..aa1170c 100644 --- a/linuxptp.spec +++ b/linuxptp.spec @@ -31,6 +31,8 @@ Source22: linuxptp.te Patch1: linuxptp-ucastrate.patch # add holdover support to ts2phc Patch2: linuxptp-holdover.patch +# fix ts2phc to reset NMEA parser after RMC message +Patch3: linuxptp-nmeareset.patch # fix ts2phc to handle large NMEA delay Patch4: linuxptp-nmeadelay.patch