Skip to content

Commit 52ea899

Browse files
whotbentiss
authored andcommitted
Input: add REL_WHEEL_HI_RES and REL_HWHEEL_HI_RES
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> Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Verified-by: Harry Cutts <hcutts@chromium.org> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
1 parent e195ca6 commit 52ea899

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

Documentation/input/event-codes.rst

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,26 @@ A few EV_REL codes have special meanings:
190190
* REL_WHEEL, REL_HWHEEL:
191191

192192
- These codes are used for vertical and horizontal scroll wheels,
193-
respectively.
193+
respectively. The value is the number of detents moved on the wheel, the
194+
physical size of which varies by device. For high-resolution wheels
195+
this may be an approximation based on the high-resolution scroll events,
196+
see REL_WHEEL_HI_RES. These event codes are legacy codes and
197+
REL_WHEEL_HI_RES and REL_HWHEEL_HI_RES should be preferred where
198+
available.
199+
200+
* REL_WHEEL_HI_RES, REL_HWHEEL_HI_RES:
201+
202+
- High-resolution scroll wheel data. The accumulated value 120 represents
203+
movement by one detent. For devices that do not provide high-resolution
204+
scrolling, the value is always a multiple of 120. For devices with
205+
high-resolution scrolling, the value may be a fraction of 120.
206+
207+
If a vertical scroll wheel supports high-resolution scrolling, this code
208+
will be emitted in addition to REL_WHEEL or REL_HWHEEL. The REL_WHEEL
209+
and REL_HWHEEL may be an approximation based on the high-resolution
210+
scroll events. There is no guarantee that the high-resolution data
211+
is a multiple of 120 at the time of an emulated REL_WHEEL or REL_HWHEEL
212+
event.
194213

195214
EV_ABS
196215
------

include/uapi/linux/input-event-codes.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -716,6 +716,8 @@
716716
* the situation described above.
717717
*/
718718
#define REL_RESERVED 0x0a
719+
#define REL_WHEEL_HI_RES 0x0b
720+
#define REL_HWHEEL_HI_RES 0x0c
719721
#define REL_MAX 0x0f
720722
#define REL_CNT (REL_MAX+1)
721723

0 commit comments

Comments
 (0)