NetBSD Problem Report #17506

Received: (qmail 20753 invoked by uid 605); 7 Jul 2002 17:51:41 -0000
Message-Id: <200207071749.g67Hnw801682@ged.plethora.net>
Date: Sun, 7 Jul 2002 12:49:58 -0500 (CDT)
From: seebs <seebs@ged.plethora.net>
Sender: gnats-bugs-owner@netbsd.org
Reply-To: seebs@ged.plethora.net
To: gnats-bugs@gnats.netbsd.org
Subject: Possible improvement in mouse resets
X-Send-Pr-Version: 3.95

>Number:         17506
>Category:       kern
>Synopsis:       my old mouse reset code failed too often
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    martin
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jul 07 17:52:00 +0000 2002
>Closed-Date:    Mon Jul 08 07:44:33 +0000 2002
>Last-Modified:  Mon Jul 08 07:44:33 +0000 2002
>Originator:     seebs
>Release:        NetBSD 1.6B
>Organization:

>Environment:
System: NetBSD ged.plethora.net 1.6B NetBSD 1.6B (GED) #1: Fri Jul 5 09:37:47 CDT 2002 seebs@ged.plethora.net:/usr/src/sys/arch/i386/compile/GED i386
Architecture: i386
Machine: i386
>Description:
	I contributed code a while back to probe PS/2 mice for their protocol,
	and re-probe them in the event of confusion.  About one time in five
	to ten, this code failed to redetect my scroll wheel correctly; after
	some observation of the Windows mouse driver, I have what appears to
	be a fix, or at the very least an improvement.
>How-To-Repeat:
	Play around with a KVM switch.
>Fix:
(Not sure what the #ifdef was still doing there, but it's gone now.)

Instead of just resetting the mouse once, we send a reset, wait a second, and
then send another reset; this appears to give the mouse time to "properly"
reset itself.

Index: pms.c
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/pckbc/pms.c,v
retrieving revision 1.6
diff -c -r1.6 pms.c
*** pms.c	2002/05/29 09:30:35	1.6
--- pms.c	2002/07/07 17:51:13
***************
*** 30,35 ****
--- 30,36 ----
  #include <sys/systm.h>
  #include <sys/device.h>
  #include <sys/ioctl.h>
+ #include <sys/kernel.h>
  #include <sys/kthread.h>

  #include <machine/bus.h>
***************
*** 253,261 ****
  {
  	u_char cmd[1];
  	int res;
- #ifdef PMS_PREFER_PROTOCOL
- 	int i;
- #endif

  	sc->inputstate = 0;
  	sc->buttons = 0;
--- 254,259 ----
***************
*** 442,447 ****
--- 440,452 ----
  			    sc->sc_dev.dv_xname);
  #endif
  		pms_disable(sc);
+ 		cmd[0] = PMS_RESET;
+ 		res = pckbc_enqueue_cmd(sc->sc_kbctag, sc->sc_kbcslot, cmd, 1,
+ 		    2, 1, resp);
+ 		if (res)
+ 			DPRINTF(("%s: reset error %d\n", sc->sc_dev.dv_xname, 
+ 			    res));
+ 		tsleep(pms_reset_thread, PWAIT, "pmsreset", hz);
  		cmd[0] = PMS_RESET;
  		res = pckbc_enqueue_cmd(sc->sc_kbctag, sc->sc_kbcslot, cmd, 1,
  		    2, 1, resp);
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: kern-bug-people->martin 
Responsible-Changed-By: martin 
Responsible-Changed-When: Sun Jul 7 11:17:34 PDT 2002 
Responsible-Changed-Why:  
I'll handle this  
State-Changed-From-To: open->closed 
State-Changed-By: martin 
State-Changed-When: Mon Jul 8 00:43:57 PDT 2002 
State-Changed-Why:  
Fixed, thanks! 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.