fix ts2phc to reset NMEA parser after RMC message (RHEL-54724)

Resolves: RHEL-54724
This commit is contained in:
Miroslav Lichvar 2024-08-19 12:59:21 +02:00
parent 8a2fbb8daf
commit 5738473c03
2 changed files with 28 additions and 0 deletions

26
linuxptp-nmeareset.patch Normal file
View File

@ -0,0 +1,26 @@
commit 293ca74b9df22a75951eea72426869a7ee9eb023
Author: Miroslav Lichvar <mlichvar@redhat.com>
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 <mlichvar@redhat.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
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;
}

View File

@ -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