[LinuxPPS] 17Jun Patch

Cirilo Bernardo cirilo.bernardo at gmail.com
Wed Jun 18 03:17:56 CEST 2008


On Wed, Jun 18, 2008 at 12:44 AM,  <clemens at dwf.com> wrote:
[snip]
>>
>> It looks right to me; the PPS virtual device is not a TTY so the IOCTL
>> should fail.  It is the GPS device which should continue to function
>> as a TTY and essentially be unaffected by the PPS line discipline.
>>
>> - Cirilo _______________________________________________
>
> The IOCTL in question is TIOCGETD which gets the type of the line discipline,
> and there should be no failure in returning that value.
>
> I would expect the Serial device to be a serial device, nothing should have
> changed there, and it should return "0" for N_TTY.
> The new device /dev/pps1 should return 17 for N_PPS.
>

I don't agree; line disciplines are associated with TTY devices.  A
serial port can only be associated with one line discipline at a time,
so when a port is used for a GPS device with the PPS ldisc you should
expect the reported line discipline to be the one for PPS, not N_TTY.
However, there is no reason that the PPS line discipline would not
behave as N_TTY in all other respects.  Extremely few programs
actually query or change the line discipline (pppd being the most
common in use) so for all other programs, they should work and never
suspect that the line discipline N_TTY had been replaced by the PPS
one.  Now to play friendly with a system, the PPS ldisc should be set
only on a port being used for that purpose.  Most software can still
use that serial port for other purposes (although usually people will
also have their GPS on that port).  pppd and pps cannot share that
port - this is a fundamental limitation of the ldisc approach.

The PPS device (/dev/pps0) is not a TTY device, it does not support
any of the features of a TTY, has no termios, and it has no line
discipline - so how can it possibly report a line discipline?  I would
expect 'gps0' to behave exactly like a normal serial port, but I would
not expect 'pps0' to behave that way.

I think you're confusing the abstract device with the physical
implementation.  pps0 implements the PPS API described in RFC 2783 and
has absolutely nothing to do with serial ports; it is just that you
can have an implementation that makes use of a serial port.  In my
case, my hardware uses an independent IRQ so my PPS really has nothing
to do with a serial port - should I expect to return a line discipline
code when my pps0 device is queried?

The PPS device code itself is absolutely ignorant of the mechanics of
obtaining the timestamp; all it knows is that some code had called a
function to give it a timestamp and indicate if the event was a CLEAR
or ASSERT; I can see no sense at all in the device pretending to be a
TTY and supporting the IOCTL to report a line discipline.

- Cirilo



More information about the LinuxPPS mailing list