Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Oct 1996 23:15:09 +1000 (EST)
From:      davidn@sdev.usn.blaze.net.au
To:        FreeBSD-gnats-submit@freebsd.org, sos@freebsd.org
Subject:   kern/1811: Fix for syscons TIOCGWINSZ for non 80x25 text modes
Message-ID:  <199610151315.XAA00663@sdev.usn.blaze.net.au>
Resent-Message-ID: <199610151320.GAA07679@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         1811
>Category:       kern
>Synopsis:       Patch to correct rows/columns for syscons
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Oct 15 06:20:02 PDT 1996
>Last-Modified:
>Originator:     David Nugent - davidn@blaze.net.au
>Organization:
Unique Computing, Melbourne, Australia
>Release:        FreeBSD 2.2-961004-SNAP i386
>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

>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199610151315.XAA00663>