Re: Serial driver changes from v5 to v7



In article <diQ1i.2606$y_7.887@xxxxxxxxxxxxxxxxxxxxxxxxxx> bob
prohaska's usenet account <bp@xxxxxxxxxxxxx> writes:
It looks as if -icanon was the key to the puzzle. The lockfile on
my 6.2 installation matches yours, with -icanon present. It looks
as if I misformatted the printcap file. The first few lines looked
like this originally:

lp|ps:\
:br#9600:lp=/dev/ttyd0:mx#0:sf:sh:rw:sb:\
:fc#0177777:fs#003:ms=\
-icanon,-isig,-iexten,-echo,-echoe,-echok,-echoke,-echonl,\

Adding an extra -icanon on the line with ms=, like this:

lp|ps:\
:br#9600:lp=/dev/ttyd0:mx#0:sf:sh:rw:sb:\
:fc#0177777:fs#003:ms=-icanon,\
-icanon,-isig,-iexten,-echo,-echoe,-echok,-echoke,-echonl,\

seems to have cleared up the problem.

Great!

Just why the fix worked isn't very clear to me, but I'm very glad it
_did_ work. I suppose this has to be declared a wetware bug, but I
certainly am surprised by the need for it.

Well, the printcap misformatting might be considered a wetware bug (see
below), but the need for you to add -icanon to a printcap entry that was
working perfectly fine in 5.x cannot be. Instead, it is due to the
gratuitous and non-backwards-compatible change of the default settings
when you open a tty device, a default that at least in concept
("everything is unset") probably dates back to v6 days. It may actually
be unintentional (a.k.a. a plain bug) - ISTR that when I went hunting
through the CVS web, I found that it came about as the result of some
general reorg of the serial/tty driver(s).

For future dejagooglers, on comparing the defaults between 5.3 and 6.0,
I found that the difference was that these were set in 6.0 but not in
5.3 (or ever before):

lflags: icanon isig iexten
iflags: icrnl ixon ixany imaxbel brkint
oflags: opost onlcr

The lock is set appropriately,
How the icanon flag got set inappropriately is not at all clear. It
was not tampered with in my initial attempts, which inherited the 5.5
printcap:

ns2# more /etc/printcap
lp|ps:\
:br#9600:lp=/dev/ttyd0:mx#0:sf:sh:rw:sb:\
:fc#0177777:fs#003:ms=ixon,ixoff,-isig,igncr,cstopb,-echok:\
:af=/var/log/psacct:lf=/var/log/pslog:sd=/var/spool/output/pslpd:\
:if=/usr/local/libexec/psif:

Per above, icanon is set by default in 6.0 and later. The fact that your
initial attempt to unset it failed can probably be blamed on the pretty
arcane and picky syntax for *cap entries - you can see that in your old
entry, continuations are only done after ':', which is probably safest.
When you put a continuation immediately after 'ms=', the unfolded line
becomes something like 'ms= -icanon,...', which may confuse the
parser.

I'd never have paid enough attention to the icanon/-icanon flag significance
if you hadn't pointed it out to me.

Thank you, and I'll try to quit asking naive questions.

Oh, but your question wasn't naive at all, it was quite a difficult one
- it was just that you were the only one that could do the actual
debugging, and you seemed to keep giving up, and then come back and
start over from scratch every N months.:-)

--Per Hedeland
per@xxxxxxxxxxxx
.