From ab@seerajeane.astralblue.net Sun Dec 10 15:24:42 2006 Return-Path: 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" Reply-To: "Eugene M. Kim" To: FreeBSD-gnats-submit@freebsd.org Cc: Subject: [PATCH] ums(4) does not work if the mouse defaults to boot protocol X-Send-Pr-Version: 3.113 X-GNATS-Notify: >Number: 106565 >Category: usb >Synopsis: [ums] [patch] ums(4) does not work if the mouse defaults to boot protocol >Confidential: no >Severity: serious >Priority: high >Responsible: imp >State: closed >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Dec 10 15:30:15 GMT 2006 >Closed-Date: Mon Apr 13 09:56:21 MDT 2009 >Last-Modified: Mon Apr 13 09:56:21 MDT 2009 >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: Responsible-Changed-From-To: freebsd-usb->markus Responsible-Changed-By: markus Responsible-Changed-When: Wed Dec 13 02:34:00 UTC 2006 Responsible-Changed-Why: Good catch, I'll handle it. http://www.freebsd.org/cgi/query-pr.cgi?pr=106565 State-Changed-From-To: open->feedback State-Changed-By: linimon State-Changed-When: Fri Jul 6 08:42:47 UTC 2007 State-Changed-Why: Has there been any progress on this one? http://www.freebsd.org/cgi/query-pr.cgi?pr=106565 State-Changed-From-To: feedback->patched State-Changed-By: imp State-Changed-When: Wed Jul 25 00:43:27 MDT 2007 State-Changed-Why: I've committed the patch form this PR. It appears to be good. I've also taken ownership for MFC purposes. Responsible-Changed-From-To: markus->imp Responsible-Changed-By: imp Responsible-Changed-When: Wed Jul 25 00:43:27 MDT 2007 Responsible-Changed-Why: I've committed the patch form this PR. It appears to be good. I've also taken ownership for MFC purposes. http://www.freebsd.org/cgi/query-pr.cgi?pr=106565 From: dfilter@FreeBSD.ORG (dfilter service) To: bug-followup@FreeBSD.org Cc: Subject: Re: usb/106565: commit references a PR Date: Wed, 25 Jul 2007 06:43:13 +0000 (UTC) imp 2007-07-25 06:43:06 UTC FreeBSD src repository Modified files: sys/dev/usb ums.c Log: ums(4) does not work if the mouse defaults to boot protocol. Force the protocol to be report on each open, but ignore any errors as set protocol for mice that don't implement the boot protocol can generate an error. Evidentally, the Gyration GyroPoint RF Technology Receiver (Gyration Ultra Cordless) device has this problem. Submitted by: Eugene M. Kim PR: 106565 Approved by: re (blanket) Revision Changes Path 1.96 +8 -0 src/sys/dev/usb/ums.c _______________________________________________ cvs-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/cvs-all To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org" State-Changed-From-To: patched->closed State-Changed-By: imp State-Changed-When: Mon Apr 13 09:56:16 MDT 2009 State-Changed-Why: These have been in a release... http://www.freebsd.org/cgi/query-pr.cgi?pr=106565 >Unformatted: