From 43241549d60781d7851d37f082be57996166ae5f Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Mon, 13 Aug 2018 00:38:42 +0100 Subject: [PATCH] trs80m1: Fix more tty bugs This lot really needs a restructure instead --- Kernel/platform-trs80m1/devtty.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/Kernel/platform-trs80m1/devtty.c b/Kernel/platform-trs80m1/devtty.c index 48a4461d..75c4f383 100644 --- a/Kernel/platform-trs80m1/devtty.c +++ b/Kernel/platform-trs80m1/devtty.c @@ -208,9 +208,11 @@ void tty_setup(uint8_t minor) { uint8_t baud; uint8_t ctrl = 3; /* DTR|RTS */ - struct tty *t = ttydata + minor; + if (minor < 3) + return; + if (minor != 3 || trs80_model == LNW80) { baud = ttydata[3].termios.c_cflag & CBAUD; if (baud > B19200) { @@ -222,16 +224,18 @@ void tty_setup(uint8_t minor) tr1865_baud = baud | (baud << 4); - if (t->termios.c_cflag & PARENB) { - if (t->termios.c_cflag & PARODD) - ctrl |= 0x80; - } else - ctrl |= 0x8; /* No parity */ - ctrl |= trssize[(t->termios.c_cflag & CSIZE) >> 4]; } + if (t->termios.c_cflag & PARENB) { + if (t->termios.c_cflag & PARODD) + ctrl |= 0x80; + } else + ctrl |= 0x8; /* No parity */ + ctrl |= trssize[(t->termios.c_cflag & CSIZE) >> 4]; if (t->termios.c_cflag & CRTSCTS) trs_flow |= (1 << minor); + else + trs_flow &- ~(1 << minor); if (minor == 3) { tr1865_ctrl_save = ctrl; tr1865_ctrl = ctrl; @@ -265,9 +269,9 @@ int trstty_close(uint8_t minor) int tty_carrier(uint8_t minor) { - if (minor != 3) + if (minor < 3) return 1; - if (trs80_model != VIDEOGENIE) { + if (minor == 3) { if (tr1865_ctrl & 0x80) return 1; } else if (vg_tr1865_ctrd & 0x10) -- 2.34.1