[LinuxPPS] pps stops when ntpd starts?

William S. Brasher billb958 at door.net
Wed Jun 10 18:57:25 CEST 2009


On Wed, 10 Jun 2009, Udo van den Heuvel wrote:

> William S. Brasher wrote:
> > The following patch to ldattach will "fix" the problem and with ppstest
> > hanging and ntpd never seeing the pps signal after ntpd is started:
> 
> These ioctl flags are the ones missing in ldattach versus ppsldisc?
> 
> 
> 


I used stty to get the flags after ppsldisc and then after ntpd was 
started.  Then I stopped ppsldisc and ntpd, started ldattach, got the 
flags, and then started ntpd, and got the flags.  After ntpd was run the 
flags were the same as set by ppsldisc.  Ldattach, however, does not set 
ignbrk and icrnl and icanon were marked -crnl and -icanon.

So, I just started setting flags in ldattach to get it to match what ntpd 
seemed to want, and after setting IGNBRK and ICRNL in c_iflag things 
started to work. Note that -icanon is also gone after ntpd is running, but 
letting ntpd set that flag didn't kill the pps signal.



First, this is the result of running ldattach on a serial port that hasn't 
been touched:

root at tara: # /usr/src/util-linux-ng-2.15.1-rc1/sys-utils/ldattach 18 /dev/ttyS0
root at tara: # stty < /dev/ttyS0
speed 9600 baud; line = 18;
min = 1; time = 0;
ignbrk -brkint -imaxbel
-opost
-isig -icanon -iexten -echo



If I run ntpd here it will fail to start; it will however 'setup' the 
serial port so that running the patched ldattach will leave the serial 
port ready for ntpd.  

I haven't had the chance to go through ldattach, ntpd, and the muck of 
termios and friends to find out how to set all those other things stty is 
showing.

In other words, right now after booting the machine I have to run ntpd to 
get the serial port prepared for ldattach, then run ldattach, and finally 
start ntpd.




Now, after "preparing" the serial port this is what I get running 
ppsldisc/ldattach/ntpd:


root at tara: # /usr/sbin/ppsldisc /dev/ttyS0 &
[1] 2438
root at tara: # stty < /dev/ttyS0
speed 4800 baud; line = 18;
intr = <undef>; quit = <undef>; erase = <undef>; kill = <undef>; eof = <undef>; start = <undef>; stop = <undef>;
susp = <undef>; rprnt = <undef>; werase = <undef>; lnext = <undef>; flush = <undef>;
ignbrk -brkint -imaxbel
-opost -onlcr
-isig -iexten -echo -echoe -echok -echoctl -echoke


root at tara: # /usr/sbin/ntpd -g
root at tara: # stty < /dev/ttyS0
speed 4800 baud; line = 18;
intr = <undef>; quit = <undef>; erase = <undef>; kill = <undef>; eof = <undef>; start = <undef>; stop = <undef>;
susp = <undef>; rprnt = <undef>; werase = <undef>; lnext = <undef>; flush = <undef>;
ignbrk -brkint -imaxbel
-opost -onlcr
-isig -iexten -echo -echoe -echok -echoctl -echoke




And, finally, this is after running an unpatched ldattach:

root at tara: # ldattach 18 /dev/ttyS0

root at tara: # stty < /dev/ttyS0
speed 4800 baud; line = 18;
intr = <undef>; quit = <undef>; erase = <undef>; kill = <undef>; eof = <undef>; start = <undef>; stop = <undef>;
susp = <undef>; rprnt = <undef>; werase = <undef>; lnext = <undef>; flush = <undef>; min = 1; time = 0;
-brkint -icrnl -imaxbel
-opost -onlcr
-isig -icanon -iexten -echo -echoe -echok -echoctl -echoke

root at tara: # /usr/sbin/ntpd -g
root at tara: # stty < /dev/ttyS0
speed 4800 baud; line = 18;
intr = <undef>; quit = <undef>; erase = <undef>; kill = <undef>; eof = <undef>; start = <undef>; stop = <undef>;
susp = <undef>; rprnt = <undef>; werase = <undef>; lnext = <undef>; flush = <undef>;
ignbrk -brkint -imaxbel
-opost -onlcr
-isig -iexten -echo -echoe -echok -echoctl -echoke






More information about the LinuxPPS mailing list