summaryrefslogtreecommitdiffstats
path: root/sys/dev/zs
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2004-10-18 21:51:27 +0000
committerphk <phk@FreeBSD.org>2004-10-18 21:51:27 +0000
commitdafa1caf810829ca3d6fb150d0dae93477b45a80 (patch)
tree20f824d4840c6e3d41b20debf19f65f472d3916d /sys/dev/zs
parent6a50a160dbf47ef3773399dff0b9e84d05c0036b (diff)
downloadFreeBSD-src-dafa1caf810829ca3d6fb150d0dae93477b45a80.zip
FreeBSD-src-dafa1caf810829ca3d6fb150d0dae93477b45a80.tar.gz
Add new function ttyinitmode() which sets our systemwide default
modes on a tty structure. Both the ".init" and the current settings are initialized allowing the function to be used both at attach and open time. The function takes an argument to decide if echoing should be enabled. Echoing should not be enabled for regular physical serial ports unless they are consoles, in which case they should be configured by ttyconsolemode() instead. Use the new function throughout.
Diffstat (limited to 'sys/dev/zs')
-rw-r--r--sys/dev/zs/zs.c17
1 files changed, 2 insertions, 15 deletions
diff --git a/sys/dev/zs/zs.c b/sys/dev/zs/zs.c
index b79060b..eec6753 100644
--- a/sys/dev/zs/zs.c
+++ b/sys/dev/zs/zs.c
@@ -276,12 +276,8 @@ zstty_attach(device_t dev)
tp->t_modem = zsttymodem;
tp->t_break = zsttybreak;
tp->t_stop = zsttystop;
- tp->t_iflag = TTYDEF_IFLAG;
- tp->t_oflag = TTYDEF_OFLAG;
- tp->t_lflag = TTYDEF_LFLAG;
+ ttyinitmode(tp, 0, 0);
tp->t_cflag = CREAD | CLOCAL | CS8;
- tp->t_ospeed = TTYDEF_SPEED;
- tp->t_ispeed = TTYDEF_SPEED;
if (zstty_console(dev, mode, sizeof(mode))) {
ttychars(tp);
@@ -472,19 +468,10 @@ zsttyopen(struct cdev *dev, int flags, int mode, struct thread *td)
sc->sc_preg[1] |= ZSWR1_RIE | ZSWR1_SIE;
sc->sc_iput = sc->sc_iget = sc->sc_ibuf;
- /*
- * Initialize the termios status to the defaults. Add in the
- * sticky bits from TIOCSFLAGS.
- */
- t.c_ispeed = 0;
- t.c_ospeed = tp->t_ospeed;
- t.c_cflag = TTYDEF_CFLAG;
+ ttyconsolemode(t, 0);
/* Make sure zstty_param() will do something. */
tp->t_ospeed = 0;
(void)zstty_param(sc, tp, &t);
- tp->t_iflag = TTYDEF_IFLAG;
- tp->t_oflag = TTYDEF_OFLAG;
- tp->t_lflag = TTYDEF_LFLAG;
ttychars(tp);
ttsetwater(tp);
OpenPOWER on IntegriCloud