diff options
author | rgrimes <rgrimes@FreeBSD.org> | 1993-09-10 16:59:16 +0000 |
---|---|---|
committer | rgrimes <rgrimes@FreeBSD.org> | 1993-09-10 16:59:16 +0000 |
commit | 0f9beb0e4fd6cc10324e18848dad277e5ab6c4bc (patch) | |
tree | 797688db2ae433b7a28cc27c5a8cf0b2f520703a /sys/dev/sio | |
parent | cd0e0e6cee9684059c176df360261cb4b6a9cae4 (diff) | |
download | FreeBSD-src-0f9beb0e4fd6cc10324e18848dad277e5ab6c4bc.zip FreeBSD-src-0f9beb0e4fd6cc10324e18848dad277e5ab6c4bc.tar.gz |
From guido@gvr.win.tue.nl Wed Sep 8 13:34:16 1993
That is because TIOCMGET was broken. Yes...this is known for some time
and no, we (Bruce and me) never posted it. Why? Simply because we choose
to post fixes when we fixed most of the bugs.
Anyway..now that the slip problems are coming, here is a fix for
correct TIOCMGET behaviour.
-Guido
Note: this should be tested first (Rich?). Tested by rgrimes
Diffstat (limited to 'sys/dev/sio')
-rw-r--r-- | sys/dev/sio/sio.c | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c index 967abbf..a51e58c 100644 --- a/sys/dev/sio/sio.c +++ b/sys/dev/sio/sio.c @@ -41,7 +41,7 @@ * into the patch kit. Added in sioselect * from com.c. Added port 4 support. */ -static char rcsid[] = "$Header: /a/cvs/386BSD/src/sys/i386/isa/sio.c,v 1.6 1993/08/28 03:02:49 rgrimes Exp $"; +static char rcsid[] = "$Header: /a/cvs/386BSD/src/sys/i386/isa/sio.c,v 1.7 1993/09/08 17:38:05 rgrimes Exp $"; #include "sio.h" #if NSIO > 0 @@ -270,6 +270,7 @@ static int sioprobe __P((struct isa_device *dev)); static void compoll __P((void)); static int comstart __P((struct tty *tp)); static void comwakeup __P((void)); +static int tiocm2mcr __P((int)); /* table and macro for fast conversion from a unit number to its com struct */ static struct com_s *p_com_addr[NSIO]; @@ -975,6 +976,15 @@ comintr1(struct com_s *com) } } +static int +tiocm2mcr(data) + int data; +{ + register m = 0; + if (data & TIOCM_DTR) m |= MCR_DTR; + if (data & TIOCM_RTS) m |= MCR_RTS; + return m; +} int sioioctl(dev, cmd, data, flag, p) dev_t dev; @@ -1014,16 +1024,28 @@ sioioctl(dev, cmd, data, flag, p) (void) commctl(com, MCR_DTR | MCR_RTS, DMBIC); break; case TIOCMSET: - (void) commctl(com, *(int *)data, DMSET); + (void) commctl(com, tiocm2mcr(*(int *)data), DMSET); break; case TIOCMBIS: - (void) commctl(com, *(int *)data, DMBIS); + (void) commctl(com, tiocm2mcr(*(int *)data), DMBIS); break; case TIOCMBIC: - (void) commctl(com, *(int *)data, DMBIC); + (void) commctl(com, tiocm2mcr(*(int *)data), DMBIC); break; case TIOCMGET: - *(int *)data = commctl(com, 0, DMGET); + { + register int bits = 0, mode; + + mode = commctl(com, 0, DMGET); + if (inb(com->iobase+com_ier)) bits |= TIOCM_LE; /* XXX */ + if (mode & MSR_DCD) bits |= TIOCM_CD; + if (mode & MSR_CTS) bits |= TIOCM_CTS; + if (mode & MSR_DSR) bits |= TIOCM_DSR; + if (mode & (MCR_DTR<<8)) bits |= TIOCM_DTR; + if (mode & (MCR_RTS<<8)) bits |= TIOCM_RTS; + if (mode & (MSR_RI|MSR_TERI)) bits |= TIOCM_RI; + *(int *)data = bits; + } break; #ifdef COM_BIDIR case TIOCMSBIDIR: @@ -1493,7 +1515,7 @@ commctl(com, bits, how) com->mcr_image &= ~(bits & ~MCR_IENABLE)); break; case DMGET: - bits = com->prev_modem_status; + bits = com->prev_modem_status | (com->mcr_image << 8); break; } enable_intr(); |