Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp3924259imd; Mon, 29 Oct 2018 14:43:37 -0700 (PDT) X-Google-Smtp-Source: AJdET5c4+jF/WPVXwBdt2NYM1C7XIQXXRjQxa5ownrst9Q2ojyw4+tZtEhJL/nIshhRpKhVkm3Ga X-Received: by 2002:a17:902:205:: with SMTP id 5-v6mr1557974plc.307.1540849417240; Mon, 29 Oct 2018 14:43:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540849417; cv=none; d=google.com; s=arc-20160816; b=GeAjiuCdMsdDis9KWr4Ko2bvvhuW3uyTaKvRvzWclRgNvJpnCG5kVmcsK+QCEMZcv9 upEbPofvI3sydKjmiYA1cSFFhheL2LgtB6h6HWC9k5V+x7LIqauSBlMXRa9Km7MFPMCW neGI7etYvWmk/LRbZB5rrdgkonh1qF2W902YmGCP1HcLZSPZPw10JieilY7z8iphUprj 4lrUWFavubVXTTaekOW2xpykeh7QKgtVIGl4CltwaQAYNfG5qE9HVIFH9uteK/EAJaA5 Kr9576fNut2K9y9hBUJaN9PG500eD/zV76WF504LcWO76Gt3ByQDtHo8lX82qhC1VWzp JX6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=zbRB6Qt/mFqkheWmWKwC5+fpTqzRBevU9KCWKLXWBJU=; b=t7VPlorBTJHenbFtZZVKfWzU7J6tpc7lMdkAztg3SBuGGpOmb38fBco0NVW95hOHhj jLIFvTZAL2+dxP3gW7tLSaS2YjLvmo82FCkpzY99U4xTEDgFJXClJdVrlRD5dF+abJN0 AMqPrzwtELLUvcek2deF7rbs/QLtAQepVbTtbBHp28LyGtB7S+CfU3+HRvaZjOysR87R 9sME7MgsaSk/3rU6YDBnqiQkCr+hRCPNewtOW6b/s813y3KBWJzchiH1w5ApfcAP9sPF ui6uJhPAn7xaYwyrZP2JGRxF0F3Hx8JDFQ0OazuWJGovL/VV6+1YQnRLVqXzkwNYUV+S KWqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=BGz0yKKr; 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=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w11-v6si21434990pgs.377.2018.10.29.14.43.20; Mon, 29 Oct 2018 14:43:37 -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=@chromium.org header.s=google header.b=BGz0yKKr; 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=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727600AbeJ3Gda (ORCPT + 99 others); Tue, 30 Oct 2018 02:33:30 -0400 Received: from mail-ed1-f50.google.com ([209.85.208.50]:46853 "EHLO mail-ed1-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727314AbeJ3Gda (ORCPT ); Tue, 30 Oct 2018 02:33:30 -0400 Received: by mail-ed1-f50.google.com with SMTP id v18-v6so8668850edq.13 for ; Mon, 29 Oct 2018 14:42:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=zbRB6Qt/mFqkheWmWKwC5+fpTqzRBevU9KCWKLXWBJU=; b=BGz0yKKrDIUL856n5CBCNpbdomDgKQLNCwOAXKRLpBq6R85QyMQUJnL5K1ch0NPYT8 fqLaFxQnB/LPFWWzl21O6IkQYzATkIwDoFHsQ9fkTI2TaK8MivYie63IDcLtSF2JT2qz R0sHPmsPWah9U2VmUaZd0LmVDn42nI8asLHgM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=zbRB6Qt/mFqkheWmWKwC5+fpTqzRBevU9KCWKLXWBJU=; b=QMdkClVoBqvLPUhQ9Eyup2oNmORzVFlbnL/15dPRnd0OpPfCgounZuaKzyXi/UWctV 2IoY/Y+hkZqHdQ6H5nlcKavtjN0+uHh/TPChOroyxIzBMk0p1EG9bfTHAzLDTp7ngKkn eOjaD4InnjekG9eV1+uHU0wobdHEpcx2bXCvaQi91VSXkjF5ACLmoKgeDJ/TD0oQY1gP ZKHHJ8SFk2TprVFmKBnnyQeg8cLeqVK/vfYOsVqmc7qMDcfGf42DJgr3bVW3glEM2dIS nkYPpnpVhcTnns01gc9wrdahBVIm5iR5THvvm4HvumPep9ewbxIvqGC66JCPeAxm1rtP QJWA== X-Gm-Message-State: AGRZ1gKix/7awOdpzA8uirED1oAh+P0QM0nzvjQOjvMsfuwdMZpSFocd TJRi4h5JmL+SRGV65hd6YnWP5nvx6Ro= X-Received: by 2002:a17:906:45d8:: with SMTP id z24-v6mr5561345ejq.19.1540849376517; Mon, 29 Oct 2018 14:42:56 -0700 (PDT) Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com. [209.85.128.48]) by smtp.gmail.com with ESMTPSA id t15-v6sm3901360ejf.27.2018.10.29.14.42.54 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Oct 2018 14:42:55 -0700 (PDT) Received: by mail-wm1-f48.google.com with SMTP id y144-v6so9398753wmd.4 for ; Mon, 29 Oct 2018 14:42:54 -0700 (PDT) X-Received: by 2002:a1c:7818:: with SMTP id t24-v6mr5911577wmc.99.1540849374463; Mon, 29 Oct 2018 14:42:54 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Harry Cutts Date: Mon, 29 Oct 2018 14:42:42 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Logitech high-resolution scrolling.. To: torvalds@linux-foundation.org Cc: jikos@kernel.org, benjamin.tissoires@redhat.com, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Peter Hutterer Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 29 Oct 2018 at 14:12, Linus Torvalds > So what the half-multiplier did, assuming a multiplier of 8 (which is > what my MX Anywhere 2S reports) would be: > > - remainder starts at 3 > - high-res is +1 > - now remainder is 3+1, and it triggers the >= half logic > - 4/8 is 0, but then the code added 1 because high-res was positive, > so the code decides to add 1 > - the code does a wheel update of 1, and updates remainder with -8, > so now it's -4 > > Next time around, if the high-res update is 0 or -1, it will go the > other direction. And then it will oscillate. > > Notice how tiny movements of +1/-1 in the *high-res* count can > translate into +1/-1 in the regular wheel movement. Ah, I see what you mean. So, if we move the threshold to (multiplier - 1)/multiplier (7/8) in this case, I think the equivalent scenario would be: - remainder starts at 7 - high-res is +1 - remainder is now 7+1, triggering a low-res update - 7/8 is 0, but we add one to the remainder in the check making it (7+1)/8 == 1 - we update remainder to -1 This way we're still at least 7/8ths of a notch from the threshold in either direction, so we shouldn't get the oscillation problem. Does that sound reasonable, or do you think I've missed something? > I do not believe that you actually ever *used* that code, or if you > did, you only did so with applications that were high-res aware and > ignored the regular wheel entirely because you were testing in an > environment with other changes than just the kernel. I tested these changes with 5 different Logitech mice (see the Logitech high-res support patch [0] for details), and did so mainly with applications that were *not* high-res aware, using a mix of clicky and smooth modes. Admittedly the MX Anywhere 2S was not one of my test devices; I had assumed that its behaviour would be sufficiently similar to that of the MX Anywhere 2 and the MX Master 2S. Harry Cutts Chrome OS Touch/Input team [0]: https://patchwork.kernel.org/patch/10582935/