From owner-freebsd-usb@FreeBSD.ORG Mon Jul 27 19:40:02 2009 Return-Path: Delivered-To: freebsd-usb@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 64D331065670; Mon, 27 Jul 2009 19:40:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 3E6CF8FC0A; Mon, 27 Jul 2009 19:40:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id n6RJe2cd014036; Mon, 27 Jul 2009 19:40:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id n6RJe1on014035; Mon, 27 Jul 2009 19:40:01 GMT (envelope-from gnats) Resent-Date: Mon, 27 Jul 2009 19:40:01 GMT Resent-Message-Id: <200907271940.n6RJe1on014035@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@freebsd.org (GNATS Filer) Resent-To: freebsd-usb@FreeBSD.org Resent-Cc: thompsa@freebsd.org, hselasky@c2i.net, alfred@freebsd.org Resent-Reply-To: FreeBSD-gnats-submit@freebsd.org, Eygene Ryabinkin Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 185E2106566B for ; Mon, 27 Jul 2009 19:36:32 +0000 (UTC) (envelope-from rea-fbsd@codelabs.ru) Received: from 0.mx.codelabs.ru (0.mx.codelabs.ru [144.206.177.45]) by mx1.freebsd.org (Postfix) with ESMTP id 657158FC08 for ; Mon, 27 Jul 2009 19:36:31 +0000 (UTC) (envelope-from rea-fbsd@codelabs.ru) Received: from phoenix.codelabs.ru (ppp85-141-160-233.pppoe.mtu-net.ru [85.141.160.233]) by 0.mx.codelabs.ru with esmtps (TLSv1:CAMELLIA256-SHA:256) id 1MVVzq-000N84-2A for FreeBSD-gnats-submit@freebsd.org; Mon, 27 Jul 2009 23:36:30 +0400 Message-Id: <20090727193629.BF055B8090@phoenix.codelabs.ru> Date: Mon, 27 Jul 2009 23:36:29 +0400 (MSD) From: Eygene Ryabinkin To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.113 X-GNATS-Notify: thompsa@freebsd.org, hselasky@c2i.net, alfred@freebsd.org Cc: Subject: usb/137188: [usb][patch] correctly handle USB report descriptors with interleaved report IDs X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Eygene Ryabinkin List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jul 2009 19:40:02 -0000 >Number: 137188 >Category: usb >Synopsis: [usb][patch] correctly handle USB report descriptors with interleaved report IDs >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-usb >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Jul 27 19:40:01 UTC 2009 >Closed-Date: >Last-Modified: >Originator: Eygene Ryabinkin >Release: FreeBSD 8.0-BETA2 amd64 >Organization: Code Labs >Environment: System: FreeBSD 8.0-BETA2 amd64 >Description: Some devices can have interleaved report IDs. For example, when vendor groups some items inside logical collections and these items come from various report IDs, they will be interleaved. Current code sets item position to zero everytime when new report ID is encountered. Such behaviour isn't enforced by the HID specification (at least I hadn't found such place in the HID spec v 1.11), so I take that interleaved IDs are OK and the code should be changed to handle these devices. >How-To-Repeat: One can reproduce this with, for example, Microsoft Wireless Laser Mouse 5000: it has Z-axis and tilt axis output items grouped with their feature items that control sensitivity. HID descriptor for this mouse can be found in the supplied patch. For me, without the below patch Z-axis is reported to be at offset 0, so button clicks produce extra wheel movements that are translated to scrolls under Xorg. And that's very funny when click produces scrolls -- it reminds me old game with the hiding mouse pointer under WFWG 3.11. >Fix: The following patch adds the ability to save current item positions when new report ID is encountered. It fixes both kernel parser and libusbhid one. Patches are generally the same, modulo differences between kernel- and user-side needs. --- correctly-handle-interleaved-report-IDs.patch begins here --- begin 644 0001-HID-correctly-handle-interleaved-report-IDs-inside-t.patch M1G)O;2`W-#=C-36=E;F4@4GEA8FEN M:VEN(#QR96$M9F)S9$!C;V1E;&%B2!H86YD;&4@:6YT97)L96%V960@#$I6T-O;G-U;65R*#!X8RE="D-/3$Q%0U1)3TX@07!P;&EC871I M;VXH,2D*("!54T%'12!004=%($=E;F5R:6,@1&5S:W1O<"@P>#$I"B`@55-! M1T4@36]U&,I"B`@("!54T%'12!!0R!086XH,'@R,S@I6T-O;G-U M;65R*#!X8RE="B`@("!215!/4E0@0T]53E0@,0H@("`@4D503U)4(%-)6D4@ M.`H@("`@3$]'24-!3"!-24Y)355-("TQ,C<*("`@($Q/1TE#04P@34%824U5 M32`Q,C<*("`@($E.4%54("@@1&%T82!687)I86)L92!296QA=&EV92`I("@V M*0H@("`@4D503U)4($E$(#(P"B`@("!54T%'12!004=%($UI8W)O&9F,#`I"B`@("!54T%'12!5;FMN;W=N(%5S86=E*#!X9F4P,2E;36EC&9E,#(I6TUI8W)O&9F,#`I70H@("`@55-!1T4@56YK M;F]W;B!5&9E,#`I6TUI8W)O&9F,#`I70H@("`@4D50 M3U)4($-/54Y4(#(*("`@(%)%4$]25"!325I%(#$*("`@($Q/1TE#04P@34%8 M24U532`Q"B`@("!)3E!55"`H($1A=&$@5F%R:6%B;&4@06)S;VQU=&4@*2`H M,BD*("`@(%5304=%(%5N:VYO=VX@57-A9V4H,'AF9C`S*5M-:6-R;W-O9G0H M,'AF9C`P*5T*("`@(%)%4$]25"!#3U5.5"`Q"B`@("!215!/4E0@4TE:12`R M"B`@("!,3T=)0T%,($U!6$E-54T@,PH@("`@24Y0550@*"!$871A(%9A#(I6T=E;F5R:6,@1&5S:W1O<"@P>#$I70H@($-/3$Q%0U1)3TX@3&]G M:6-A;"@R*0H@("`@4D503U)4($E$(#$W"B`@("!54T%'12!0;VEN=&5R*#!X M,2E;1V5N97)I8R!$97-K=&]P*#!X,2E="B`@("!#3TQ,14-424].(%!H>7-I M8V%L*#`I"B`@("`@(%5304=%(%!!1T4@0G5T=&]N*#!X.2D*("`@("`@55-! M1T4@34E.24U532!"=71T;VXQ*#$I"B`@("`@(%5304=%($U!6$E-54T@0G5T M=&]N-2@U*0H@("`@("!215!/4E0@0T]53E0@-0H@("`@("!215!/4E0@4TE: M12`Q"B`@("`@($Q/1TE#04P@34%824U532`Q"B`@("`@($E.4%54("@@1&%T M82!687)I86)L92!!8G-O;'5T92`I("@R*0H@("`@("!215!/4E0@4TE:12`S M"B`@("`@(%)%4$]25"!#3U5.5"`Q"B`@("`@($E.4%54("@@0V]N#$I70H@("`@("!54T%'12!9*#!X,S$I6T=E;F5R:6,@1&5S:W1O<"@P M>#$I70H@("`@("!215!/4E0@0T]53E0@,@H@("`@("!215!/4E0@4TE:12`X M"B`@("`@($Q/1TE#04P@34E.24U532`M,3(W"B`@("`@($Q/1TE#04P@34%8 M24U532`Q,C<*("`@("`@24Y0550@*"!$871A(%9A#0X*5M'96YE&,I"B`@("`@("`@3$]'24-!3"!-24Y)355-("TQ,C<* M("`@("`@("!,3T=)0T%,($U!6$E-54T@,3(W"B`@("`@("`@4D503U)4(%-) M6D4@.`H@("`@("`@(%5304=%($%#(%!A;B@P>#(S."E;0V]N&1U;7!="C`P,#`@ M,#4@,$,@,#D@,#$@03$@,#$@,#4@,#$@,#D@,#(@03$@,#(@.#4@,3,@,#4@ M,$,*,#`Q,"`P02`S."`P,B`Y-2`P,2`W-2`P."`Q-2`X,2`R-2`W1B`X,2`P M-B`X-2`Q-"`P-@HP,#(P(#`P($9&(#!!(#`Q($9%(#2!P;&%C960@=&\@=&AE(&]F9G-E M="`P+"!M86MI;F<*'1E;F1E M9"!I;B!T:&4@7=H97)E+@H*4VEG;F5D+6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`J"BL@*B!3879E2!S879E9"!A;F0**R`J(')EF5R;V5D+`HK M"2`J('-O(&%N>2!S=6)S97%U96YT(&QO;VMU<',@=VEL;"!G:79E('1H92!R M:6=H="!O9F9S970N"BL)("HO"BL):68@*"%S+3YC<&]S*2!["BL)"2\J($YE M=R!R97!OF4@86YD(&ENF5O9BAS+3YC<&]S6S!=*2P@ M35]414U0+`HK"0D@($U?5T%)5$]+('P@35]:15)/*3L**PD)'0I('L**PD):68@*&-U'0I.PHK"7T**PHK"2IP;W,@/2!S+3YC<&]S M+3YP;W,["BL)Release-Note: >Audit-Trail: >Unformatted: