All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Hutterer <peter.hutterer@who-t.net>
To: linux-input@vger.kernel.org
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Jiri Kosina <jikos@kernel.org>, Harry Cutts <hcutts@chromium.org>,
	torvalds@linux-foundation.org,
	Nestor Lopez Casado <nlopezcasad@logitech.com>,
	linux-kernel@vger.kernel.org,
	Benjamin Tissoires <benjamin.tissoires@redhat.com>
Subject: [PATCH v3 1/8] Input: add `REL_WHEEL_HI_RES` and `REL_HWHEEL_HI_RES`
Date: Wed,  5 Dec 2018 10:42:21 +1000	[thread overview]
Message-ID: <20181205004228.10714-2-peter.hutterer@who-t.net> (raw)
In-Reply-To: <20181205004228.10714-1-peter.hutterer@who-t.net>

This event code represents scroll reports from high-resolution wheels and
is modelled after the approach Windows uses. The value 120 is one detent
(wheel click) of movement. Mice with higher-resolution scrolling can send
fractions of 120 which must be accumulated in userspace. Userspace can either
wait for a full 120 to accumulate or scroll by fractions of one logical scroll
movement as the events come in. 120 was picked as magic number because it has
a high number of integer fractions that can be used by high-resolution wheels.

For more information see
https://docs.microsoft.com/en-us/previous-versions/windows/hardware/design/dn613912(v=vs.85)

These new axes obsolete REL_WHEEL and REL_HWHEEL. The legacy axes are emulated
by the kernel but the most accurate (and most granular) data is available
through the new axes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
---
No changes since v1

 Documentation/input/event-codes.rst    | 21 ++++++++++++++++++++-
 include/uapi/linux/input-event-codes.h |  2 ++
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/Documentation/input/event-codes.rst b/Documentation/input/event-codes.rst
index a8c0873beb95..b24b5343f5eb 100644
--- a/Documentation/input/event-codes.rst
+++ b/Documentation/input/event-codes.rst
@@ -190,7 +190,26 @@ A few EV_REL codes have special meanings:
 * REL_WHEEL, REL_HWHEEL:
 
   - These codes are used for vertical and horizontal scroll wheels,
-    respectively.
+    respectively. The value is the number of detents moved on the wheel, the
+    physical size of which varies by device. For high-resolution wheels
+    this may be an approximation based on the high-resolution scroll events,
+    see REL_WHEEL_HI_RES. These event codes are legacy codes and
+    REL_WHEEL_HI_RES and REL_HWHEEL_HI_RES should be preferred where
+    available.
+
+* REL_WHEEL_HI_RES, REL_HWHEEL_HI_RES:
+
+  - High-resolution scroll wheel data. The accumulated value 120 represents
+    movement by one detent. For devices that do not provide high-resolution
+    scrolling, the value is always a multiple of 120. For devices with
+    high-resolution scrolling, the value may be a fraction of 120.
+
+    If a vertical scroll wheel supports high-resolution scrolling, this code
+    will be emitted in addition to REL_WHEEL or REL_HWHEEL. The REL_WHEEL
+    and REL_HWHEEL may be an approximation based on the high-resolution
+    scroll events. There is no guarantee that the high-resolution data
+    is a multiple of 120 at the time of an emulated REL_WHEEL or REL_HWHEEL
+    event.
 
 EV_ABS
 ------
diff --git a/include/uapi/linux/input-event-codes.h b/include/uapi/linux/input-event-codes.h
index 3eb5a4c3d60a..265ef2028660 100644
--- a/include/uapi/linux/input-event-codes.h
+++ b/include/uapi/linux/input-event-codes.h
@@ -716,6 +716,8 @@
  * the situation described above.
  */
 #define REL_RESERVED		0x0a
+#define REL_WHEEL_HI_RES	0x0b
+#define REL_HWHEEL_HI_RES	0x0c
 #define REL_MAX			0x0f
 #define REL_CNT			(REL_MAX+1)
 
-- 
2.19.2


  reply	other threads:[~2018-12-05  0:42 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-05  0:42 [PATCH v3 0/8] HID: MS and Logitech high-resolution scroll wheel support Peter Hutterer
2018-12-05  0:42 ` Peter Hutterer [this message]
2018-12-06 22:56   ` [PATCH v3 1/8] Input: add `REL_WHEEL_HI_RES` and `REL_HWHEEL_HI_RES` Dmitry Torokhov
2018-12-05  0:42 ` [PATCH v3 2/8] HID: core: store the collections as a basic tree Peter Hutterer
2018-12-05  0:42 ` [PATCH v3 3/8] HID: core: process the Resolution Multiplier Peter Hutterer
2018-12-05  0:42 ` [PATCH v3 4/8] HID: input: use the Resolution Multiplier for high-resolution scrolling Peter Hutterer
2018-12-05  0:42 ` [PATCH v3 5/8] HID: logitech-hidpp: fix typo, hiddpp to hidpp Peter Hutterer
2018-12-05  0:42 ` [PATCH v3 6/8] HID: logitech: Add function to enable HID++ 1.0 "scrolling acceleration" Peter Hutterer
2018-12-05  0:42 ` [PATCH v3 7/8] HID: logitech: Enable high-resolution scrolling on Logitech mice Peter Hutterer
2018-12-05 21:52   ` Harry Cutts
2018-12-14 13:46   ` Clément VUCHENER
2018-12-14 18:37     ` Harry Cutts
2018-12-15 14:45       ` Clément VUCHENER
2018-12-19 10:57         ` Clément VUCHENER
2018-12-19 20:34           ` Benjamin Tissoires
2019-04-24 15:34             ` Clément VUCHENER
2019-04-25  7:40               ` Benjamin Tissoires
2019-04-25  8:24                 ` Clément VUCHENER
2019-04-25  8:45                   ` Benjamin Tissoires
2019-04-25  9:28                     ` Clément VUCHENER
2019-04-25  9:35                       ` Benjamin Tissoires
2019-04-25 12:35                         ` Clément VUCHENER
2018-12-05  0:42 ` [PATCH v3 8/8] HID: logitech: Use LDJ_DEVICE macro for existing " Peter Hutterer
2018-12-05 21:56 ` [PATCH v3 0/8] HID: MS and Logitech high-resolution scroll wheel support Harry Cutts
2018-12-07 16:18   ` Benjamin Tissoires

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181205004228.10714-2-peter.hutterer@who-t.net \
    --to=peter.hutterer@who-t.net \
    --cc=benjamin.tissoires@redhat.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=hcutts@chromium.org \
    --cc=jikos@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nlopezcasad@logitech.com \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.