From sos@SandBox.CyberCity.dk  Tue Oct 15 13:19:46 1996
Received: from SandBox.CyberCity.dk (disn36.cybercity.dk [194.16.57.36])
          by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id NAA05724;
          Tue, 15 Oct 1996 13:19:16 -0700 (PDT)
Received: (from sos@localhost) by SandBox.CyberCity.dk (8.7.6/8.7.3) id WAA02250; Tue, 15 Oct 1996 22:20:06 +0200 (MET DST)
Message-Id: <199610152020.WAA02250@SandBox.CyberCity.dk>
Date: Tue, 15 Oct 1996 22:20:06 +0200 (MET DST)
From: "Soren Schmidt" <sos@SandBox.CyberCity.dk>
Reply-To: sos@freebsd.org
To: davidn@blaze.net.au
Cc: FreeBSD-gnats-submit@freebsd.org, sos@freebsd.org
In-Reply-To: <199610151315.XAA00663@sdev.usn.blaze.net.au> from "davidn@sdev.usn.blaze.net.au" at Oct 15, 96 11:15:09 pm
Subject: Re: Fix for syscons TIOCGWINSZ for non 80x25 text modes

>Number:         1815
>Category:       junk
>Synopsis:       Re: Fix for syscons TIOCGWINSZ for non 80x25 text modes
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    gnats-admin
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Oct 15 13:20:01 PDT 1996
>Closed-Date:    Fri Nov 29 13:39:10 PST 1996
>Last-Modified:  Tue Nov 27 19:23:07 PST 2001
>Originator:     
>Release:        
>Organization:
>Environment:
>Description:
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: fenner 
State-Changed-When: Fri Nov 29 13:39:10 PST 1996 
State-Changed-Why:  
This PR appears to be a misdirected response to PR#kern/1811. 
>Unformatted:
In reply to davidn@sdev.usn.blaze.net.au who wrote:
> 
> 
> 
> >Submitter-Id:   current-users
> >Originator:     David Nugent - davidn@blaze.net.au
> >Organization:   Unique Computing, Melbourne, Australia
> >Confidential:   no
> >Synopsis:       Patch to correct rows/columns for syscons
> >Severity:       non-critical
> >Priority:       medium
> >Category:       kern
> >Release:        FreeBSD 2.2-961004-SNAP i386
> >Class:          sw-bug
> >Environment: 
> 
>         VGA/EGA text modes other than 80x25
> 
> >Description: 
> 
> 	If vidcontrol (or some other means) is used to change the current
>         video mode from the default 80x25 lines, the window size reported
>         via TIOCGWINSZ is correctly changed. However, this is reset by
>         the tty driver on logout. Subsequently logging in on the vt will
>         show (again) the default rows 0 columns 0 parameters, with the
>         result that applications will not know the *correct* window size
>         of the vt and use the default sizes from termcap with consequent
>         aberrant behaviour. To fix, the user needs to run vidcontrol
>         again, or stty with the correct values.
> 
> >How-To-Repeat: 
> 
> 	(assuming an 8x8 console font has been loaded)
>         /usr/sbin/vidcontrol VGA-80x50
>         logout
>         (log in again)
>         stty -a
>         (shows speed 115200 baud; 0 rows; 0 columns)
>         Run more, less etc. and watch the confusion. :)
> 
> >Fix: 
> 	
> 	The following patch works around the problem by copying the
>         correct console rows/columns into the tty driver structure
>         if the rows/columns fields are currently 0 (ie. the have not
>         been set). This removes the anomaly, but does not interfere
>         with the user being able to override these values via the
>         /bin/stty interace so long as they are not reset to 0,0.
> 
> *** sys/i386/isa/syscons.c.orig	Tue Oct 15 15:45:49 1996
> --- sys/i386/isa/syscons.c	Tue Oct 15 21:27:48 1996
> ***************
> *** 1256,1261 ****
> --- 1256,1274 ----
>   	    return ENXIO;
>       default:
>   	break;
> + 
> +     case TIOCGWINSZ:        /* We may know more about this */
> +        /* We only modify the tty structure for the console
> +         * size if it hasn't been set to something different
> +         * by the user
> +         */
> +        if (!tp->t_winsize.ws_row && !tp->t_winsize.ws_col)
> +        {
> +            tp->t_winsize.ws_row = scp->ysize;
> +            tp->t_winsize.ws_col = scp->xsize;
> +        }
> +        break;
> + 
>       }
>   
>       error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p);
> 
> 
> David Nugent, Unique Computing Pty Ltd - Melbourne, Australia
> Voice +61-3-791-9547 Data/BBS +61-3-792-3507 3:632/348@fidonet
> davidn@blaze.net.au http://www.blaze.net.au/~davidn
> 
> 
> 


-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Sren Schmidt               (sos@FreeBSD.org)               FreeBSD Core Team
                Even more code to hack -- will it ever end
..
