Subject: port-sparc/1417: mouse driver doesn't work on Sun 4
To: None <gnats-bugs@gnats.netbsd.org>
From: Jason R. Thorpe <thorpej@SJ.Xenotropic.COM>
List: netbsd-bugs
Date: 08/28/1995 22:53:14
>Number:         1417
>Category:       port-sparc
>Synopsis:       mouse driver doesn't work on Sun 4
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Aug 29 02:05:05 1995
>Last-Modified:
>Originator:     
>Organization:
Just me and my collection of obsolete computer gear(s).
>Release:        -current, Aug 27, 1995
>Environment:
	
System: NetBSD bigsby 1.0A NetBSD 1.0A (BIGSBY) #46: Mon Aug 28 16:30:57 PDT 1995 thorpej@bigsby:/tmp_mnt/basalt/work/netbsd/src/sys/arch/sparc/compile/BIGSBY sparc


>Description:
	 The Sparc mouse driver doesn't work on the Sun 4.

>How-To-Repeat:
	Attempt to run an X server.

>Fix:
	The baud rate needs to be explicitly set my the driver on
	Sun 4 systems.  Many thanks to Chuck Cranor for pointing this
	out to me.

	The patch to ms.c below is sufficient to run the X server.
	I'm using it now, in fact.  (It's even reasonably fast :-)

	It is worth noting that I _still_ get a fifo overrun on zs1b
	upon first moving the mouse.  Once the zs driver has complained,
	it's fine, however.  I'll investigate further, but I
	figured this was worth sending in.

Index: ms.c
===================================================================
RCS file: /usr/og/devsrc/netbsd/src/sys/arch/sparc/dev/ms.c,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 ms.c
*** ms.c	1995/08/03 07:11:42	1.1.1.1
--- ms.c	1995/08/29 05:29:58
***************
*** 86,93 ****
  
  /*
   * Attach the mouse serial (down-link) interface.
!  * Do we need to set it to 1200 baud, 8 bits?
!  * Test by power cycling and not booting SunOS before BSD?
   */
  void
  ms_serial(tp, iopen, iclose)
--- 86,93 ----
  
  /*
   * Attach the mouse serial (down-link) interface.
!  * The Sun 4 needs to have the baud rate set explicitly, but we handle
!  * that in ms_open().
   */
  void
  ms_serial(tp, iopen, iclose)
***************
*** 248,255 ****
  		return (EBUSY);
  	ms_softc.ms_events.ev_io = p;
  	ev_init(&ms_softc.ms_events);	/* may cause sleep */
! 	ms_softc.ms_ready = 1;		/* start accepting events */
  	(*ms_softc.ms_open)(ms_softc.ms_mouse);
  	return (0);
  }
  
--- 248,264 ----
  		return (EBUSY);
  	ms_softc.ms_events.ev_io = p;
  	ev_init(&ms_softc.ms_events);	/* may cause sleep */
! 
! #if defined(SUN4)
! 	if (cputyp == CPU_SUN4) {
! 		/* We need to set the baud rate on the mouse. */
! 		ms_softc.ms_mouse->t_ispeed =
! 		    ms_softc.ms_mouse->t_ospeed = 1200;
! 	}
! #endif
! 
  	(*ms_softc.ms_open)(ms_softc.ms_mouse);
+ 	ms_softc.ms_ready = 1;		/* start accepting events */
  	return (0);
  }
  
>Audit-Trail:
>Unformatted: