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

Re: kernel 2.4.19



On Tue, Aug 06, 2002 at 07:37:27AM -0700, Wichmann, Mats D wrote:
> char/tty_io.c
> char/tty_ioctl.c
> 
> I believe there are either one or two other conformance 
> patches but since I haven't found those in their original
> form yet, I can't report on their presence in 2.4.19.

The patch in the FAQ should be replaced with this one.  

>From Alan Cox:

The patch in the FAQ is broken in the case where the board supports
ioctls but does not implement TCSBRK.
 
This patch also does the generic handling in the case the driver ioctl
reports 'no handler for this one'. This is true for many drivers such
as the sx serial.

--- linux/drivers/char/tty_ioctl.c~	Tue Aug  6 11:04:10 2002
+++ linux/drivers/char/tty_ioctl.c	Tue Aug  6 11:04:10 2002
@@ -394,7 +394,7 @@
 				return -EFAULT;
 			return 0;
 		case TCSETSF:
-			return set_termios(real_tty, arg,  TERMIOS_FLUSH);
+			return set_termios(real_tty, arg,  TERMIOS_FLUSH  | TERMIOS_WAIT);
 		case TCSETSW:
 			return set_termios(real_tty, arg, TERMIOS_WAIT);
 		case TCSETS:
@@ -402,7 +402,7 @@
 		case TCGETA:
 			return get_termio(real_tty,(struct termio *) arg);
 		case TCSETAF:
-			return set_termios(real_tty, arg, TERMIOS_FLUSH | TERMIOS_TERMIO);
+			return set_termios(real_tty, arg, TERMIOS_FLUSH |  TERMIOS_WAIT | TERMIOS_TERMIO );
 		case TCSETAW:
 			return set_termios(real_tty, arg, TERMIOS_WAIT | TERMIOS_TERMIO);
 		case TCSETA:
--- linux/drivers/char/tty_io.c~	2002-07-30 12:21:01.000000000 +0100
+++ linux/drivers/char/tty_io.c	2002-07-30 12:26:54.000000000 +0100
@@ -1659,6 +1659,22 @@
 	return 0;
 }
 
+static int tty_generic_brk(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg)
+{
+	int retval;
+	if (cmd == TCSBRK && arg) 
+	{
+		/* tcdrain case */
+		retval = tty_check_change(tty);
+		if (retval)
+			return retval;
+		tty_wait_until_sent(tty, 0);
+		if (signal_pending(current))
+			return -EINTR;
+	}
+	return 0;
+}
+
 /*
  * Split this up, as gcc can choke on it otherwise..
  */
@@ -1692,11 +1707,12 @@
 		/* the driver doesn't support them. */
 		case TCSBRK:
 		case TCSBRKP:
-			if (!tty->driver.ioctl)
-				return 0;
-			retval = tty->driver.ioctl(tty, file, cmd, arg);
+			retval = -ENOIOCTLCMD;
+			if (tty->driver.ioctl)
+				retval = tty->driver.ioctl(tty, file, cmd, arg);
+			/* Not driver handled */
 			if (retval == -ENOIOCTLCMD)
-				retval = 0;
+				retval = tty_generic_brk(tty, file, cmd, arg);
 			return retval;
 		}
 	}



Reply to: