*BSD News Article 27153


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!munnari.oz.au!bunyip.cc.uq.oz.au!harbinger.cc.monash.edu.au!yeshua.marcam.com!MathWorks.Com!europa.eng.gtefsd.com!news.umbc.edu!haven.umd.edu!umd5.umd.edu!mark
From: mark@roissy.umd.edu (Mark Sienkiewicz)
Newsgroups: comp.os.386bsd.questions
Subject: HACK/FIX Re: More causes garbage on dialin
Date: 8 Feb 1994 21:51:45 GMT
Organization: Zeno, IPST, University of Maryland
Lines: 51
Message-ID: <2j91hh$gio@hecate.umd.edu>
References: <2hnoc9$b4f@crl2.crl.com> <hastyCKB3rL.MBq@netcom.com> <1994Jan28.220616.1676@diana.ocunix.on.ca> <BLYMN.94Feb4184001@mallee.awadi.com.au>
NNTP-Posting-Host: roissy.umd.edu

>>>>When we dial into our NETBSD host and use more, the output gets all 
>
>Diane>   I first noticed this problem with 'man' under NETBSD 0.9 a month or so
>Diane> ago. I traced it to 'more' messing up (which of course, 'man' uses.)
>Diane> 'more' messed up the stty settings. I haven't been able to look at this
>Diane> and track the problem down completely due to time constraints.
>
>Diane>  To confirm this is your problem, try a shell sequence such as:
>
>Diane> stty -a > before_stty_settings;more shortfile;stty -a > after_stty_settings
>
>Actually, it's more than more :-) that does this.  On my NetBSD 0.9
>system it seems like anything that uses cbreak (or maybe raw) tty
>stuff breaks it.  In my case the line gets set to 7bits no parity,
>my normal operation is 7 bits, even parity.  I posted the problem to
>the netbsd-bugs mailing list, silence was the stern reply.

The correct fix for this is in the sgtty() emulation, but rather than
trace through that, I hacked arch/isa/com.c as follows:

In the function comparam(), you see

        switch (cflag&CSIZE) {
        case CS5:
                cfcr = CFCR_5BITS; break;
        case CS6:
                cfcr = CFCR_6BITS; break;
        case CS7:
                cfcr = CFCR_7BITS; break;
        case CS8:
                cfcr = CFCR_8BITS; break;
        }
        if (cflag&PARENB) {
                cfcr |= CFCR_PENAB;
                if ((cflag&PARODD) == 0)
                        cfcr |= CFCR_PEVEN;
        }

The sgtty() emulation sets things up as "cs7 -parenb" which really means
1 start bit, 7 data bits, 1 stop bit.  In fact, what most people want is
1 start bit, 8 data bits, 1 stop bit, even when they are talking about
a seven bit path.

My hack is:
        case CS7:
                cfcr = CFCR_7BITS | CFCR_PENAB | CFCR_PEVEN; break;

which works for my preference of 7 bits even parity.  It's a hack but
it makes it do what I want it to do.   I might even make a proper fix
someday... :)