From owner-cvs-all@FreeBSD.ORG Thu Dec 11 03:28:12 2003 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 74D4A16A4CE; Thu, 11 Dec 2003 03:28:12 -0800 (PST) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8D4C843D09; Thu, 11 Dec 2003 03:28:11 -0800 (PST) (envelope-from alfred@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.9/8.12.9) with ESMTP id hBBBSBXJ099332; Thu, 11 Dec 2003 03:28:11 -0800 (PST) (envelope-from alfred@repoman.freebsd.org) Received: (from alfred@localhost) by repoman.freebsd.org (8.12.9/8.12.9/Submit) id hBBBSB6m099331; Thu, 11 Dec 2003 03:28:11 -0800 (PST) (envelope-from alfred) Message-Id: <200312111128.hBBBSB6m099331@repoman.freebsd.org> From: Alfred Perlstein Date: Thu, 11 Dec 2003 03:28:11 -0800 (PST) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Subject: cvs commit: src/sys/isa psm.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Dec 2003 11:28:12 -0000 alfred 2003/12/11 03:28:11 PST FreeBSD src repository Modified files: sys/isa psm.c Log: Significantly reduce the "jitter" that is typical for PS/2 mice when using a KVM. There is no actual solution possible, but this gets us pretty close. Typically when switching back to a FreeBSD box and moving the mouse wild data is produced, because the protocol's validation/checksum system is extremely weak it is impossible to determine that we're out of sync before dropping several bogus packets to user land. The actual solution that appears to offer the best clamping of jitter is to buffer the mouse packets if we've not seen mouse activity for more than .5 seconds. Then waiting to flush that data for 1/20th of a second. If within that 20th of a second we get any packets that do fail the weak test we drop the entire queue and back off accepting data from the mouse for 2 seconds and then repeat the whole deal. You can still get _some_ jitter, notably if you switch to the FreeBSD box, then move the mouse just enough to generate one or two packets. Those packets may be bogus, but may still pass the validity check. One way to finally kill the problem once and for all is to check the initial packets for "wild" values. Typically one sees packets in the +/-60 range during normal operation, however when bogus data is generated it's typically near the outer range of +/-120 or more, those packets would be a good candidate for dropping or clamping. I've been running with this for several weeks now and it has significantly helped me stay sane even with a piece of junk Belkin KVM causing wild jitter each and every time I switch. Lastly I'd like to note that my experience with Windows shows me that somehow the Microsoft PS/2 driver typically avoids this problem, but that may only be possible when running the mouse in a dumb-ed down PS/2 mode that Belkin recommends on their site. Revision Changes Path 1.63 +256 -110 src/sys/isa/psm.c