diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2022-11-15 13:53:43 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2022-11-28 08:25:41 +1000 |
commit | a7e4cbc212be85950f942830aebfb017f43b2504 (patch) | |
tree | 2066b01b338d97c8fe9a0b00c19852e3856309f5 /quirks/30-vendor-aiptek.quirks | |
parent | bb6ff0ec002c10111eaffa70beb5d029bb503e77 (diff) | |
download | libinput-a7e4cbc212be85950f942830aebfb017f43b2504.tar.gz |
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 <peter.hutterer@who-t.net>
Diffstat (limited to 'quirks/30-vendor-aiptek.quirks')
-rw-r--r-- | quirks/30-vendor-aiptek.quirks | 2 |
1 files changed, 1 insertions, 1 deletions
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 |