Dropping DTR?
Vernon Schryver
vjs at calcite.UUCP
Mon Jan 23 06:09:51 AEST 1989
In article <362 at cocktrice.UUCP>, mdm at cocktrice.UUCP (Mike Mitchell) writes:
> Does anyone have a fancy trick for lowering DTR going to a modem attached
> to tty0? I have my modem set up to auto answer, however there are times
> that I do not want the modem to answer the phone.
>
> I can start a getty running on /dev/ttyM0 and the DTR comes up. When I kill
> the getty, the DTR drops for a moment and then comes up again.
There seem to be bugs in the 3.0e driver. If you ever use tty[Mm][01], the
driver decides that you want DTR high forever after. Other bugs include a
failure to flush input buffers on the last close. Worse is a failure to
forget about XOFF (^S) on the last close. The latter means that noise
which looks like ^S during cu(1) (which follows the stupid SVR3 practice of
absolutely insisting on setting IXON -IXANY IXOFF) can lock up a port
permanently, until you reboot or until you run a program which does an
ioctl(TCXONC). You can't fix it with ioctl(TCSETA), turning off IXON &
IXOFF; the TCSETA will hang! The absense of RTS/CTS flow control should
be considered a bug today, no matter what RS-232-C said 15(?) years ago.
For the DTR bug, I found the enclosed hack/kludge/script works. It bangs
on the port enough times to convince the driver. Not having seen the
driver source, I can only guess why it works. All of its weirdness seem to
be necessary in various cases. It seems to work on an Everex 386/20 and a
no-name 16MHz. I've used it to run getty only at night. It is run by cron
every 15 minutes at night (don't ask) and once in the morning. It could
obviously stand some cleaning and generalizing, but it would be better to
spend the time fixing the driver. If you use it as is, you'll want to
create the extra inittab's.
If you have something simpler (like a reasonable driver for 3.0e+DOSMerge),
please let me know.
Vernon Schryver
{sgi,pyramid}!calcite!vjs
#!/bin/sh #(wishing we had a real csh and/or the uts/*/os/exec.c hacks)
#
# turn modem off or on
usage="usage: $0 {on | off}"
set -e
if test $# != 1; then
echo "$usage"
exit 1
fi
trap "" 1
case $1 in
'on')
cp /etc/inittab.on /etc/inittab
/etc/telinit q
;;
'off')
if cmp -s /etc/inittab.off /etc/inittab; then
exit 0
fi
cp /etc/inittab.off /etc/inittab
set +e
/etc/telinit q
sleep 4
#reset DTR
PORT=01
exec > /dev/null 2>&1
stty < /dev/ttyM$PORT &
sleep 1; kill -9 $!; wait 2> /dev/null; sleep 2
stty < /dev/ttyM$PORT &
sleep 1; kill -9 $!; wait 2> /dev/null; sleep 2
stty < /dev/tty$PORT
stty < /dev/ttyM$PORT &
sleep 1; kill -9 $! 2> /dev/null; wait 2> /dev/null; sleep 2
stty < /dev/tty$PORT
;;
*)
echo "$usage"
exit 1
;;
esac
More information about the Comp.unix.microport
mailing list