[LinuxPPS] termios et all

Udo van den Heuvel udovdh at xs4all.nl
Wed Jun 17 17:48:50 CEST 2009


Hello,

I am trying to incorporate the patch to ldattach in refclock_nmea so we
can use a 'stock' ldattach.

But I am having no success.
Also I am seeing strange (?) things.

An unpatched ldattach logs this when debugging:

# ./ldattach 18 /dev/ttyS0
ldattach:opened /dev/ttyS0
ldattach:get to raw 0 ---: cflag=0x8bc
ldattach:get to raw 0 ---: iflag=0x105
ldattach:set to raw 0 ---: cflag=0x8bc
ldattach:set to raw 0 ---: iflag=0x4
ldattach:line discipline set to 18

Notice the change that the unpatched ldattach makes.

But ntpd starting immediately after that says:

Jun 17 17:35:28 epia klogd: new PPS source serial0 at ID 0
Jun 17 17:35:28 epia klogd: PPS source #0 "/dev/ttyS0" added
Jun 17 17:35:33 epia ntpd[28198]: ntpd 4.2.4p6 at 1.1549-o Wed Jun 17
14:20:07 UTC 2009 (1)
Jun 17 17:35:33 epia ntpd[28199]: precision = 1.554 usec
Jun 17 17:35:33 epia ntpd[28199]: Listening on interface #0 wildcard,
0.0.0.0#123 Disabled
(....)
Jun 17 17:35:33 epia ntpd[28199]: Listening on routing socket on fd #27
for interface updates
Jun 17 17:35:33 epia ntpd[28199]: kernel time sync status 2040
Jun 17 17:35:33 epia ntpd[28199]: refclock_nmea: found GPS source
"/dev/gps0"
Jun 17 17:35:33 epia ntpd[28199]: get cflag=0x8bc
Jun 17 17:35:33 epia ntpd[28199]: get iflag=0x105
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ termios ts read from port

Jun 17 17:35:33 epia ntpd[28199]: set cflag=0x8bc
Jun 17 17:35:33 epia ntpd[28199]: set iflag=0x105
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ termios ts set to port

Jun 17 17:35:33 epia ntpd[28199]: refclock_nmea: try "/dev/gpspps0" for PPS
Jun 17 17:35:33 epia ntpd[28199]: refclock_nmea: found PPS source
"/dev/gpspps0"
Jun 17 17:35:33 epia ntpd[28199]: refclock_atom: time_pps_kcbind failed:
Operation not supported
Jun 17 17:35:33 epia ntpd[28199]: frequency initialized -114.205 PPM
from /var/lib/ntp/drift

So after opening the port the flags cflag/iflag are already like they
are needed to be.
So changing them following the patch that William posted appears not
necessary. (!?)

But ldattach only works well with ntpd when ldattach HAS the patch that
William made.

Who can explain why this stuff works like it does?



More information about the LinuxPPS mailing list