From a7e4cbc212be85950f942830aebfb017f43b2504 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 15 Nov 2022 13:53:43 +1000 Subject: quirks: allow overriding of AttrEventCode and AttrInputProp This switches the quirk from AttrEventCodeEnable/Disable to just AttrEventCode with a +/- prefix for each entry. This switches the quirk from AttrInputPropEnable/Disable to just AttrInputProp with a +/- prefix for each entry. Previously, both event codes and input props would only apply the last-matching section entry for a device. Furthermore, an earlier Disable entry would take precedence over a later Enable entry. For example, a set of sections with these lines *should* enable left, right and middle: [first] AttrEventCodeEnable=BTN_LEFT;BTN_RIGHT;BTN_MIDDLE [second] AttrEventCodeDisable=BTN_RIGHT [third] AttrEventCodeEnable=BTN_LEFT;BTN_RIGHT; Alas: the first line was effectively ignored (quirks only returned the last-matching one, i.e. the one from "third"). And due to implementation details in evdev.c, the Disable attribute was processed after Enable, i.e. the device was enabled for left + right and then disabled for right. As a result, the device only had BTN_LEFT enabled. Fix this by changing the attribute to carry both enable/disable information and merging the commands together. Internally, all quirks matching a device are simply ref'd into an array in the struct quirks. The applied value is simply the last entry in the array corresponding to our quirk. For AttrEventCode and AttrInputProp instead do this: - switch them to a tuple with the code as first entry and a boolean enable/disable as second entry - if the struct quirk already has an entry for either, append the more recent one to the existing entry (instead of creating a new entry in the array). This way we have all entries that match and in-order of precedence - i.e. we can process them left-to-right to end up with the right state. Fixes: https://gitlab.freedesktop.org/libinput/libinput/-/issues/821 Signed-off-by: Peter Hutterer --- quirks/30-vendor-aiptek.quirks | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'quirks/30-vendor-aiptek.quirks') diff --git a/quirks/30-vendor-aiptek.quirks b/quirks/30-vendor-aiptek.quirks index 3efddb63..70bed023 100644 --- a/quirks/30-vendor-aiptek.quirks +++ b/quirks/30-vendor-aiptek.quirks @@ -4,7 +4,7 @@ MatchUdevType=tablet MatchBus=usb MatchVendor=0x08CA -AttrEventCodeDisable=ABS_TILT_X;ABS_TILT_Y; +AttrEventCode=-ABS_TILT_X;-ABS_TILT_Y; [Aiptek 8000U pressure threshold] MatchUdevType=tablet -- cgit v1.2.1