Subject: Help w/ serial printer
To: None <current-users@NetBSD.ORG>
From: Bill Studenmund <>
List: current-users
Date: 01/09/1996 11:22:19

I'm trying to get my DeskWriter to work w/ NetBSD/Mac68k, and have run 
into a problem. I've actually gotten pretty far, but now I have a tty 
configuration problem which I don't know how to handle.

Basically I want to set the tty port up to just be a serial link. I don't 
want ANY processing AT ALL. I set "stty -f /dev/tty01 57600 raw crtscts 
clocal -echoe -echoke -echoctl" to try to fix things. I end up with every 
echo option listed in stty -e being disabled.

I want echoing off as the printer sends status bytes to the computer 
every 2 seconds. The printer shouldn't get them back as they'll be 
interpreted either as printed characters (inverted no less) or will mess 
up data transfers of PCL graphics.

Unfortunately, even with the above adjustments, I still get characters 
echoed. How in the world do I stop this infernal echoing?

I think I've tracked the problem down some. I think the ttyinput code
could check for echoing in a few more places, but a big problem is that,
IMHO, there should be a way to make ttyecho NOT echo.

>From around line 1767 (w/ the -->) in ttyecho:
ttyecho(c, tp)
        register int c;
        register struct tty *tp;

        if (!ISSET(tp->t_state, TS_CNTTB))
                CLR(tp->t_lflag, FLUSHO);
-->     if ((!ISSET(tp->t_lflag, ECHO) &&
            (!ISSET(tp->t_lflag, ECHONL) || c == '\n')) ||
            ISSET(tp->t_lflag, EXTPROC))
        if (ISSET(tp->t_lflag, ECHOCTL) &&
            (ISSET(c, TTY_CHARMASK) <= 037 && c != '\t' && c != '\n' ||
            ISSET(c, TTY_CHARMASK) == 0177)) {
                (void)ttyoutput('^', tp);
                CLR(c, ~TTY_CHARMASK);
                if (c == 0177)
                        c = '?';
                        c += 'A' - 1;
        (void)ttyoutput(c, tp);

As it stands, I don't see a way to turn off echoing in general. I thought 
"stty -echo" was a master disable, but then shouldn't line 1767 be:

	if ((( -echo) or ( -echonl and c == '\n')) or extproc) then return
If so, the && should be a || & the first || on 1768 should be a &&.

Or am I missing something?

If this is a bug, how do I report it?


Take care,