ntp.conf new refclock configuration syntax

Achim Gratz Stromeko at nexgo.de
Sun Nov 27 08:50:01 UTC 2016


Eric S. Raymond writes:
> I would expect pulling the baud rate into the mode field to work, because
> here's the logic:
>
> 	/* Old style: get baudrate choice from mode byte bits 4/5/6 */
> 	rate = (peer->ttl & NMEA_BAUDRATE_MASK) >> NMEA_BAUDRATE_SHIFT;
>
> 	/* New style: get baudrate from baud option */
> 	if (peer->baud)
> 		rate = peer->baud;
>
> Then the following switch is set up to accept either small-integer values
> or larger ones in the range 300..115200 and do the right thing.  What's
> mysterious is how you are coming out of that logic with speed set to zero.

The logic inside the switch is good, you fail while opening the device
25 lines down.  The driver needs a code for the selected baudrate, not
the baudrate itself as an integer number.  It only gets that code when
it's not using the baud parameter.  Why the baudrate gets effectively
set to zero as a result I don't know, but I don't care much about it.

> Please try configuring with 
>
> ./waf configure --enable-crypto --refclock=all --enable-debug-gdb
>
> and tracing through this yourself.  

Luckily no need for that, this patch fixes it:

--- a/ntpd/refclock_nmea.c
+++ b/ntpd/refclock_nmea.c
@@ -475,7 +475,7 @@ nmea_start(
        /* Open serial port. Use CLK line discipline, if available. */
        snprintf(device, sizeof(device), DEVICE, unit);
        pp->io.fd = refclock_open(peer->path ? peer->path : device,
-                                 peer->baud ? peer->baud : baudrate,
+                                 baudrate,
                                  LDISC_CLK);
        if (0 >= pp->io.fd) {
                pp->io.fd = nmead_open(device);


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Factory and User Sound Singles for Waldorf Q+, Q and microQ:
http://Synth.Stromeko.net/Downloads.html#WaldorfSounds



More information about the devel mailing list