[LinuxPPS] refclock_nmea patch
Udo van den Heuvel
udovdh at xs4all.nl
Tue Oct 23 18:11:45 CEST 2007
Rodolfo Giometti wrote:
>> Yes, but now what if we have a device with one /dev/bla giving NMEA and
>> another /dev/duh giving PPS?
>> How is the first /dev/bla passed on to ntpd?
>> I don't get this yet.
>>
>> In my own situation we have NMEA and PPS on teh same RS232 port.
>> I then expect the first link that I apss to LinuxPPS to be used, which
>> isn't.
>
> The first (or main) device is the GPS data source (/dev/ttyS0 in your
> case) which __could__ be also a PPS data source.
In my case it is, but PPS is not taken from there.
>>>> Maybe this can help:
>>>> When is the /dev entry (pps0) created?
>>>> Based on what input?
>>> If you have udev when the pps device is created, otherwise you have to
>>> create it by yourself by using mknod.
>> It was there, so udev works I guess.
>> How is decided what port is to be created?
>
> The system decides the PPS id just the ethernet devices.
But why not for /dev/ttyS1? S2? etc?
>> I once had a /dev/gps0 and /dev/pps0 pointing to /dev/ttyS0.
>> /dev/pps0 was replaced by the new device entry.
>> Why?
>
> No you should have:
>
> /dev/gps0 --> /dev/ttyS0
> /dev/pps0
I have this.
>> /*
>> * nmea_start - open the GPS devices and initialize data for processing
>> */
>> static int
>> nmea_start(
>> int unit,
>> struct peer *peer
>> )
>> {
>> register struct nmeaunit *up;
>> struct refclockproc *pp;
>> int fd;
>> char device[20];
>>
>> /*
>> * Open serial port. Use CLK line discipline, if available.
>> */
>> (void)sprintf(device, DEVICE, unit);
>>
>> fd = refclock_open(device, SPEED232, LDISC_CLK);
>> if (fd <= 0) {
>> #ifdef HAVE_READLINK
>> (nmead stuff cut)
>> #endif
>> }
>>
>> /*
>> * Allocate and initialize unit structure
>> */
>> up = (struct nmeaunit *)emalloc(sizeof(struct nmeaunit));
>> if (up == NULL) {
>> (void) close(fd);
>> return (0);
>> }
>> memset((char *)up, 0, sizeof(struct nmeaunit));
>> pp = peer->procptr;
>> pp->io.clock_recv = nmea_receive;
>> pp->io.srcclock = (caddr_t)peer;
>> pp->io.datalen = 0;
>> pp->io.fd = fd;
>
> Here the fs is saved, so everything is ok.
So maybe we should make the msyslog messages more clear that the open of
the NMEA source went OK?
>
> Good! It's ok.
>
But not clear enough.
BIG issue:
Also it is strange that PPS is not taken from /dev/gps0.
The time_pps_create fails, why?
Udo
More information about the LinuxPPS
mailing list