[LinuxPPS] More on problem with the PPS Device.

Rodolfo Giometti giometti at enneenne.com
Mon Jun 30 13:01:44 CEST 2008


On Mon, Jun 30, 2008 at 06:56:09AM +0000, Cirilo Bernardo wrote:
> On Mon, Jun 30, 2008 at 4:03 AM,  <clemens at dwf.com> wrote:
> > But more important, is there some way to work around needing a
> > userland delay to allow udev to do its work.
> >
> > It would be nice to have something that actually waited for the
> > device to be created, but mabe that's not possible.
> >
> 
> Yes, it is possible to check if the device exits - perform an fstat on
> the filename (pps0, pps1 - whatever) and do a usleep() or
> sched_yield() in a loop until the device exists.  Of course this makes
> the NTP code look ugly and is what the NTP developers like to call a
> "Linuxism".  I think the fstat + usleep is portable but no one else
> seems to need it.  This could be largely due to the fact that most
> *NIX systems do not create device nodes dynamically; they still use
> the ancient system where you create all the device nodes which you
> think can possibly exist (and really clutter up the /dev directory).

I think the best solutions are 2:

1) we use an external tool (see my last ppsldisc) executed before NTPD
which set the N_PPS ldisc and wait forever (or, at least, until NTPD
stops).

Possible code:

	...
	ppsldisc $SERIAL_PORT &
	ntpd --use_serial_port=$SERIAL_PORT --use_pps_dev=$PPS_DEV
	killall ppsldisc
	...

2) we made the /dev/pps{N} devices statically hiding the ldisc
settings inside the time_pps_create() (as already prposed).

I vote for 1! :)

Ciao,

Rodolfo

-- 

GNU/Linux Solutions                  e-mail: giometti at enneenne.com
Linux Device Driver                          giometti at linux.it
Embedded Systems                     phone:  +39 349 2432127
UNIX programming                     skype:  rodolfo.giometti



More information about the LinuxPPS mailing list