From owner-freebsd-current Thu Jan 27 6:53:47 2000 Delivered-To: freebsd-current@freebsd.org Received: from outmail.utsunomiya-u.ac.jp (outmail.utsunomiya-u.ac.jp [160.12.196.3]) by hub.freebsd.org (Postfix) with ESMTP id 17A0914A21 for ; Thu, 27 Jan 2000 06:53:34 -0800 (PST) (envelope-from yokota@zodiac.mech.utsunomiya-u.ac.jp) Received: from zodiac.mech.utsunomiya-u.ac.jp (IDENT:K2xeZAyHTHrJAqU+GnmcN8UdQKchYDD/@zodiac.mech.utsunomiya-u.ac.jp [160.12.42.1]) by outmail.utsunomiya-u.ac.jp (8.9.3/3.7Wpl2) with ESMTP id XAA07069; Thu, 27 Jan 2000 23:53:27 +0900 (JST) Received: from zodiac.mech.utsunomiya-u.ac.jp (zodiac.mech.utsunomiya-u.ac.jp [160.12.42.1]) by zodiac.mech.utsunomiya-u.ac.jp (8.7.6+2.6Wbeta7/3.4W/zodiac-May96) with ESMTP id XAA29367; Thu, 27 Jan 2000 23:59:04 +0900 (JST) Message-Id: <200001271459.XAA29367@zodiac.mech.utsunomiya-u.ac.jp> To: Donn Miller Cc: current@freebsd.org, yokota@zodiac.mech.utsunomiya-u.ac.jp Subject: Re: Moused hanging... In-reply-to: Your message of "Mon, 24 Jan 2000 08:46:07 EST." <388C579F.835E05C0@cvzoom.net> References: <200001240503.OAA20809@zodiac.mech.utsunomiya-u.ac.jp> <388C579F.835E05C0@cvzoom.net> Date: Thu, 27 Jan 2000 23:59:04 +0900 From: Kazutaka YOKOTA Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG >Well, it's an ISA bus mouse. I bought this thing back in 1994. It's >an IMSI mouse. I'll bet this stupid thing could last for 5 more >years. :-) > >> I cannot immediately see why only the mouse suddenly died, while the >> rest of the system was healthy, > >Yeah, I don't know. It happens extremely rarely. Maybe it's because >I have an ISA bus mouse. I suppose I really should be using a PS/2 or >USB mouse. (BTW, is a PS/2 mouse a type of bus mouse?) This may be "THE GREAT CASE OF LOST INTERRUPTS" :-) I haven't heard that the mse driver looses interrupts, but there may be a possibility that we loose interrupts on ISA bus under heavy load. The following patch will add a watch dog timer to the mse driver. When the bus mouse interrupt seems to be lost, it will print "mse0: lost interrupt?" and forcefully read from the bus mouse port. I hope it may get the thing going again. Kazu Index: mse.c =================================================================== RCS file: /src/CVS/src/sys/i386/isa/mse.c,v retrieving revision 1.48 diff -u -r1.48 mse.c --- mse.c 1999/10/06 13:01:55 1.48 +++ mse.c 2000/01/27 14:25:17 @@ -95,6 +95,7 @@ }; static ointhand2_t mseintr; +static timeout_t msetimeout; /* * Software control structure for mouse. The sc_enablemouse(), @@ -114,6 +115,8 @@ int sc_buttons; int sc_bytesread; u_char sc_bytes[MOUSE_SYS_PACKETSIZE]; + struct callout_handle sc_callout; + int sc_watchdog; mousehw_t hw; mousemode_t mode; mousestatus_t status; @@ -263,6 +266,7 @@ idp->id_ointr = mseintr; sc->sc_port = idp->id_iobase; + callout_handle_init(&sc->sc_callout); sc->mode.accelfactor = (idp->id_flags & MSE_CONFIG_ACCEL) >> 4; make_dev(&mse_cdevsw, unit << 1, 0, 0, 0600, "mse%d", unit); make_dev(&mse_cdevsw, (unit<<1)+1, 0, 0, 0600, "nmse%d", unit); @@ -293,6 +297,8 @@ sc->sc_obuttons = sc->sc_buttons = MOUSE_MSC_BUTTONS; sc->sc_deltax = sc->sc_deltay = 0; sc->sc_bytesread = sc->mode.packetsize = MOUSE_MSC_PACKETSIZE; + sc->sc_watchdog = FALSE; + sc->sc_callout = timeout(msetimeout, dev, hz*2); sc->mode.level = 0; sc->status.flags = 0; sc->status.button = sc->status.obutton = 0; @@ -320,6 +326,8 @@ struct mse_softc *sc = &mse_sc[MSE_UNIT(dev)]; int s; + untimeout(msetimeout, dev, sc->sc_callout); + callout_handle_init(&sc->sc_callout); s = spltty(); (*sc->sc_disablemouse)(sc->sc_port); sc->sc_flags &= ~MSESC_OPEN; @@ -545,6 +553,26 @@ } /* + * msetimeout: watchdog timer routine. + */ +static void +msetimeout(arg) + void *arg; +{ + dev_t dev; + struct mse_softc *sc; + + dev = (dev_t)arg; + sc = &mse_sc[MSE_UNIT(dev)]; + if (sc->sc_watchdog) { + printf("mse%d: lost interrupt?\n", MSE_UNIT(dev)); + mseintr(MSE_UNIT(dev)); + } + sc->sc_watchdog = TRUE; + sc->sc_callout = timeout(msetimeout, dev, hz); +} + +/* * mseintr: update mouse status. sc_deltax and sc_deltay are accumulative. */ static void @@ -602,6 +630,8 @@ sc->status.flags |= ((dx || dy) ? MOUSE_POSCHANGED : 0) | (sc->status.button ^ but); sc->status.button = but; + + sc->sc_watchdog = FALSE; /* * If mouse state has changed, wake up anyone wanting to know. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message