From owner-freebsd-usb@FreeBSD.ORG Sun Dec 10 15:30:16 2006 Return-Path: X-Original-To: freebsd-usb@hub.freebsd.org Delivered-To: freebsd-usb@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8F4A716A503 for ; Sun, 10 Dec 2006 15:30:16 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [69.147.83.40]) by mx1.FreeBSD.org (Postfix) with ESMTP id C1D4243CA0 for ; Sun, 10 Dec 2006 15:29:04 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id kBAFUFGH098050 for ; Sun, 10 Dec 2006 15:30:15 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id kBAFUFJI098049; Sun, 10 Dec 2006 15:30:15 GMT (envelope-from gnats) Resent-Date: Sun, 10 Dec 2006 15:30:15 GMT Resent-Message-Id: <200612101530.kBAFUFJI098049@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-usb@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, "Eugene M. Kim" Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D7F9416A522 for ; Sun, 10 Dec 2006 15:24:42 +0000 (UTC) (envelope-from ab@seerajeane.astralblue.net) Received: from purple.the-7.net (purple.the-7.net [64.71.156.34]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3A2CB43E93 for ; Sun, 10 Dec 2006 15:20:03 +0000 (GMT) (envelope-from ab@seerajeane.astralblue.net) Received: from seerajeane.astralblue.net (seerajeane.astralblue.net [IPv6:2001:470:1f01:3222:2e0:81ff:fe51:1e73]) by purple.the-7.net (8.13.8/8.13.8) with ESMTP id kBAFIh0F059635 for ; Sun, 10 Dec 2006 07:18:54 -0800 (PST) (envelope-from ab@seerajeane.astralblue.net) Received: from seerajeane.astralblue.net (localhost [127.0.0.1]) by seerajeane.astralblue.net (8.13.8/8.13.8) with ESMTP id kBABSLvn003570 for ; Sun, 10 Dec 2006 03:28:22 -0800 (PST) (envelope-from ab@seerajeane.astralblue.net) Received: (from ab@localhost) by seerajeane.astralblue.net (8.13.8/8.13.8/Submit) id kBABSLRW003569; Sun, 10 Dec 2006 03:28:21 -0800 (PST) (envelope-from ab) Message-Id: <200612101128.kBABSLRW003569@seerajeane.astralblue.net> Date: Sun, 10 Dec 2006 03:28:21 -0800 (PST) From: "Eugene M. Kim" To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: usb/106565: [PATCH] ums(4) does not work if the mouse defaults to boot protocol X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: "Eugene M. Kim" List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Dec 2006 15:30:16 -0000 >Number: 106565 >Category: usb >Synopsis: [PATCH] ums(4) does not work if the mouse defaults to boot protocol >Confidential: no >Severity: serious >Priority: high >Responsible: freebsd-usb >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Dec 10 15:30:15 GMT 2006 >Closed-Date: >Last-Modified: >Originator: Eugene M. Kim >Release: FreeBSD 7.0-CURRENT i386 >Organization: >Environment: System: FreeBSD seerajeane.astralblue.net 7.0-CURRENT FreeBSD 7.0-CURRENT #12: Fri Dec 1 05:37:54 PST 2006 ab@seerajeane.astralblue.net:/home/FreeBSD/build/MAIN/obj/home/FreeBSD/build/MAIN/src/sys/PL-SEERAJEANE i386 >Description: Most USB mice support two protocols (data formats) for reporting their status: - The "report protocol," which is the default protocol (at least in the HID specification version 1.11), and supports a wide arrange of button/axis layouts, including wheels as well as more than three buttons, and - The "boot protocol," which is an optional protocol where the status data follows the "boot interface" report descriptor (see HID 1.11, section B.2) instead of the mouse's own report descriptor. (A HID report descriptor is metadata stored in a HID (such as a mouse or a keyboard), and describes what kind of data (such as keypresses, mouse movements and button presses) is available and how a "report" from the device should be parsed to recover the data.) HID 1.11, section 7.2.6 recommends that all devices default to report protocol, and that the host make no assumptions about the device's state and set the desired protocol whenever initializing a device. ums(4) does not, however, set the protocol as recommended, and fails to work properly with mouse models that default errneously to the boot protocol. The most common symptoms are: - The mouse wheel does not work. This is because the mouse follows the boot interface report descriptor, which does not have the Z-axis or wheel information. - In some cases, when the user moves the mouse cursor and/or presses a button, the mouse behaves as if its wheel were turned (and consequently moves the scrollbar of the current window, for example). This is because a report has only 3 bytes under the boot protocol, while ums(4) expects and uses more data (which is uninitialized garbage) after the first 3 bytes of valid data. - Rarely, the mouse is recognized but does not work at all, except when a button is pressed and the cursor moves erratically and spurious button events are generated (i.e. the mouse behaves as if some other buttons are pressed). This is because the mouse's own report descriptor uses Report ID tags, which cause the report ID byte to be included at the beginning of a report before other data, while the reports that the mouse generates in its default, boot mode do not have the ID byte. ums(4), assuming the mouse is operating under the "report protocol" (that is, non-boot), expects this ID byte and incorrectly parses the reports. >How-To-Repeat: Use ums(4) with any mouse that defaults to the boot protocol, including: - Gyration GyroPoint RF Technology Receiver (Gyration Ultra Cordless) >Fix: Apply the following patch: -------------------- snip -------------------- snip -------------------- --- sys/dev/usb/ums.c Wed Sep 6 17:06:42 2006 +++ sys/dev/usb/ums.c.new Sun Dec 10 02:19:15 2006 @@ -597,6 +597,14 @@ callout_handle_init((struct callout_handle *)&sc->callout_handle); + /* + * Force the report (non-boot) protocol. + * + * Mice without boot protocol support may choose not to implement + * Set_Protocol at all; do not check for error. + */ + usbd_set_protocol(sc->sc_iface, 1); + /* Set up interrupt pipe. */ err = usbd_open_pipe_intr(sc->sc_iface, sc->sc_ep_addr, USBD_SHORT_XFER_OK, &sc->sc_intrpipe, sc, -------------------- snip -------------------- snip -------------------- >Release-Note: >Audit-Trail: >Unformatted: