From owner-freebsd-bugs@FreeBSD.ORG Sat Dec 20 21:00:39 2003 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 78B7216A4CE for ; Sat, 20 Dec 2003 21:00:39 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4BE3943D50 for ; Sat, 20 Dec 2003 21:00:36 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) hBL50aFR010737 for ; Sat, 20 Dec 2003 21:00:36 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.10/8.12.10/Submit) id hBL50aQS010736; Sat, 20 Dec 2003 21:00:36 -0800 (PST) (envelope-from gnats) Date: Sat, 20 Dec 2003 21:00:36 -0800 (PST) Message-Id: <200312210500.hBL50aQS010736@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Tom Convery Subject: Re: kern/57230: [patch] psm(4) incorrectly identifies anIntelliMouse Explorer attached through an Avocent SwitchView KVM X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Tom Convery List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Dec 2003 05:00:39 -0000 The following reply was made to PR kern/57230; it has been noted by GNATS. From: Tom Convery To: freebsd-gnats-submit@FreeBSD.org Cc: Subject: Re: kern/57230: [patch] psm(4) incorrectly identifies an IntelliMouse Explorer attached through an Avocent SwitchView KVM Date: Sat, 20 Dec 2003 23:52:58 -0500 This is a multi-part message in MIME format. --------------030004040903090200060007 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Attached is an update patch that applies cleanly to 5-CURRENT as of mid-December 2003. --------------030004040903090200060007 Content-Type: text/plain; name="intellimouse.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="intellimouse.patch" --- psm.c.orig Sat Dec 20 23:34:43 2003 +++ psm.c Sat Dec 20 23:47:52 2003 @@ -774,6 +774,28 @@ } } + /* + * The Avocent SwitchView KVM appears to force an Intellimouse Explorer + * to revert to plain Intellimouse protocol whenever the device is + * disabled. This hack checks to see if we previously detected an Explorer, + * and tests if the device is now reporting a different ID. If this is the + * case, we try to re-enable Explorer functionality. + */ + if ((sc->hw.hwid == PSM_EXPLORER_ID) && + (get_aux_id(sc->kbdc) != PSM_EXPLORER_ID)) { + log(LOG_DEBUG, "psm%d: Intellimouse Explorer reverted to lower " + "protocol.\n", sc->unit); + enable_msexplorer(sc); + if (get_aux_id(sc->kbdc) == PSM_EXPLORER_ID) + log(LOG_DEBUG, "psm%d: Restored Intellimouse Explorer protocol.\n", + sc->unit); + else + log(LOG_DEBUG, "psm%d: Could not restore Intellimouse Explorer " + " protocol.\n", sc->unit); + /* We shouldn't get here unless someone switched mice out from + * underneath us. How and/or should we deal with this? */ + } + if (get_mouse_status(sc->kbdc, stat, 0, 3) < 3) log(LOG_DEBUG, "psm%d: failed to get status (doopen).\n", sc->unit); @@ -2768,18 +2790,38 @@ static int enable_msexplorer(struct psm_softc *sc) { + /* IntelliMouse initialization sequence */ static unsigned char rate0[] = { 200, 100, 80, }; + /* IntelliMouse Explorer initialization sequence */ static unsigned char rate1[] = { 200, 200, 80, }; KBDC kbdc = sc->kbdc; int id; int i; - /* the special sequence to enable the extra buttons and the roller. */ + /* + * According to Microsoft's documentation for the IntelliMouse Explorer, + * full functionality is activated by first sending the IntelliMouse + * initialization sequence, then sending the Explorer initialization + * sequence. + * Reference: http://www.microsoft.com/whdc/hwdev/tech/input/5b_wheel.mspx + */ + + /* First send the IntelliMouse init sequence */ + for (i = 0; i < sizeof(rate0)/sizeof(rate0[0]); ++i) { + if (set_mouse_sampling_rate(kbdc, rate0[i]) != rate0[i]) + return FALSE; + } + /* If we've got an Explorer, it will claim to be an IntelliMouse here */ + id = get_aux_id(kbdc); + if (id != PSM_INTELLI_ID) + return FALSE; + + /* Now send the Explorer init sequence */ for (i = 0; i < sizeof(rate1)/sizeof(rate1[0]); ++i) { if (set_mouse_sampling_rate(kbdc, rate1[i]) != rate1[i]) return FALSE; } - /* the device will give the genuine ID only after the above sequence */ + /* If we've got an Explorer, now it will identify itself */ id = get_aux_id(kbdc); if (id != PSM_EXPLORER_ID) return FALSE; @@ -2797,11 +2839,18 @@ * sequence; it will make the KVM think the mouse is IntelliMouse * when it is in fact IntelliMouse Explorer. */ + +#if 0 + /* + * This breaks IntelliMouse Explorer support with the Avocent + * SwitchView, which DOES actually understand the Explorer protocol. + */ for (i = 0; i < sizeof(rate0)/sizeof(rate0[0]); ++i) { if (set_mouse_sampling_rate(kbdc, rate0[i]) != rate0[i]) break; } id = get_aux_id(kbdc); +#endif return TRUE; } --------------030004040903090200060007--