[LinuxPPS] Patches for kernel 2.6.26-rc8
Hal V. Engel
hvengel at astound.net
Fri Jul 4 02:34:41 CEST 2008
On Thursday 03 July 2008 04:33:50 am Rodolfo Giometti wrote:
> On Thu, Jul 03, 2008 at 12:11:15AM +0000, Cirilo Bernardo wrote:
> > On Wed, Jul 2, 2008 at 7:16 PM, Hal V. Engel <hvengel at astound.net> wrote:
> > [snip]
> >
> > > Also when I call ppsldisc in my udev rules it appears to fail and I
> > > have to run it by hand to get the pps device setup. What needs to be
> > > done to get this to work as part of the udev rules so that the device
> > > is created at boot time?
> >
> > Isn't the /dev/ppsN device only created when the N_PPS ldisc is set?
> > In which case there is no point in invoking ppsldisc when the device
> > is created.
> >
> > I think the most convenient thing to do to overcome the various
> > problems, including the problems brought up by Reg, is to set up the
> > boot scripts to create the /dev/ppsN device nodes which will be used
> > on the system. For those running Debian GNU/Linux, this can be done
> > by modifying the /etc/udev/links.conf file. If the device nodes are
> > created statically then the only remaining issue is when to call the
> > IOCTL to set N_PPS. The udev rules may also need to be modified so
> > that the device nodes are not removed when the device driver is
> > unloaded.
>
> Another (and maybe better) solution is to use ppsldisc __before__
> running NTPD. So you should modify your NTPD init script in order to
> do something like that:
>
> ...
> ppsldisc $SERIAL_PORT &
> ntpd <options>
> killall ppsldisc
> ...
>
> In this manner udev creates for you the pps device and you don't need
> to modify the refclocks code at all.
>
> Ciao,
>
> Rodolfo
OK I got it working. But I am not real happy with what has to be done to get
everything started. Since there are some things going on that don't seem to
be correct based on what little documentation is available and some of what I
have done is an ugly hack.
One change that I didn't expect that was causing me problems initially is that
pps_core can not be built into the kernel anymore and is now a module only.
For prior versions this could be built into the kernel. Perhaps this can be
fixed?
Even after setting up my boot process so that it now loads pps_core I found
getting ppsldisc to actually work is problematic. I found that running
setserial ... before ppsldisc worked? I stumbled onto this by accident. So I
am not sure that I understand the current implementation. But at this point I
have not found any other combination of commands that works. Wasn't ppsldisc
supposed to get rid of setserial and friends or is there something else going
on here that I missed?
I also tried using ttyctrl before ppsldisc and that did not work. To try to
get things working without having to run stuff by hand I found that the
following udev rules resulted in there being a working pps signal at startup:
KERNEL=="ttyS1", RUN+="/bin/setserial -v /dev/%k low_latency hardpps",
SYMLINK+="oncore.serial.0"
KERNEL=="ttyS1", RUN+="/bin/ppsldisc /dev/%k"
KERNEL=="pps0", OWNER="root", GROUP="uucp", MODE="0660",
SYMLINK+="oncore.pps.0", OPTIONS+="last_rule"
Since the above rules resulted in running ppstest having the expected output.
But it also resulted in ntpd not seeing the GPS:
54650 85410.279 127.127.30.0 ONCORE DRIVER -- CONFIGURING
54650 85410.279 127.127.30.0 state = ONCORE_NO_IDEA
54650 85410.279 127.127.30.0 Input mode = 1
54650 85410.279 127.127.30.0 Initializing timeing to Assert..
54650 85410.279 127.127.30.0 SHMEM (size = 3584) is CONFIGURED and
available as /var/log/ntp/oncore.0
54650 85410.279 127.127.30.0 state = ONCORE_CHECK_ID
54650 85411.272 127.127.30.0 Oncore: Resend @@Cj
54650 85426.272 127.127.30.0 Oncore: Resend @@Cj
54650 85442.272 127.127.30.0 Oncore: Resend @@Cj
54650 85460.272 127.127.30.0 Oncore: No response from @@Cj, shutting down
driver
So this looks like this somehow makes the serial interface not work but I can
run WinOncore and it sees the GPS so that does not make sense. Based on this
it appears that for this to work the following had to happen.
1. setserial with hardpps either by hand or in a udev rule
2. run ppsldisc
3. while #2 is still running start ntpd.
So I ended up removing the ppsldisc line from the udev rule and modifying
/etc/init.d/ntpd so that the line that starts the ntp deamon looks like this:
/bin/ppsldisc /dev/ttyS1 & start-stop-daemon --start --exec /usr/sbin/ntpd \
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ml.enneenne.com/pipermail/linuxpps/attachments/20080703/c1b745ca/attachment.htm
More information about the LinuxPPS
mailing list