Subject: port-i386/400: pcvt sometimes gets confused about window size+FIX
To: None <gnats-admin>
From: None <sommerfeld@orchard.medford.ma.us>
List: netbsd-bugs
Date: 08/07/1994 14:35:11
>Number:         400
>Category:       port-i386
>Synopsis:       pcvt sometimes gets confused about window size
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sun Aug  7 14:35:09 1994
>Originator:     Bill Sommerfeld
>Organization:
"	"
>Release:        1.0BETA
>Environment:
	
System: NetBSD orchard.medford.ma.us 1.0_BETA NetBSD 1.0_BETA (ORCHARD) #6: Sun Aug 7 13:54:11 EDT 1994 sommerfeld@orchard.medford.ma.us:/u1/nsys/sys/arch/i386/compile/ORCHARD i386


>Description:
	PCVT should never get confused about the screen size, but when
	starting up a new session, the system reports a screen size of 0,0.
	Given that it *knows* how big the screen is, this struck me as odd,
	so I hacked together the following patches.
	The net effect of this is:
	- when opening the device, the x,y size of the terminal
	matches the current display mode.
	- TIOCSWSZ is ignored by the driver (as it knows better..).

	Note the kludge to work around the line discipline's
	zeroing of the window size..
>How-To-Repeat:
>Fix:

*** /u1/nsup/src/sys/arch/i386/isa/pcvt/pcvt_drv.c	Thu May  5 07:11:52 1994
--- pcvt_drv.c	Wed Jul  6 18:13:05 1994
***************
*** 327,333 ****
  	register struct tty *tp;
  	register struct video_state *vsx;
  	int i = minor(dev);
! 	
  #if PCVT_EMU_MOUSE
  	if(i == totalscreens)
  		vsx = 0;
--- 327,333 ----
  	register struct tty *tp;
  	register struct video_state *vsx;
  	int i = minor(dev);
! 	int s;
  #if PCVT_EMU_MOUSE
  	if(i == totalscreens)
  		vsx = 0;
***************
*** 374,379 ****
--- 374,402 ----
  
  	tp->t_state |= TS_CARR_ON;
  	tp->t_cflag |= CLOCAL;	/* cannot be a modem (:-) */
+ 
+ 	/* we do this here because line discipline clobbers t_winsize
+ 	   if TS_ISOPEN is clear.. and that's all it does which checks
+ 	   TS_ISOPEN..
+ 	   */
+ 	s = spltty();
+ #define	SET(t, f)	(t) |= (f)
+ #define	ISSET(t, f)	((t) & (f))
+ 
+ 	if (!ISSET(tp->t_state, TS_ISOPEN)) {
+ 		SET(tp->t_state, TS_ISOPEN); /* !!! */
+ #if 0
+ 		printf("pc%d: size %dx%d\n", dev, vsx->maxcol,
+ 		       vsx->screen_rows);
+ #endif
+ 		tp->t_winsize.ws_col = vsx->maxcol;
+ 		tp->t_winsize.ws_row = vsx->screen_rows;
+ 		tp->t_winsize.ws_xpixel = (vsx->maxcol == 80)? 720: 1056;
+ 		tp->t_winsize.ws_ypixel = 400;
+ 	}
+ #undef SET
+ #undef ISSET
+ 	splx(s);
  
  #if PCVT_NETBSD
  	return ((*linesw[tp->t_line].l_open)(dev, tp));
*** /u1/nsup/src/sys/arch/i386/isa/pcvt/pcvt_sup.c	Fri May  6 06:14:43 1994
--- pcvt_sup.c	Wed Jul  6 18:13:08 1994
***************
*** 264,269 ****
--- 264,272 ----
  			else
  				return EINVAL;
  			break;
+ 		case TIOCSWINSZ:
+ 			/* do nothing here */
+ 			break;
  
  		default:
  			return -1;
>Audit-Trail:
>Unformatted:


------------------------------------------------------------------------------