• Nir Perry's avatar
    Input: ALPS - fix multi-touch decoding on SS4 plus touchpads · 4d94e776
    Nir Perry authored
    The fix for handling two-finger scroll (i4a646580 - "Input: ALPS -
    fix two-finger scroll breakage in right side on ALPS touchpad")
    introduced a minor "typo" that broke decoding of multi-touch events are
    decoded on some ALPS touchpads.  For example, tapping with three-fingers
    can no longer be used to emulate middle-mouse-button (the kernel doesn't
    recognize this as the proper event, and doesn't report it correctly to
    userspace).  This affects touchpads that use SS4 "plus" protocol
    variant, like those found on Dell E7270 & E7470 laptops (tested on
    E7270).
    
    First, probably the code in alps_decode_ss4_v2() for case
    SS4_PACKET_ID_MULTI used inconsistent indices to "f->mt[]". You can see
    0 & 1 are used for the "if" part but 2 & 3 are used for the "else" part.
    
    Second, in the previous patch, new macros were introduced to decode X
    coordinates specific to the SS4 "plus" variant, but the macro to
    define the maximum X value wasn't changed accordingly. The macros to
    decode X values for "plus" variant are effectively shifted right by 1
    bit, but the max wasn't shifted too. This causes the driver to
    incorrectly handle "no data" cases, which also interfered with how
    multi-touch was handled.
    
    Fixes: 4a646580 ("Input: ALPS - fix two-finger scroll breakage...")
    Signed-off-by: default avatarNir Perry <nirperry@gmail.com>
    Reviewed-by: default avatarMasaki Ota <masaki.ota@jp.alps.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
    4d94e776
alps.c 85.5 KB