Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp327961yba; Fri, 3 May 2019 02:38:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqwsIKPXap+TR6xy6NcvUmwuEnVa6GgUh69+z4oCxGGZU5E3IrOU/HpU0pWIKj/foFBkWX28 X-Received: by 2002:a63:c10c:: with SMTP id w12mr9155690pgf.39.1556876316765; Fri, 03 May 2019 02:38:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556876316; cv=none; d=google.com; s=arc-20160816; b=fSaiNZcAzoRPC3Feqa/dk4bdXptK3rAx/N2epssUBmIqoYab21QIQkTpeiYn6yLAlY Fmff+LgRc7FgoWEuvBHNH6/Lp0/33S7/r1NvA/bfI5szpTBqdX2v4cbgIydmO/DsF3Io L0sWUIn01Zo0QBDhmtBda5Q5krwVaftCYMO0cDlD3YC+TKZU84fK+vBHmQ8k7LYeuipH Mij7zgHQklG8LLzF5xhUEkPxrNfG1B+7QLUG1Tmbiy1U+/xRRkFZ0Ybf7CDNRR4qbQ22 CT5Z5375MfST8owaeWV5By9U8iF478ZCtT+dwD/YA1THX3RqmMvXK5O96c/VxNbb0F8s HQig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=DG6/t7HmnFfa+6CRvfcSLTCArt9ZNpEuKq06GvwE8fE=; b=pJzV+q8BWk3SuWLVRsRV9hIJg4+r/wSYxja0Ka8xVSFWY12Wu/2QnQ45bTMujFK1vT U/B+jqCqRP/ShnARsUgf/1Xun6FlkOWHNOHsv5ekNJ3Bt5GtJC0CgaND878w7K3GmivF HYsgMXAUFLWsDsLAFLSfr9jmJCFLsVLj6tb6jj6wt4vKGvFQqjFWC0U9BOHkpT9YgBwo 2fUGOUgFN3t+HL+NLddRbmAVxVaZe7ZE5gZVlPYqv7lwDupwlVAHHNHLOV/Xf0DSpVRJ GfGs28D5g6oherYYZEbHxC8O2zxG4qeYT/ChRKwT587H09XiC4RWHdPUTtD/XFHIHkVf yupA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=E6Ocuv0T; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cm19si1842133plb.202.2019.05.03.02.38.21; Fri, 03 May 2019 02:38:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=E6Ocuv0T; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727220AbfECJgm (ORCPT + 99 others); Fri, 3 May 2019 05:36:42 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:35146 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727059AbfECJgm (ORCPT ); Fri, 3 May 2019 05:36:42 -0400 Received: by mail-lj1-f193.google.com with SMTP id z26so4690676ljj.2; Fri, 03 May 2019 02:36:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=DG6/t7HmnFfa+6CRvfcSLTCArt9ZNpEuKq06GvwE8fE=; b=E6Ocuv0TC6NS9qH8m6RdpDaCwuOXxPrWsFBPKMEQB87fb4mdvJ6enHum12ngbykA1E kANbiUvmL1aHl6EYQlekDCkufGdlNOdaqXzK5Utlqsu+k4rt4xCucTqp0zI9Dfl+9sMP +UPsYWaiM5hb5S5YT4aGrC6reicVrH+Bc/f4TtCLVbApG/b6oHFgGuhpkHWK0GAOUAF8 pAf+QgJj+ie9m0+2NitK0q11DvYMNHB5JlOEwwqF0SDdUgcCJ0tEliEgUW/ZFU6M+4kL 9wlSjrNx8jM7Gdb9jOqkD5q48b8TWtVidwGJpxPg4S3kspL7iw+dIgKod2EyC1b/Z9CR WhxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=DG6/t7HmnFfa+6CRvfcSLTCArt9ZNpEuKq06GvwE8fE=; b=VDl2mryVyY5C8vMybRd/NyLfVxjkqOyWOgCVLW9ydSNeF3N0cB3q3mYQtFNK3sJkuS SK6toz8UttjAPraXF40kN9qxNWRoTJvPqqPv+2CO3m4iC08fFsFITErkOceAGAlV1nBh bpmd1X8WPAUDbwrctZ5NAuJodsc1uk5E0xSF37zLosIcQHECHb3eBMzHH2a4EM/W/5Ge KZYNvRNFWpb2daLE7pAoE+kILCQhgyRBCD7Hjf8mBNkLCwvIWlT5weGV/JIJ5ZXy2VSG ntprHss+XtJG2jui8olx4IKIDw/ZI3OM4IEq4Su6Z3J2EJquVRaEOksAzXMajzk/MYZR IuaQ== X-Gm-Message-State: APjAAAXMkh9vnQNBKU+rGUJ4jcyHdRsWbtXL13B6DR17hbaoLJXyn+zn BZsSW6ZgYq4ipfqKItze3lnLPLST3jk= X-Received: by 2002:a2e:9188:: with SMTP id f8mr1767391ljg.100.1556876198641; Fri, 03 May 2019 02:36:38 -0700 (PDT) Received: from [192.168.1.111] ([77.123.15.14]) by smtp.googlemail.com with ESMTPSA id n10sm332778ljh.36.2019.05.03.02.36.37 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Fri, 03 May 2019 02:36:37 -0700 (PDT) Subject: Re: [PATCH] HID: fix A4Tech horizontal scrolling To: Benjamin Tissoires , =?UTF-8?B?QsWCYcW8ZWogU3pjenlnaWXFgg==?= Cc: Jiri Kosina , "open list:HID CORE LAYER" , lkml References: <20190502213639.7632-1-spaz16@wp.pl> From: Igor Kushnir Message-ID: <1a40ea07-368a-93f6-8335-dec7ae50bbf4@gmail.com> Date: Fri, 3 May 2019 12:36:36 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: uk-UA Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Benjamin, On 5/3/19 10:36 AM, Benjamin Tissoires wrote: > Hi, > > On Thu, May 2, 2019 at 11:37 PM Błażej Szczygieł wrote: >> >> Since recent high resolution scrolling changes the A4Tech driver must >> check for the "REL_WHEEL_HI_RES" usage code. >> >> Fixes: 2dc702c991e3774af9d7ce410eef410ca9e2357e (HID: input: use the >> Resolution Multiplier for high-resolution scrolling) >> >> Signed-off-by: Błażej Szczygieł > > Thanks for the patch. I do not doubt this fixes the issues, but I > still wonder if we should not export REL_HWHEEL_HI_RES instead of > REL_HWHEEL events. If you mean exporting REL_HWHEEL_HI_RES instead of REL_HWHEEL from hid-a4tech.c, then it makes sense to me, though I do not know the code well enough to be certain. Błażej and I have discussed the bug and the patch here: https://bugzilla.kernel.org/show_bug.cgi?id=203369 In summary: the patch fixes the bug for both our mice; the documentation in input/event-codes.rst states that REL_WHEEL, REL_HWHEEL "are legacy codes and REL_WHEEL_HI_RES and REL_HWHEEL_HI_RES should be preferred where available." > Also, I can not figure out how the events are processed by the kernel. > Could you attach a hid-recorder dump of the mouse wheels with > hid-recorder from https://gitlab.freedesktop.org/libevdev/hid-tools ? > > This should give me a better view of the mouse, and I could also add > it to the regression tests I am running for each commit. > > Cheers, > Benjamin After launching hid-recorder for my A4Tech WOP-49Z mouse under kernel 5.0.10 patched with Błażej's patch I: * scrolled the vertical wheel down ("Wheel: -1"); * scrolled the vertical wheel up ("Wheel: 1"); * scrolled the horizontal wheel "left" ("Wheel: -1"); * scrolled the horizontal wheel "right" ("Wheel: 1"). Note that the horizontal wheel is physically scrolled just like the vertical one in this mouse (forward/back), so "left" and "right" are the effects these scrollings make in applications when the kernel supports the mouse properly. $ sudo ./hid-recorder /dev/hidraw1 # A4Tech PS/2+USB Mouse # 0x05, 0x01, // Usage Page (Generic Desktop) 0 # 0x09, 0x02, // Usage (Mouse) 2 # 0xa1, 0x01, // Collection (Application) 4 # 0x09, 0x01, // Usage (Pointer) 6 # 0xa1, 0x00, // Collection (Physical) 8 # 0x05, 0x09, // Usage Page (Button) 10 # 0x19, 0x01, // Usage Minimum (1) 12 # 0x29, 0x07, // Usage Maximum (7) 14 # 0x15, 0x00, // Logical Minimum (0) 16 # 0x25, 0x01, // Logical Maximum (1) 18 # 0x75, 0x01, // Report Size (1) 20 # 0x95, 0x07, // Report Count (7) 22 # 0x81, 0x02, // Input (Data,Var,Abs) 24 # 0x75, 0x01, // Report Size (1) 26 # 0x95, 0x01, // Report Count (1) 28 # 0x81, 0x01, // Input (Cnst,Arr,Abs) 30 # 0x05, 0x01, // Usage Page (Generic Desktop) 32 # 0x09, 0x30, // Usage (X) 34 # 0x09, 0x31, // Usage (Y) 36 # 0x09, 0x38, // Usage (Wheel) 38 # 0x15, 0x81, // Logical Minimum (-127) 40 # 0x25, 0x7f, // Logical Maximum (127) 42 # 0x75, 0x08, // Report Size (8) 44 # 0x95, 0x03, // Report Count (3) 46 # 0x81, 0x06, // Input (Data,Var,Rel) 48 # 0xc0, // End Collection 50 # 0xc0, // End Collection 51 # R: 52 05 01 09 02 a1 01 09 01 a1 00 05 09 19 01 29 07 15 00 25 01 75 01 95 07 81 02 75 01 95 01 81 01 05 01 09 30 09 31 09 38 15 81 25 7f 75 08 95 03 81 06 c0 c0 N: A4Tech PS/2+USB Mouse I: 3 09da 0006 # Button: 0 0 0 0 0 0 0 | # | X: 0 | Y: 0 | Wheel: -1 E: 000000.000000 4 00 00 00 ff # Button: 0 0 0 0 0 0 0 | # | X: 0 | Y: 0 | Wheel: -1 E: 000000.071952 4 00 00 00 ff # Button: 0 0 0 0 0 0 0 | # | X: 0 | Y: 0 | Wheel: -1 E: 000000.159957 4 00 00 00 ff # Button: 0 0 0 0 0 0 0 | # | X: 0 | Y: 0 | Wheel: 1 E: 000002.912232 4 00 00 00 01 # Button: 0 0 0 0 0 0 0 | # | X: 0 | Y: 0 | Wheel: 1 E: 000002.952190 4 00 00 00 01 # Button: 0 0 0 0 0 0 0 | # | X: 0 | Y: 0 | Wheel: 1 E: 000004.512359 4 00 00 00 01 # Button: 0 0 0 0 0 0 0 | # | X: 0 | Y: 0 | Wheel: 1 E: 000004.584332 4 00 00 00 01 # Button: 0 0 0 0 0 0 1 | # | X: 0 | Y: 0 | Wheel: -1 E: 000007.528626 4 40 00 00 ff # Button: 0 0 0 0 0 0 1 | # | X: 0 | Y: 0 | Wheel: -1 E: 000007.568577 4 40 00 00 ff # Button: 0 0 0 0 0 0 1 | # | X: 0 | Y: 0 | Wheel: -1 E: 000008.256395 4 40 00 00 ff # Button: 0 0 0 0 0 0 1 | # | X: 0 | Y: 0 | Wheel: -1 E: 000008.336669 4 40 00 00 ff # Button: 0 0 0 0 0 0 1 | # | X: 0 | Y: 0 | Wheel: -1 E: 000008.400649 4 40 00 00 ff # Button: 0 0 0 0 0 0 1 | # | X: 0 | Y: 0 | Wheel: 1 E: 000010.936908 4 40 00 00 01 # Button: 0 0 0 0 0 0 1 | # | X: 0 | Y: 0 | Wheel: 1 E: 000010.984864 4 40 00 00 01 # Button: 0 0 0 0 0 0 1 | # | X: 0 | Y: 0 | Wheel: 1 E: 000011.056897 4 40 00 00 01 # Button: 0 0 0 0 0 0 1 | # | X: 0 | Y: 0 | Wheel: 1 E: 000011.528936 4 40 00 00 01 # Button: 0 0 0 0 0 0 1 | # | X: 0 | Y: 0 | Wheel: 1 E: 000011.616923 4 40 00 00 01 Cheers, Igor >> --- >> drivers/hid/hid-a4tech.c | 6 +++--- >> 1 file changed, 3 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/hid/hid-a4tech.c b/drivers/hid/hid-a4tech.c >> index 9428ea7cdf8a..fafb9fa558e7 100644 >> --- a/drivers/hid/hid-a4tech.c >> +++ b/drivers/hid/hid-a4tech.c >> @@ -38,7 +38,7 @@ static int a4_input_mapped(struct hid_device *hdev, struct hid_input *hi, >> { >> struct a4tech_sc *a4 = hid_get_drvdata(hdev); >> >> - if (usage->type == EV_REL && usage->code == REL_WHEEL) >> + if (usage->type == EV_REL && usage->code == REL_WHEEL_HI_RES) >> set_bit(REL_HWHEEL, *bit); >> >> if ((a4->quirks & A4_2WHEEL_MOUSE_HACK_7) && usage->hid == 0x00090007) >> @@ -60,7 +60,7 @@ static int a4_event(struct hid_device *hdev, struct hid_field *field, >> input = field->hidinput->input; >> >> if (a4->quirks & A4_2WHEEL_MOUSE_HACK_B8) { >> - if (usage->type == EV_REL && usage->code == REL_WHEEL) { >> + if (usage->type == EV_REL && usage->code == REL_WHEEL_HI_RES) { >> a4->delayed_value = value; >> return 1; >> } >> @@ -77,7 +77,7 @@ static int a4_event(struct hid_device *hdev, struct hid_field *field, >> return 1; >> } >> >> - if (usage->code == REL_WHEEL && a4->hw_wheel) { >> + if (usage->code == REL_WHEEL_HI_RES && a4->hw_wheel) { >> input_event(input, usage->type, REL_HWHEEL, value); >> return 1; >> } >> -- >> 2.21.0 >>