mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2025-12-20 05:40:04 +01:00
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>
40 lines
1.9 KiB
Text
40 lines
1.9 KiB
Text
# Do not edit this file, it will be overwritten on update
|
|
|
|
# The Madcatz RAT3 has a mode button that cycles through event codes.
|
|
# On press, we get a release for the current mode and a press for the
|
|
# next mode:
|
|
# -event21 DEVICE_ADDED Madcatz Mad Catz R.A.T.3 Mouse seat0 default group1 cap:p left scroll-nat scroll-button
|
|
# event21 POINTER_BUTTON +2.35s BTN_BACK (278) pressed, seat count: 1
|
|
# event21 POINTER_BUTTON +3.08s BTN_BACK (278) released, seat count: 0
|
|
# event21 POINTER_BUTTON +3.08s BTN_TASK (279) pressed, seat count: 1
|
|
# event21 POINTER_BUTTON +6.69s BTN_FORWARD (277) pressed, seat count: 1
|
|
# event21 POINTER_BUTTON +6.69s BTN_TASK (279) released, seat count: 0
|
|
# event21 POINTER_BUTTON +7.32s BTN_FORWARD (277) released, seat count: 0
|
|
# event21 POINTER_BUTTON +7.32s BTN_BACK (278) pressed, seat count: 1
|
|
# event21 POINTER_BUTTON +7.84s BTN_BACK (278) released, seat count: 0
|
|
# event21 POINTER_BUTTON +7.84s BTN_TASK (279) pressed, seat count: 1
|
|
#
|
|
# Disable the event codes to avoid stuck buttons.
|
|
[Madcatz RAT3]
|
|
MatchUdevType=mouse
|
|
MatchBus=usb
|
|
MatchVendor=0x0738
|
|
MatchProduct=0x1703
|
|
# EV_KEY 0x115, 0x116, 0x117
|
|
AttrEventCode=-EV_KEY:0x115;-EV_KEY:0x116;-EV_KEY:0x117
|
|
|
|
# Like the Madcatz RAT3, but with different codes:
|
|
# event8 POINTER_BUTTON +0.488s ??? (280) pressed, seat count: 1
|
|
# event8 POINTER_BUTTON +1.275s ??? (280) released, seat count: 0
|
|
# event8 POINTER_BUTTON +1.275s ??? (281) pressed, seat count: 1
|
|
# event8 POINTER_BUTTON +3.585s ??? (281) released, seat count: 0
|
|
# event8 POINTER_BUTTON +3.585s ??? (282) pressed, seat count: 1
|
|
# event8 POINTER_BUTTON +4.184s ??? (280) pressed, seat count: 1
|
|
# event8 POINTER_BUTTON +4.184s ??? (282) released, seat count: 0
|
|
[Madcatz RAT7]
|
|
MatchUdevType=mouse
|
|
MatchBus=usb
|
|
MatchVendor=0x0738
|
|
MatchProduct=0x1708
|
|
# EV_KEY 0x118, 0x119, 0x11A
|
|
AttrEventCode=-EV_KEY:0x118;-EV_KEY:0x119;-EV_KEY:0x11A
|