[comp.unix.microport] Microport console driver & raw mode programs

samperi@mancol.UUCP (Dominick Samperi) (04/03/88)

Has anyone experienced console driver problems after using a program
(like elm, for example) that sets the tty to raw mode (that is, turns
off ICANON under System V)? I'm using Microport's System V/AT, and
whenever I use such a program (and assuming that the program resets the
tty to its original state on termination), I have problems when I use vi
later. In particular, CTRL-D does not scroll the screen properly, and
text deletes and inserts are not echoed correctly. There are similar
problems when less is used after elm. A system reboot always fixes the
vi/less problems (until a program like elm is run again). I've had no problems
using elm and vi/less under Xenix. Any ideas?
-- 
Dominick Samperi, Manhattan College, NYC
    manhat!samperi@NYU.EDU           ihnp4!rutgers!nyu.edu!manhat!samperi
    philabs!cmcl2!manhat!samperi     ihnp4!rutgers!hombre!samperi
              (^ that's an ell)      uunet!swlabs!mancol!samperi

wes@obie.UUCP (Barnacle Wes) (04/08/88)

In article <362@mancol.UUCP>, samperi@mancol.UUCP (Dominick Samperi) writes:
> Has anyone experienced console driver problems after using a program
> (like elm, for example) that sets the tty to raw mode (that is, turns
> off ICANON under System V)?

It could be that elm is not restoring your stty settings correctly.  I
have a simple csh alias that takes care of this problem, which is
especially frequent in my own programs:  :-)

alias oops 'stty sane erase \^h intr \^c kill \^y echoe ixany ; stty'

This restores my stty settings (at least the ones that seem to get
garbled the most) and then prints them on the screen.

-- 
    /\              -  "Against Stupidity,  -    {backbones}!
   /\/\  .    /\    -  The Gods Themselves  -  utah-cs!utah-gr!
  /    \/ \/\/  \   -   Contend in Vain."   -  uplherc!sp7040!
 / U i n T e c h \  -       Schiller        -     obie!wes

friedl@vsi.UUCP (Stephen J. Friedl) (04/11/88)

In article <128@obie.UUCP>, wes@obie.UUCP (Barnacle Wes) writes:
> It could be that elm is not restoring your stty settings correctly.  I
> have a simple csh alias that takes care of this problem, which is
> especially frequent in my own programs:  :-)
> 
> alias oops 'stty sane erase \^h intr \^c kill \^y echoe ixany ; stty'
> 
> This restores my stty settings (at least the ones that seem to get
> garbled the most) and then prints them on the screen.

Alternate generic way to reset your favorite tty settings: "stty -g"
outputs a string of the current stats that you can't read but stty can.

	$ stty -g
	d26:5:dad:3b:7f:1c:8:15:4:0:0:0

It turns out that it maps directly to |struct termio| fields,
but you don't need to pay attention to the specifics.  Now,
set this string in your .profile after setting your favorite
stty modes:

	STTYMODES=`stty -g` ; export STTYMODES    # save tty modes

Now `oops' (I call it `reset') can be a shell script that does:

	if [ "$STTYMODES" ] ; then
		stty $STTYMODES
	else
		stty sane erase '^h' intr '^c' kill '^y' echoe ixany
	fi
	stty

If you have saved your tty modes, they are restored, otherwise you
get some hopefully reasonable defaults.

-- 
Steve Friedl   V-Systems, Inc.   "Yes, I'm jeff@unh's brother"
friedl@vsi.com  {backbones}!vsi.com!friedl  attmail!vsi!friedl

james@bigtex.uucp (James Van Artsdalen) (04/11/88)

IN article <362@mancol.UUCP>, samperi@mancol.UUCP (Dominick Samperi) wrote:
> Has anyone experienced console driver problems after using a program
> (like elm, for example) that sets the tty to raw mode (that is, turns
> off ICANON under System V)?

Not this problem, but I *have* had the problem wherein the console driver
decides to stop wrapping around the right edge of the screen.  This always
happens if I call a local BSD4.3 system and claim to be a vt100...
I am using unix/386 2.2l.

As an aside, I have found that in order to use the terminfo entry supplied on
uPort's BBS, it is necessary to disable the hpa, ll and vpa capabilities.
And for those of you who like their cursors full-height ("\[27;24m") or
non-blinking ("\[27;26m")...  In addition, color seems to be triggered with
"\[22;Nm" where N specifies the color: I like smso as \[22;31m with rmso
as \[22;7m.
-- 
James R. Van Artsdalen   ...!ut-sally!uastro!bigtex!james    "Live Free or Die"
Home: 512-346-2444 Work: 328-0282; 110 Wild Basin Rd. Ste #230, Austin TX 78746

mem@zinn.MV.COM (Mark E. Mallett) (04/13/88)

In article <1509@bigtex.uucp>, james@bigtex.uucp (James Van Artsdalen) writes:
> IN article <362@mancol.UUCP>, samperi@mancol.UUCP (Dominick Samperi) wrote:
> > Has anyone experienced console driver problems after using a program
> > (like elm, for example) that sets the tty to raw mode (that is, turns
> > off ICANON under System V)?

I certainly haven't seen that sort of trouble, but it puts me in mind of a
problem that I *do* run across sometimes - that the console driver doesn't
get reset between logins.  For instance, if I run a program that sets a
restricted scrolling region, and that program core dumps (or more likely,
if it is on another system and the telephone line hangs up), I would expect
to be able to log out and log back in and have the console back in a normal
mode.  Not so.  Perhaps someone at Microport could fix this.

>  ... This always
> happens if I call a local BSD4.3 system and claim to be a vt100...

Why do you do that?  You should claim to be an ansi.



> As an aside, I have found that in order to use the terminfo entry supplied on
> uPort's BBS, it is necessary to disable the hpa, ll and vpa capabilities.


The ansi terminfo entry that comes with 2.3 is defective.  I posted a fixed
one a month or two ago.  Don't disable these things, fix them!  I don't know
about the one on Microport's BBS, but the values I use are:

 hpa=\E[%i%p1%dG	(addition of %i)
 vpa=\E[%p1%dd
 ll=??			(what is ll??)

I'm using a modified ansi terminfo entry without any trouble at all.  The
full entry is:

ansi|ansi-24|ansi-s-bot|ansi-bot-s|ansi with bottom status line (for sysline),
	am, hs, mir, msgr, eslok, xon, cols#80, lines#24, wsl#80, 
	cbt=\E[Z, bel=^G, cr=\r, csr=\E[%i%p1%d;%p2%dr, 
	clear=\E[H\E[J\E[3;2m, el=\E[K, ed=\E[J, hpa=\E[%i%p1%dG, 
	cup=\E[%i%p1%d;%p2%dH, cud1=\n, home=\E[H, civis=\E[25;27m, 
	cub1=\b, cnorm=\E[23;27m, cuf1=\E[C, cuu1=\E[A, dch1=\E[P, 
	dl1=\E[M, dsl=\E7\E[?6l\E[25;1H\E[K\E8, smacs=\E[12m, 
	blink=\E[5;3;1m, bold=\E[1m, smir=\E[4h, invis=\E[8m, rev=\E[7m, 
	smso=\E[7m, smul=\E[4m, ech=\E[%p1%dX, rmacs=\E[10m, sgr0=\E[m, 
	rmir=\E[4l, rmso=\E[m, rmul=\E[m, fsl=\E8, is1=\E[=h, 
	is2=\E7\E[1;24r\E8\E[?6h\E[A\n, il1=\E[L, kbs=\b, kdch1=\E[P, 
	kdl1=\E[M, kcud1=\E[B, kf1=\EOP, kf10=\EOY, kf2=\EOQ, kf3=\EOR, 
	kf4=\EOS, kf5=\EOT, kf6=\EOU, kf7=\EOV, kf8=\EOW, kf9=\EOX, 
	khome=\E[H, kich1=\E[@, kil1=\E[L, kcub1=\E[D, knp=\E[V, 
	kpp=\E[U, kcuf1=\E[C, kcuu1=\E[A, dch=\E[%p1%dP, dl=\E[%p1%dM, 
	cud=\E[%p1%dB, ich=\E[%p1%d@, indn=\E[%p1%dS, il=\E[%p1%dL, 
	cub=\E[%p1%dD, cuf=\E[%p1%dC, rin=\E[%p1%dT, cuu=\E[%p1%dA, 
	pfkey=\E[%p1%d;%p2%l%dq%p2%s, pfx=\E[%p1%d;%p2%l%dq%p2%s, 
	rc=\E8, vpa=\E[%p1%dd, sc=\E7, ind=\ED, ht=\t, 
	tsl=\E7\E[?6l\E[25;%p1%dH\E[7;1;55m\E[K, 

-mm-

-- 
Mark E. Mallett  PO Box 4188/ Manchester NH/ 03103 
Bus. Phone: 603 645 5069    Home: 603 424 8129
uucp: mem@zinn.MV.COM  (...decvax!elrond!zinn!mem   or   ...sii!zinn!mem)
BIX: mmallett

friedl@vsi.UUCP (Stephen J. Friedl) (04/15/88)

In article <300@zinn.MV.COM>, mem@zinn.MV.COM (Mark E. Mallett) writes:
< I certainly haven't seen that sort of trouble, but it puts me in mind of a
< problem that I *do* run across sometimes - that the console driver doesn't
< get reset between logins.  For instance, if I run a program that sets a
< restricted scrolling region, and that program core dumps (or more likely,
< if it is on another system and the telephone line hangs up), I would expect
< to be able to log out and log back in and have the console back in a normal
< mode.  Not so.  Perhaps someone at Microport could fix this.

It's not necessarily broken -- a terminal doesn't reset on logout
and the console is faithfully emulating a terminal.  Perhaps putting
"tput init" in /etc/profile will clear things up for you as long as
the init strings in terminfo are set.

< [...] the values I use [for the 2.3 ansi terminfo] are:
< 
<  hpa=\E[%i%p1%dG	(addition of %i)
<  vpa=\E[%p1%dd
<  ll=??			(what is ll??)

ll = "lower left", kind of like "home" but to the bottom of the screen.
If you leave it out, "cup" gets used instead.

-- 
Steve Friedl   V-Systems, Inc.   "Yes, I'm jeff@unh's brother"
friedl@vsi.com  {backbones}!vsi.com!friedl  attmail!vsi!friedl