Re: kernel PPS support for 4 wire serial ports

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Oh well, yes, I know its ugly.

Before I try to make up something let's consider the options:

Using other hardware is not an option - I can remember using DCD and RI
but that was 30 years ago. Looking at what Maxim offers its sensible
that manufacturers leave out another chip required just to wire up pins
that are typically unused nowadays.

I would prefer not to add another line discipline as this would require
changes to userspace.

This leaves either a sysfs or an ioctl interface. I presume sysfs
should be the way to go.

An interface similar to "rx_trig_bytes" could be created, e.g. named
"4wire_pps" with a default zero value. The "4wire_pps" value would
relate to the new "UART_CAP_4WIRE" bit of the capabilities member of
the uart_8250_port structure.

Setting this bit via the sysfs interface would then cause the use CTS
instead of DCD for the PPS line discipline.

The drawback of this solution is the added code to the interrupt
handling routines which currently is prevented by the ugly if(n)def.

Thoughts?

On Wed, 2017-09-20 at 08:24 +0200, Greg KH wrote:
> On Tue, Sep 19, 2017 at 11:44:57PM +0200, Andreas Steinmetz wrote:
> > [Please CC me on replies, I'm not subscribed]
> > 
> > There's systems around that only have incompletely wired serial
> > ports,
> > e.g. the CompuLab Intense PC3 which only has 4 wire serial ports
> > (RxD,
> > TxD, RTS, CTS).
> > 
> > The kernel currently only supports DCD for the PPS line discipline.
> > 
> > The attached patch adds a configuration option that allows CTS to
> > be
> > used instead of DCD for the PPS line discipline for 8250/16x50
> > based
> > serial ports.
> > 
> > It may look a bit ugly but it seems to me to be the least intrusive
> > way
> >  to enable the use of the kernel PPS line discipline for machines
> > with
> > incompletely wired serial ports.
> > 
> > The patch is actually against 4.12.10 (sorry for the older kernel)
> > and
> > tested with gpsd on a CompuLab Intense PC3.
> > -- 
> > Andreas Steinmetz                       SPAMmers use robotrap@domdv
> > .de
> > --- linux.orig/drivers/tty/serial/serial_core.c	2017-09-19
> > 22:15:00.655700355 +0200
> > +++ linux/drivers/tty/serial/serial_core.c	2017-09-19
> > 22:15:05.748732334 +0200
> > @@ -2920,10 +2920,13 @@
> >  {
> >  	struct tty_port *port = &uport->state->port;
> >  	struct tty_struct *tty = port->tty;
> > +#ifndef CONFIG_PPS_CLIENT_LDISC_CTS
> >  	struct tty_ldisc *ld;
> > +#endif
> 
> 
> Ick, that's pretty bad.  And probably something, if you really wanted
> to
> do this, you should do on a per-port basis, not for all serial ports,
> right?
> 
> Also, we hate #ifdef in .c code, as well as the patch not being in a
> format we could apply it in, even if we liked it.
> 
> Care to fix it up to be more general purpose?  Or how about just
> buying
> better hardware?  :)
> 
> thanks,
> 
> greg k-h
-- 
Andreas Steinmetz                       SPAMmers use robotrap@xxxxxxxx
D.O.M. Datenverarbeitung GmbH
Geschäftssitz: Bahnhofstr. 41, 90402 Nürnberg
Telefon: +49 (0)911 - 99462-0, Fax: +49 (0)911 - 99462-11
Amtsgericht Nürnberg HRB 1455, UST-Ident.-Nr. DE133508452
Geschäftsführer: Alfred Jakob

--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux