[LinuxPPS] LinuxPPS 5.0.0-rc1
Rodolfo Giometti
giometti at enneenne.com
Thu Aug 9 21:48:45 CEST 2007
On Thu, Aug 09, 2007 at 06:21:02PM +0200, Udo van den Heuvel wrote:
> > If you supply one device it tries to read both GPS and PPS data from
> > it, but if you supply 2 devices it tries to read GPS data from
> > /dev/refclock-u while PPS data from /dev/refclockpps-u.
>
> So I make two links pointing to the same /dev/ttySx for my current
> Garmin GPS18?
No. In LinuxPPS a device can __not__ be in the same time a serial line
__and__ a PPS source, they must be considered as __two__ separate
devices.
Current refclocks implementations (but PARSE) consider GPS data device
and PPS source as the same device and this is __never__ true into
LinuxPPS, so your modifications should provide a way so that refclocks
can consider the possibility of opening __two__ devices.
Current (and wrong) implementation, do something like this:
fd = open("/dev/ttyS0", ...);
time_pps_create(fd, &handle);
new implementation should do instead:
fd_gps = open("/dev/ttyS0", ...);
fd_pps = open("/dev/pps0", ...);
time_pps_create(fd_pps, &handle);
PARSE uses bit 7 of the device unit ID to decide what to do. Here the
simplyfied code:
sprintf(gps_name, "/dev/refclock-%d", unit & 0x7f);
fd_gps = open(gps_name, ...);
if (unit & 0x80) {
sprintf(pps_name, "/dev/refclockpps-%d", unit & 0x7f);
fd_pps = open(pps_name, ...);
} else
fd_pps = fd_gps;
time_pps_create(fd_pps, &handle);
So, if you supply "unit = 0x03", PARSE will open device
"/dev/refclock-3" for __both__ GPS data and PPS data, but if you
supply "unit = 0x83" then it will open "/dev/refclock-3" for GPS data
and "/dev/refclockpps-3" for PPS data only.
Of course, in your case, after similar modifications on your refclock,
you need to do symbolic links as follow:
/dev/gps0 --> /dev/refclock-3
/dev/pps0 --> /dev/refclockpps-3
> So for NMEA plus PPS (like on the Garmin GPS18 I have) I could make a
> patch that accepts one device where it finds both PPS and NMEA by
> default? (alternate approach from the link suggestion above)
> And as extra (to make it flexible like expected) I can have it receive
> PPS from another device file.
>
> For the PPS driver we supply two devices where only the PPS device file
> works?
The code above should be clear enought, but please feel free to ask
for any doubt or question. :)
Ciao,
Rodolfo
--
GNU/Linux Solutions e-mail: giometti at enneenne.com
Linux Device Driver giometti at gnudd.com
Embedded Systems giometti at linux.it
UNIX programming phone: +39 349 2432127
More information about the LinuxPPS
mailing list