This is yet another attempt to fix "psmintr out of sync.." problems.

- Properly protect the watchdog timer routine.
- Relocate the sync check statement so that we don't see too many
  error messages.
This commit is contained in:
Kazutaka YOKOTA 2000-07-22 04:08:12 +00:00
parent e7f3269307
commit 7ce6464adc
2 changed files with 18 additions and 26 deletions

View File

@ -1830,10 +1830,11 @@ psmtimeout(void *arg)
unit = (int)arg;
sc = devclass_get_softc(psm_devclass, unit);
if (sc->watchdog) {
if (sc->watchdog && kbdc_lock(sc->kbdc, TRUE)) {
if (verbose >= 4)
log(LOG_DEBUG, "psm%d: lost interrupt?\n", unit);
psmintr(sc);
kbdc_lock(sc->kbdc, FALSE);
}
sc->watchdog = TRUE;
sc->callout = timeout(psmtimeout, (void *)unit, hz);
@ -1880,18 +1881,6 @@ psmintr(void *arg)
if ((sc->state & PSM_OPEN) == 0)
continue;
/*
* Check sync bits. We check for overflow bits and the bit 3
* for most mice. True, the code doesn't work if overflow
* condition occurs. But we expect it rarely happens...
*/
if ((sc->inputbytes == 0)
&& ((c & sc->mode.syncmask[0]) != sc->mode.syncmask[1])) {
log(LOG_DEBUG, "psmintr: out of sync (%04x != %04x).\n",
c & sc->mode.syncmask[0], sc->mode.syncmask[1]);
continue;
}
sc->ipacket[sc->inputbytes++] = c;
if (sc->inputbytes < sc->mode.packetsize)
continue;
@ -1904,6 +1893,13 @@ psmintr(void *arg)
c = sc->ipacket[0];
if ((c & sc->mode.syncmask[0]) != sc->mode.syncmask[1]) {
log(LOG_DEBUG, "psmintr: out of sync (%04x != %04x).\n",
c & sc->mode.syncmask[0], sc->mode.syncmask[1]);
sc->inputbytes = 0;
continue;
}
/*
* A kludge for Kensington device!
* The MSB of the horizontal count appears to be stored in

View File

@ -1830,10 +1830,11 @@ psmtimeout(void *arg)
unit = (int)arg;
sc = devclass_get_softc(psm_devclass, unit);
if (sc->watchdog) {
if (sc->watchdog && kbdc_lock(sc->kbdc, TRUE)) {
if (verbose >= 4)
log(LOG_DEBUG, "psm%d: lost interrupt?\n", unit);
psmintr(sc);
kbdc_lock(sc->kbdc, FALSE);
}
sc->watchdog = TRUE;
sc->callout = timeout(psmtimeout, (void *)unit, hz);
@ -1880,18 +1881,6 @@ psmintr(void *arg)
if ((sc->state & PSM_OPEN) == 0)
continue;
/*
* Check sync bits. We check for overflow bits and the bit 3
* for most mice. True, the code doesn't work if overflow
* condition occurs. But we expect it rarely happens...
*/
if ((sc->inputbytes == 0)
&& ((c & sc->mode.syncmask[0]) != sc->mode.syncmask[1])) {
log(LOG_DEBUG, "psmintr: out of sync (%04x != %04x).\n",
c & sc->mode.syncmask[0], sc->mode.syncmask[1]);
continue;
}
sc->ipacket[sc->inputbytes++] = c;
if (sc->inputbytes < sc->mode.packetsize)
continue;
@ -1904,6 +1893,13 @@ psmintr(void *arg)
c = sc->ipacket[0];
if ((c & sc->mode.syncmask[0]) != sc->mode.syncmask[1]) {
log(LOG_DEBUG, "psmintr: out of sync (%04x != %04x).\n",
c & sc->mode.syncmask[0], sc->mode.syncmask[1]);
sc->inputbytes = 0;
continue;
}
/*
* A kludge for Kensington device!
* The MSB of the horizontal count appears to be stored in