Newsgroups: comp.os.coherent
Subject: Interesting Modem Problem
From: kilroy@acme.gen.nz (earthbound misfit, I)
Date: Sat, 25 Jul 92 00:18:33 GMT
Organization: ACME BBS - Public Access Usenet, Palmerston North, New Zealand

I had an interesting problem with serial ports and the new V.32bis modem
I bought that I thought people might find enlightening, and it raises one
or two questions that some readers might be able to answer.

The details: ACME BBS is a 16MHz SX with 4MB of ram, 130MB IDE hard
drive. There are 4 serial ports on the machine, com4 is disabled and I'm
enabling com2fr, com1pr, and com3l for logins; the first 2 are on modems
and the latter is for a serial cable connected to another machine, the
V.32bis is on com2fr and com1pr is an internal 2400.

Anyway, I was having a problem with people connecting to the fast modem
and getting a screenful of garbage instead of the login banner. Hmmm,
interesting, it looked like a baud rate conflict somewhere, but the
problem would disappear whenever I looked at it (I'd try calling line 1
(the V.32bis on com2) from line 2 (the 2400 on com1 - confused?) and have
no problems). Oh, and outgoing UUCP polls to my feed site would continue
without a hitch at all times.

Some further digging finally tracked down the problem. I had the modem
and serial port configured to operate at 19200bps, that was how it was
described in /etc/ttys and all the uucp control files. But for a couple
of days I'd slowed things down to 9600 to compare UUCP transfer rates
and when I switched things back to 19200 I forgot one thing -
/usr/bin/modeminit. It was still setting baud rate via stty to 9600.

My modeminit is changed from the standard Coherent one somewhat, for
starters it's actually /etc/modeminit rather than living in /usr/bin.
Mine actually just calls a script called /etc/modemreset which does the
work of spitting a command string to the port at the right speed, so
/etc/modeminit is similar in concept to something like /etc/drvld.all.
The misconfigured modeminit was initialising the modem and presumably the
serial drivers to 9600 baud on com2, so later attempts by login (reading
from /etc/ttys) to use the port at 19200 were causing speed mismatches.

I don't really understand some of the lower levels of Coherent, this OS
is my first experience of a Unix-style system. But I assume that the
problem was this - the incorrect stty call in modeminit was setting the
serial driver (and initially the modem) to 9600 bps. Later i/o through
that port (eg via login) would try and use the port at 19200, and while
the modem was happy (it autobauds on the serial port) one half of the
serial driver was receiving things at 19200 but trying to spit them out
to the modem at 9600, hence the garbage appearing at login attempts.

One of the things that made the problem so hard to trace (took me several
days to narrow it down) was that as soon as someone reported a failure to
log in on that line, I'd disable it and check the modem status with
kermit, at 19200. It appears that kermit does lots of low-level things to
the port to speak to it, and would reset the serial driver to the correct
(19200) speed in doing so. Login attempts after that time would succeed
until the machine was rebooted. And UUCP kept going, which suggests to me
that uucico reads the current baud rate setting of the port and uses that
instead of what /usr/lib/L-devices says.

						- k
-- 
Craig Harding            kilroy@acme.gen.nz             ACME BBS +64 63 3551342
"Jub'f Xvob?"