>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 [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to