• Jason Gerecke's avatar
    Revert "HID: wacom: generic: read the number of expected touches on a per collection basis" · b43f977d
    Jason Gerecke authored
    This reverts commit 15893fa4.
    
    The referenced commit broke pen and touch input for a variety of devices
    such as the Cintiq Pro 32. Affected devices may appear to work normally
    for a short amount of time, but eventually loose track of actual touch
    state and can leave touch arbitration enabled which prevents the pen
    from working. The commit is not itself required for any currently-available
    Bluetooth device, and so we revert it to correct the behavior of broken
    devices.
    
    This breakage occurs due to a mismatch between the order of collections
    and the order of usages on some devices. This commit tries to read the
    contact count before processing events, but will fail if the contact
    count does not occur prior to the first logical finger collection. This
    is the case for devices like the Cintiq Pro 32 which place the contact
    count at the very end of the report.
    
    Without the contact count set, touches will only be partially processed.
    The `wacom_wac_finger_slot` function will not open any slots since the
    number of contacts seen is greater than the expectation of 0, but we will
    still end up calling `input_mt_sync_frame` for each finger anyway. This
    can cause problems for userspace separate from the issue currently taking
    place in the kernel. Only once all of the individual finger collections
    have been processed do we finally get to the enclosing collection which
    contains the contact count. The value ends up being used for the *next*
    report, however.
    
    This delayed use of the contact count can cause the driver to loose track
    of the actual touch state and believe that there are contacts down when
    there aren't. This leaves touch arbitration enabled and prevents the pen
    from working. It can also cause userspace to incorrectly treat single-
    finger input as gestures.
    
    Link: https://github.com/linuxwacom/input-wacom/issues/146Signed-off-by: default avatarJason Gerecke <jason.gerecke@wacom.com>
    Reviewed-by: default avatarAaron Armstrong Skomra <aaron.skomra@wacom.com>
    Fixes: 15893fa4 ("HID: wacom: generic: read the number of expected touches on a per collection basis")
    Cc: stable@vger.kernel.org # 5.3+
    Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
    b43f977d
wacom_wac.c 152 KB