• Peter Hutterer's avatar
    HID: input: use the Resolution Multiplier for high-resolution scrolling · 2dc702c9
    Peter Hutterer authored
    Windows uses a magic number of 120 for a wheel click. High-resolution
    scroll wheels are supposed to use a fraction of 120 to signal smaller
    scroll steps. This is implemented by the Resolution Multiplier in the
    device itself.
    
    If the multiplier is present in the report descriptor, set it to the
    logical max and then use the resolution multiplier to calculate the
    high-resolution events. This is the recommendation by Microsoft, see
    http://msdn.microsoft.com/en-us/windows/hardware/gg487477.aspx
    
    Note that all mice encountered so far have a logical min/max of 0/1, so
    it's a binary "yes or no" to high-res scrolling anyway.
    
    To make userspace simpler, always enable the REL_WHEEL_HI_RES bit. Where
    the device doesn't support high-resolution scrolling, the value for the
    high-res data will simply be a multiple of 120 every time. For userspace,
    if REL_WHEEL_HI_RES is available that is the one to be used.
    
    Potential side-effect: a device with a Resolution Multiplier applying to
    other Input items will have those items set to the logical max as well.
    This cannot easily be worked around but it is doubtful such devices exist.
    Signed-off-by: default avatarPeter Hutterer <peter.hutterer@who-t.net>
    Verified-by: default avatarHarry Cutts <hcutts@chromium.org>
    Signed-off-by: default avatarBenjamin Tissoires <benjamin.tissoires@redhat.com>
    2dc702c9
hid-input.c 55.7 KB