Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp485343imu; Tue, 27 Nov 2018 15:52:13 -0800 (PST) X-Google-Smtp-Source: AFSGD/Wm0scSwjFN/LpboMmGEXHKRzOTfW4MISanKgUYayqQKmWwkIoKDUSS2TUSM0wxzRZOWiWW X-Received: by 2002:a63:b649:: with SMTP id v9mr31371293pgt.436.1543362733452; Tue, 27 Nov 2018 15:52:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543362733; cv=none; d=google.com; s=arc-20160816; b=sMzgjCLyJriYsna/o7RtEVcRgbz9f/poZ9cfQKGeLhZ4WNCiQHTuJb56I3dGFf19IR tjlAimbrQ3K/xkXd9hNAi1E+3x/sUMlplo4fMeb78H4tN1GoyV1O2gJK4Sz0DMv8ZAUD jeXN1i6BJCO/ecRwwDNmqL7UywQmeOzto35Ko/AyEHAu1nxKjFMe9OBbgRqiXyIon8aZ F5ivUPi1Vgj+EbW9SWIbQ1cZ7hRMfoD1uOraB0CA+UXEhPexPQchQrZuvFEI+fiEvhwI Yxax1wLkfcFVU45+7inD7Dijlr1I8jAhXLLFtfA7ZZzHh9gieaY7J+qWSvyl16ZR+dQC 0eqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:dkim-signature; bh=cbR8tKzsU4Q1rDC41ZNwQUcy4WS0lL9QEmfkJpFlOF4=; b=dy9n6pZ//KWRBzXMnm1Z2SRP7oCdVwgsL+LEnShL55Uht7jBJF6lHJk+rjI/ndlsxJ hBrtAFMf0q9E2v4Y3xrdTLo0Px/VEq9aHZZBbArHEYp/cfO6oY7WEq9Wx8Dsm5ScaY10 fNAl/A3jer+ty6bfbdpPntXOP6VpSzIXw+tad5ayjqUmK3q7cPrYCiYhE3rMgLXWakpK itl1OVQo9unOO0qcw7A9rbhsWWlayFjNDv8q83y5FUAVbnhjc+ZBSv/2UVbcYQrOZ+bx kdFKL66X2IHa2TP0gDb27ssxITT6A+b72xNtBRSmsrnF8Okgy3tgB0dma3kdZH5NjPri vYXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@who-t.net header.s=fm1 header.b=as1ZMEce; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=bK99ZLRL; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id be9si5427765plb.143.2018.11.27.15.51.57; Tue, 27 Nov 2018 15:52:13 -0800 (PST) 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=@who-t.net header.s=fm1 header.b=as1ZMEce; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=bK99ZLRL; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726636AbeK1Ku4 (ORCPT + 99 others); Wed, 28 Nov 2018 05:50:56 -0500 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:44913 "EHLO out4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726356AbeK1Ku4 (ORCPT ); Wed, 28 Nov 2018 05:50:56 -0500 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id BD6BD222CE; Tue, 27 Nov 2018 18:51:21 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Tue, 27 Nov 2018 18:51:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=who-t.net; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm1; bh=cbR8tKzsU4Q1rDC41ZNwQUcy4WS 0lL9QEmfkJpFlOF4=; b=as1ZMEcePkBNPAwqmE1eyObsKBpRxVbeHCJJsfHABib +jVA2UdQHJK9JQrkFbJzEZbtrOzTS1pFcvXom9biqJ8vc41nfqM8PyGuIwCxqOZK Da4atiC1ct4pX0iw01FzZ2QS8YH80XG5dxysnAXi95Ji9BX0VI0Tkpgbe0zIItdX KPMlp8F7lX58+LR0SPuTBRRoqTbBsQ+rpF/FYLHTUDp/bwY2YDLuBdLkN8OfphdS KAvQb5QgFfH2i6NMKYKSHwAha7I11IBnL5tcWFzruuKsrVT9dDA4NCJKugYdsTP3 bJEevYeiJ45rv1FuzVkA16fbsmfuf5Uu7cDVPLMEEYA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=cbR8tK zsU4Q1rDC41ZNwQUcy4WS0lL9QEmfkJpFlOF4=; b=bK99ZLRLKz3zMyIZRR3AAy nrGr5ILDslNnszBWuu0q02p2NWCqWnMr0t2sRrWJ6HyuaKOXyx6G1oXV/FtKpFCO W7BVkmWGVN3rm4K/yFjkvJotXRe5+nRy8RuZhkdMcNIZsAiq7qxKR8aYvbrIdfgW z7Mq8nFBI8+FE36CbS0m6Sc3zroiFfS6GaODOM2KujYbO3YTcKZmaLZ1wTOAey8R II4n1BiAsQpfJyAr2HLbYaBPzPYBkPevhCSQjLrt8p+7Yx81YJnoh7Qr+8MKfdO6 Dt9R0H+bJXAUUbRf64Vi0ORPliFYo9iuuLxOUCPsfpu5D4c2Lzt14qCfWk0ONXLw == X-ME-Sender: X-ME-Proxy: Received: from jelly (167-179-166-29.a7b3a6.bne.nbn.aussiebb.net [167.179.166.29]) by mail.messagingengine.com (Postfix) with ESMTPA id 57554E49CA; Tue, 27 Nov 2018 18:51:17 -0500 (EST) Date: Wed, 28 Nov 2018 09:51:11 +1000 From: Peter Hutterer To: Linus Torvalds Cc: linux-input@vger.kernel.org, Dmitry Torokhov , Jiri Kosina , Harry Cutts , Nestor Lopez Casado , Linux List Kernel Mailing , Benjamin Tissoires Subject: Re: [PATCH 4/8] HID: input: use the Resolution Multiplier for high-resolution scrolling Message-ID: <20181127235111.GA7820@jelly> References: <20181122063409.15816-1-peter.hutterer@who-t.net> <20181122063409.15816-5-peter.hutterer@who-t.net> <20181122232839.GA10747@jelly> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 26, 2018 at 06:30:04PM -0800, Linus Torvalds wrote: > On Thu, Nov 22, 2018 at 3:28 PM Peter Hutterer wrote: > > > > The device sends hi-res values of 4, so it should end up as REL_WHEEL_HI_RES > > 30. We are getting 28 instead which doesn't add up to a nice 120. > > I think you're just doing the math in the wrong order. > > Why don't you just do > > update = val * 120 / multiplier > > which gives you the expected "30". > > It seems you have done the "120 / multiplier" too early, and you force > that value into "wheel_factor". Don't. Do all the calculations > (including all the accumulated ones) in the original values, and only > do the "multiply by 120 and divide by multiplier" at the very end. that's such a simple solution that it almost explains why I didn't think of it... Thanks! Cheers, Peter