Re: Warning, cua2 opened, ...

Paul Gortmaker (linux@rasty.ph.unimelb.edu.au)
Sat, 14 Mar 1998 20:16:39 +1100 (EST)


> Don't know who is issuing this msg. But the PPP 3.3.3 docs and the
> pcmcia docs say to use cua, and pcmcia-cs-3.0.1-12Mar. sets things up
> this way. Maybe whoever wrote the error msg. should send some mail and
> change the error msg to specify what it should be changed too.
> e.g.
> Please change cua to xxx.
> I presume it should be ttyS, and yes I also read devices.txt

Agreed, the current pre90-2 isn't 100% user friendly in this respect.
But don't be too hard on Ted - he has ext2 to take care of as well as
the drivers/char stuff. Not a minor task (no pun intended).

Try using the following patch. It gives more information, and more
importantly, it limits the number of warnings to five before the kernel
shuts up. Example output from "dmesg" shown below:

----------------------
tty_io.c: process 36 (getty) used obsolete /dev/cua0 - update software to use /dev/ttyS0
tty_io.c: process 37 (dip) used obsolete /dev/cua1 - update software to use /dev/ttyS1
tty_io.c: process 38 (kermit) used obsolete /dev/cua1 - update software to use /dev/ttyS1
tty_io.c: process 38 (kermit) used obsolete /dev/cua1 - update software to use /dev/ttyS1
tty_io.c: process 39 (cat) used obsolete /dev/cua0 - update software to use /dev/ttyS0
----------------------

Interestingly enough, kermit opens the device 2x when you do a "set line
/dev/cuaX" - heh, who would have known...

Paul.

(Patch is against 2.1.90-pre2)

--- linux/drivers/char/tty_io.c.orig Fri Mar 13 15:08:46 1998
+++ linux/drivers/char/tty_io.c Sat Mar 14 19:10:09 1998
@@ -132,9 +132,7 @@
char *tty_name(struct tty_struct *tty, char *buf)
{
if (tty)
- sprintf(buf, "%s%d", tty->driver.name,
- MINOR(tty->device) - tty->driver.minor_start +
- tty->driver.name_base);
+ sprintf(buf, "%s%d", tty->driver.name, TTY_NUMBER(tty));
else
strcpy(buf, "NULL tty");
return buf;
@@ -1282,11 +1280,20 @@
tty->session = current->session;
tty->pgrp = current->pgrp;
}
+#if 1 /* This will go away before 2.4 is released -- Paul G. */
if ((tty->driver.type == TTY_DRIVER_TYPE_SERIAL) &&
(tty->driver.subtype == SERIAL_TYPE_CALLOUT)) {
- printk("Warning, %s opened, is a deprecated tty "
- "callout device\n", tty_name(tty, buf));
+ static int nr_warns = 0;
+ if (nr_warns < 5) {
+ printk(KERN_WARNING "tty_io.c: "
+ "process %d (%s) used obsolete /dev/%s - "
+ "update software to use /dev/ttyS%d\n",
+ current->pid, current->comm,
+ tty_name(tty, buf), TTY_NUMBER(tty));
+ nr_warns++;
+ }
}
+#endif
return 0;
}

--- linux/include/linux/tty.h.orig Sat Mar 14 17:54:39 1998
+++ linux/include/linux/tty.h Sat Mar 14 19:09:49 1998
@@ -285,6 +285,7 @@
#define TTY_PTY_LOCK 16

#define TTY_WRITE_FLUSH(tty) tty_write_flush((tty))
+#define TTY_NUMBER(tty) (MINOR((tty)->device) - (tty)->driver.minor_start + (tty)->driver.name_base)

extern void tty_write_flush(struct tty_struct *);

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu