Put a bunch of output that us really only useful in a debug
scenario into #ifdef DEBUG. This makes my cluster with Belkin KVM switch completely usable, even if the KVM switch and mouse get a bit confused sometimes. Without this, when the mouse gets confused, all sorts of crud gets spammed all over the screen. With this, the mouse may appear dead for a second or three, but it recovers silently.
This commit is contained in:
parent
f6791efebc
commit
6a02d57aea
@ -2033,7 +2033,9 @@ psmintr(void *arg)
|
|||||||
|
|
||||||
getmicrouptime(&now);
|
getmicrouptime(&now);
|
||||||
if ((pb->inputbytes > 0) && timevalcmp(&now, &sc->inputtimeout, >)) {
|
if ((pb->inputbytes > 0) && timevalcmp(&now, &sc->inputtimeout, >)) {
|
||||||
|
#if DEBUG
|
||||||
log(LOG_DEBUG, "psmintr: delay too long; resetting byte count\n");
|
log(LOG_DEBUG, "psmintr: delay too long; resetting byte count\n");
|
||||||
|
#endif
|
||||||
pb->inputbytes = 0;
|
pb->inputbytes = 0;
|
||||||
sc->syncerrors = 0;
|
sc->syncerrors = 0;
|
||||||
}
|
}
|
||||||
@ -2045,7 +2047,7 @@ psmintr(void *arg)
|
|||||||
if (pb->inputbytes < sc->mode.packetsize)
|
if (pb->inputbytes < sc->mode.packetsize)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
#if 0
|
#if DEBUG
|
||||||
log(LOG_DEBUG, "psmintr: %02x %02x %02x %02x %02x %02x\n",
|
log(LOG_DEBUG, "psmintr: %02x %02x %02x %02x %02x %02x\n",
|
||||||
pb->ipacket[0], pb->ipacket[1], pb->ipacket[2],
|
pb->ipacket[0], pb->ipacket[1], pb->ipacket[2],
|
||||||
pb->ipacket[3], pb->ipacket[4], pb->ipacket[5]);
|
pb->ipacket[3], pb->ipacket[4], pb->ipacket[5]);
|
||||||
@ -2054,30 +2056,40 @@ psmintr(void *arg)
|
|||||||
c = pb->ipacket[0];
|
c = pb->ipacket[0];
|
||||||
|
|
||||||
if ((c & sc->mode.syncmask[0]) != sc->mode.syncmask[1]) {
|
if ((c & sc->mode.syncmask[0]) != sc->mode.syncmask[1]) {
|
||||||
|
#if DEBUG
|
||||||
log(LOG_DEBUG, "psmintr: out of sync (%04x != %04x) %d"
|
log(LOG_DEBUG, "psmintr: out of sync (%04x != %04x) %d"
|
||||||
" cmds since last error.\n",
|
" cmds since last error.\n",
|
||||||
c & sc->mode.syncmask[0], sc->mode.syncmask[1],
|
c & sc->mode.syncmask[0], sc->mode.syncmask[1],
|
||||||
sc->cmdcount - sc->lasterr);
|
sc->cmdcount - sc->lasterr);
|
||||||
|
#endif
|
||||||
haderror = 1;
|
haderror = 1;
|
||||||
sc->lasterr = sc->cmdcount;
|
sc->lasterr = sc->cmdcount;
|
||||||
dropqueue(sc);
|
dropqueue(sc);
|
||||||
++sc->syncerrors;
|
++sc->syncerrors;
|
||||||
sc->lastinputerr = now;
|
sc->lastinputerr = now;
|
||||||
if (sc->syncerrors < sc->mode.packetsize) {
|
if (sc->syncerrors < sc->mode.packetsize) {
|
||||||
|
#if DEBUG
|
||||||
log(LOG_DEBUG, "psmintr: discard a byte (%d).\n", sc->syncerrors);
|
log(LOG_DEBUG, "psmintr: discard a byte (%d).\n", sc->syncerrors);
|
||||||
|
#endif
|
||||||
--pb->inputbytes;
|
--pb->inputbytes;
|
||||||
bcopy(&pb->ipacket[1], &pb->ipacket[0], pb->inputbytes);
|
bcopy(&pb->ipacket[1], &pb->ipacket[0], pb->inputbytes);
|
||||||
} else if (sc->syncerrors == sc->mode.packetsize) {
|
} else if (sc->syncerrors == sc->mode.packetsize) {
|
||||||
|
#if DEBUG
|
||||||
log(LOG_DEBUG, "psmintr: re-enable the mouse.\n");
|
log(LOG_DEBUG, "psmintr: re-enable the mouse.\n");
|
||||||
|
#endif
|
||||||
pb->inputbytes = 0;
|
pb->inputbytes = 0;
|
||||||
disable_aux_dev(sc->kbdc);
|
disable_aux_dev(sc->kbdc);
|
||||||
enable_aux_dev(sc->kbdc);
|
enable_aux_dev(sc->kbdc);
|
||||||
} else if (sc->syncerrors < PSM_SYNCERR_THRESHOLD1) {
|
} else if (sc->syncerrors < PSM_SYNCERR_THRESHOLD1) {
|
||||||
|
#if DEBUG
|
||||||
log(LOG_DEBUG, "psmintr: discard a byte (%d).\n", sc->syncerrors);
|
log(LOG_DEBUG, "psmintr: discard a byte (%d).\n", sc->syncerrors);
|
||||||
|
#endif
|
||||||
--pb->inputbytes;
|
--pb->inputbytes;
|
||||||
bcopy(&pb->ipacket[1], &pb->ipacket[0], pb->inputbytes);
|
bcopy(&pb->ipacket[1], &pb->ipacket[0], pb->inputbytes);
|
||||||
} else if (sc->syncerrors >= PSM_SYNCERR_THRESHOLD1) {
|
} else if (sc->syncerrors >= PSM_SYNCERR_THRESHOLD1) {
|
||||||
|
#if DEBUG
|
||||||
log(LOG_DEBUG, "psmintr: reset the mouse.\n");
|
log(LOG_DEBUG, "psmintr: reset the mouse.\n");
|
||||||
|
#endif
|
||||||
reinitialize(sc, TRUE);
|
reinitialize(sc, TRUE);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
@ -2033,7 +2033,9 @@ psmintr(void *arg)
|
|||||||
|
|
||||||
getmicrouptime(&now);
|
getmicrouptime(&now);
|
||||||
if ((pb->inputbytes > 0) && timevalcmp(&now, &sc->inputtimeout, >)) {
|
if ((pb->inputbytes > 0) && timevalcmp(&now, &sc->inputtimeout, >)) {
|
||||||
|
#if DEBUG
|
||||||
log(LOG_DEBUG, "psmintr: delay too long; resetting byte count\n");
|
log(LOG_DEBUG, "psmintr: delay too long; resetting byte count\n");
|
||||||
|
#endif
|
||||||
pb->inputbytes = 0;
|
pb->inputbytes = 0;
|
||||||
sc->syncerrors = 0;
|
sc->syncerrors = 0;
|
||||||
}
|
}
|
||||||
@ -2045,7 +2047,7 @@ psmintr(void *arg)
|
|||||||
if (pb->inputbytes < sc->mode.packetsize)
|
if (pb->inputbytes < sc->mode.packetsize)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
#if 0
|
#if DEBUG
|
||||||
log(LOG_DEBUG, "psmintr: %02x %02x %02x %02x %02x %02x\n",
|
log(LOG_DEBUG, "psmintr: %02x %02x %02x %02x %02x %02x\n",
|
||||||
pb->ipacket[0], pb->ipacket[1], pb->ipacket[2],
|
pb->ipacket[0], pb->ipacket[1], pb->ipacket[2],
|
||||||
pb->ipacket[3], pb->ipacket[4], pb->ipacket[5]);
|
pb->ipacket[3], pb->ipacket[4], pb->ipacket[5]);
|
||||||
@ -2054,30 +2056,40 @@ psmintr(void *arg)
|
|||||||
c = pb->ipacket[0];
|
c = pb->ipacket[0];
|
||||||
|
|
||||||
if ((c & sc->mode.syncmask[0]) != sc->mode.syncmask[1]) {
|
if ((c & sc->mode.syncmask[0]) != sc->mode.syncmask[1]) {
|
||||||
|
#if DEBUG
|
||||||
log(LOG_DEBUG, "psmintr: out of sync (%04x != %04x) %d"
|
log(LOG_DEBUG, "psmintr: out of sync (%04x != %04x) %d"
|
||||||
" cmds since last error.\n",
|
" cmds since last error.\n",
|
||||||
c & sc->mode.syncmask[0], sc->mode.syncmask[1],
|
c & sc->mode.syncmask[0], sc->mode.syncmask[1],
|
||||||
sc->cmdcount - sc->lasterr);
|
sc->cmdcount - sc->lasterr);
|
||||||
|
#endif
|
||||||
haderror = 1;
|
haderror = 1;
|
||||||
sc->lasterr = sc->cmdcount;
|
sc->lasterr = sc->cmdcount;
|
||||||
dropqueue(sc);
|
dropqueue(sc);
|
||||||
++sc->syncerrors;
|
++sc->syncerrors;
|
||||||
sc->lastinputerr = now;
|
sc->lastinputerr = now;
|
||||||
if (sc->syncerrors < sc->mode.packetsize) {
|
if (sc->syncerrors < sc->mode.packetsize) {
|
||||||
|
#if DEBUG
|
||||||
log(LOG_DEBUG, "psmintr: discard a byte (%d).\n", sc->syncerrors);
|
log(LOG_DEBUG, "psmintr: discard a byte (%d).\n", sc->syncerrors);
|
||||||
|
#endif
|
||||||
--pb->inputbytes;
|
--pb->inputbytes;
|
||||||
bcopy(&pb->ipacket[1], &pb->ipacket[0], pb->inputbytes);
|
bcopy(&pb->ipacket[1], &pb->ipacket[0], pb->inputbytes);
|
||||||
} else if (sc->syncerrors == sc->mode.packetsize) {
|
} else if (sc->syncerrors == sc->mode.packetsize) {
|
||||||
|
#if DEBUG
|
||||||
log(LOG_DEBUG, "psmintr: re-enable the mouse.\n");
|
log(LOG_DEBUG, "psmintr: re-enable the mouse.\n");
|
||||||
|
#endif
|
||||||
pb->inputbytes = 0;
|
pb->inputbytes = 0;
|
||||||
disable_aux_dev(sc->kbdc);
|
disable_aux_dev(sc->kbdc);
|
||||||
enable_aux_dev(sc->kbdc);
|
enable_aux_dev(sc->kbdc);
|
||||||
} else if (sc->syncerrors < PSM_SYNCERR_THRESHOLD1) {
|
} else if (sc->syncerrors < PSM_SYNCERR_THRESHOLD1) {
|
||||||
|
#if DEBUG
|
||||||
log(LOG_DEBUG, "psmintr: discard a byte (%d).\n", sc->syncerrors);
|
log(LOG_DEBUG, "psmintr: discard a byte (%d).\n", sc->syncerrors);
|
||||||
|
#endif
|
||||||
--pb->inputbytes;
|
--pb->inputbytes;
|
||||||
bcopy(&pb->ipacket[1], &pb->ipacket[0], pb->inputbytes);
|
bcopy(&pb->ipacket[1], &pb->ipacket[0], pb->inputbytes);
|
||||||
} else if (sc->syncerrors >= PSM_SYNCERR_THRESHOLD1) {
|
} else if (sc->syncerrors >= PSM_SYNCERR_THRESHOLD1) {
|
||||||
|
#if DEBUG
|
||||||
log(LOG_DEBUG, "psmintr: reset the mouse.\n");
|
log(LOG_DEBUG, "psmintr: reset the mouse.\n");
|
||||||
|
#endif
|
||||||
reinitialize(sc, TRUE);
|
reinitialize(sc, TRUE);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user