# $Id: openbsd-adb_lockup.diff,v 1.1 2004/02/06 01:53:42 jcs Exp $ # # for some reason, the adb controller on my powerbook starts acknowledging # events (mouse movements and keystrokes) too slowly and fills up its internal # queue of 32 events. when this condition happens, adb_pass_up() just ignores # new events while not clearing its queue, making the keyboard and mouse stop # responding until a reboot. # # this hack clears the queue when it becomes full and moves the error reporting # out of an '#ifdef'. # # note: this did not completely fix the problem on my 15" powerbook # # by joshua stein # Index: adb_direct.c =================================================================== RCS file: /cvs/src/sys/arch/macppc/dev/adb_direct.c,v retrieving revision 1.10 diff -u -r1.10 adb_direct.c --- adb_direct.c 3 Nov 2003 06:43:02 -0000 1.10 +++ adb_direct.c 5 Feb 2004 21:32:49 -0000 @@ -664,10 +664,24 @@ /*u_char *comprout = 0;*/ if (adbInCount >= ADB_QUEUE) { -#ifdef ADB_DEBUG - if (adb_debug) - printf_intr("adb: ring buffer overflow\n"); -#endif + int s; + + printf_intr("adb: ring buffer overflow"); + + /* reset the queue */ + s = splhigh(); + adbInCount = 0; + adbInHead = 0; + adbInTail = 0; + adbWaitingCmd = 0; + adbWaiting = 0; + adbBuffer = (long)0; + adbCompRout = (long)0; + adbCompData = (long)0; + splx(s); + + printf_intr(", emptied queue\n"); + return; }