Subject: Driver hacks 1: ms_zs.c
To: NetBSD port-sparc mailing list <port-sparc@netbsd.org>
From: Julian Coleman <jdc@coris.demon.co.uk>
List: port-sparc
Date: 10/16/2002 20:12:25
More fun with a 4/300 and 1.6.  Started X, mouse didn't move.  Checked
dmesg :

  ms0 at zs1 channel 1: baud rate 9600

Hmm, the PROM reports the mouse speed as 9600.  Yuck.  And there doesn't
seem to be any way of changing it.  Rather than forcing people to add
SUN_MS_BPS to get X working with GENERIC on a Sun 4 [*], would the
following patch be OK, or should I just add `options SUN_MS_BPS=1200' in
future?

Also, I see that SUN_MS_BPS isn't in options(4).  I'll add it.  Do Sun
mice only come in 1200 and 4800bps variants?

J

[*] I guess this is going to bite other Sun 4's as well, but I don't have
any to test.  A Sun 3/80 gets the speed right with and without the patch.
Not tested on sparc64.

 ---8<---------------------------- Cut here ---------------------------->8---
*** ms_zs.c.dist	Thu Oct  3 11:05:46 2002
--- ms_zs.c	Wed Oct 16 19:26:21 2002
***************
*** 146,155 ****
  	cs->cs_private = ms;
  	cs->cs_ops = &zsops_ms;
  	ms->ms_cs = cs;
! 	/* Allow kernel option SUN_MS_BPS to hard-code baud rate */
  #ifndef SUN_MS_BPS
! 	if ((bps = cs->cs_defspeed) == 0)
! #endif
  		bps = ms_zs_bps;
  
  	printf(": baud rate %d\n", bps);
--- 146,162 ----
  	cs->cs_private = ms;
  	cs->cs_ops = &zsops_ms;
  	ms->ms_cs = cs;
! 	/*
! 	 * Allow kernel option SUN_MS_BPS to hard-code baud rate 
! 	 * Work round Sun 4 PROM's reporting incorrect mouse speed
! 	 */
  #ifndef SUN_MS_BPS
! #if defined(SUN4)
! 	if ((bps = cs->cs_defspeed) == 0 || CPU_ISSUN4)
! #else
! 	if ((bps = cs->cs_defspeed))
! #endif	/* SUN4 */
! #endif	/* SUN_MS_BPS */
  		bps = ms_zs_bps;
  
  	printf(": baud rate %d\n", bps);

 ---8<---------------------------- Cut here ---------------------------->8---

-- 
                    My other computer also runs NetBSD
                          http://www.netbsd.org/