Date sent:        Wed, 9 Oct 1996 19:21:27 -0400
From:             "Theodore Y. Ts'o" <tytso@MIT.EDU>
To:               "Ulrich Windl" <ulrich.windl@rz.uni-regensburg.de>
Copies to:        "Theodore Y. Ts'o" <tytso@MIT.EDU>
Subject:          Re: (Fwd) Re:  xntp3-5.8x and Linux

   From: "Ulrich Windl" <ulrich.windl@rz.uni-regensburg.de>
   Date: Fri, 4 Oct 1996 08:14:44 +0200

   If you'd send me a patch for 2.0.21, I'll try it on my one and only 
   machine.

Here you go.... Note that HARDPPS is #ifdef'ed, mostly because hardpps()
doesn't appear to be defined in the kernel anywhere --- at least, it's
not in any header file.  Let me know what I need to include for
hardpps(), and I'll modify my patches accordingly.  

(Also, you'll need to set ASYNC_HARDPPS_CD; for right now, manually
setting it in the serial structure is the fastest way to do that; I'll
update setserial soon so you can use setserial to set that flag.)

						- Ted


===================================================================
RCS file: drivers/char/RCS/serial.c,v
retrieving revision 1.1
diff -u -r1.1 drivers/char/serial.c
--- drivers/char/serial.c	1996/10/07 00:13:28	1.1
+++ drivers/char/serial.c	1996/10/08 03:17:06
@@ -252,7 +252,7 @@
  */
 static int baud_table[] = {
 	0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800,
-	9600, 19200, 38400, 57600, 115200, 0 };
+	9600, 19200, 38400, 57600, 115200, 230400, 460800, 0 };
 
 static inline unsigned int serial_in(struct async_struct *info, int offset)
 {
@@ -486,8 +486,14 @@
 			info->icount.rng++;
 		if (status & UART_MSR_DDSR)
 			info->icount.dsr++;
-		if (status & UART_MSR_DDCD)
+		if (status & UART_MSR_DDCD) {
 			info->icount.dcd++;
+#ifdef HARDPPS
+			if ((info->flags & ASYNC_HARDPPS_CD) &&
+			    (status & UART_MSR_DCD))
+				hardpps();
+#endif
+		}
 		if (status & UART_MSR_DCTS)
 			info->icount.cts++;
 		wake_up_interruptible(&info->delta_msr_wait);
@@ -1179,7 +1185,7 @@
 	i = cflag & CBAUD;
 	if (i & CBAUDEX) {
 		i &= ~CBAUDEX;
-		if (i < 1 || i > 2) 
+		if (i < 1 || i > 4) 
 			info->tty->termios->c_cflag &= ~CBAUDEX;
 		else
 			i += 15;
@@ -1205,13 +1211,7 @@
 		quot = 0;
 		info->timeout = 0;
 	}
-	if (quot) {
-		info->MCR |= UART_MCR_DTR;
-		info->MCR_noint |= UART_MCR_DTR;
-		cli();
-		serial_out(info, UART_MCR, info->MCR);
-		sti();
-	} else {
+	if (!quot) {
 		info->MCR &= ~UART_MCR_DTR;
 		info->MCR_noint &= ~UART_MCR_DTR;
 		cli();
@@ -1256,6 +1256,8 @@
 	
 	/* CTS flow control flag and modem status interrupts */
 	info->IER &= ~UART_IER_MSI;
+	if (info->flags & ASYNC_HARDPPS_CD)
+		info->IER |= UART_IER_MSI;
 	if (cflag & CRTSCTS) {
 		info->flags |= ASYNC_CTS_FLOW;
 		info->IER |= UART_IER_MSI;
@@ -2097,7 +2099,15 @@
 	  return;
 
 	change_speed(info);
-
+	
+	if (!(old_termios->c_cflag & CBAUD) &&
+	    (tty->termios->c_cflag & CBAUD)) {
+		info->MCR |= UART_MCR_DTR;
+		info->MCR_noint |= UART_MCR_DTR;
+		cli();
+		serial_out(info, UART_MCR, info->MCR);
+		sti();
+	}
 	if ((old_termios->c_cflag & CRTSCTS) &&
 	    !(tty->termios->c_cflag & CRTSCTS)) {
 		tty->hw_stopped = 0;
===================================================================
RCS file: include/linux/RCS/serial.h,v
retrieving revision 1.1
diff -u -r1.1 include/linux/serial.h
--- include/linux/serial.h	1996/10/08 03:11:33	1.1
+++ include/linux/serial.h	1996/10/08 03:12:55
@@ -67,6 +67,8 @@
 #define ASYNC_PGRP_LOCKOUT    0x0200 /* Lock out cua opens based on pgrp */
 #define ASYNC_CALLOUT_NOHUP   0x0400 /* Don't do hangups for cua device */
 
+#defnie ASYNC_HARDPPS_CD	0x0800	/* Call hardpps when CD goes high  */
+
 #define ASYNC_FLAGS	0x0FFF	/* Possible legal async flags */
 #define ASYNC_USR_MASK 0x0430	/* Legal flags that non-privileged
 				 * users can set or reset */
