mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-01-04 14:20:14 +01:00
evdev: use the udev ID_INPUT_POINTINGSTICK property
Added in systemd 220, but note that for udev backwards compatibility, the ID_INPUT_POINTINGSTICK tag is set in addition to the ID_INPUT_MOUSE tag. And use that property to tag a device as trackpoint too, this allows temporary workarounds for kernel bugs where the input prop isn't set yet. https://bugzilla.redhat.com/show_bug.cgi?id=1225563 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
parent
742b5ccbfb
commit
ec468e8993
1 changed files with 10 additions and 3 deletions
13
src/evdev.c
13
src/evdev.c
|
|
@ -60,6 +60,7 @@ enum evdev_device_udev_tags {
|
|||
EVDEV_UDEV_TAG_JOYSTICK = (1 << 6),
|
||||
EVDEV_UDEV_TAG_ACCELEROMETER = (1 << 7),
|
||||
EVDEV_UDEV_TAG_BUTTONSET = (1 << 8),
|
||||
EVDEV_UDEV_TAG_POINTINGSTICK = (1 << 9),
|
||||
};
|
||||
|
||||
struct evdev_udev_tag_match {
|
||||
|
|
@ -78,6 +79,7 @@ static const struct evdev_udev_tag_match evdev_udev_tag_matches[] = {
|
|||
{"ID_INPUT_TABLET_PAD", EVDEV_UDEV_TAG_BUTTONSET},
|
||||
{"ID_INPUT_JOYSTICK", EVDEV_UDEV_TAG_JOYSTICK},
|
||||
{"ID_INPUT_ACCELEROMETER", EVDEV_UDEV_TAG_ACCELEROMETER},
|
||||
{"ID_INPUT_POINTINGSTICK", EVDEV_UDEV_TAG_POINTINGSTICK},
|
||||
|
||||
/* sentinel value */
|
||||
{ 0 },
|
||||
|
|
@ -730,7 +732,10 @@ static void
|
|||
evdev_tag_trackpoint(struct evdev_device *device,
|
||||
struct udev_device *udev_device)
|
||||
{
|
||||
if (libevdev_has_property(device->evdev, INPUT_PROP_POINTING_STICK))
|
||||
if (libevdev_has_property(device->evdev,
|
||||
INPUT_PROP_POINTING_STICK) ||
|
||||
udev_device_get_property_value(udev_device,
|
||||
"ID_INPUT_POINTINGSTICK"))
|
||||
device->tags |= EVDEV_TAG_TRACKPOINT;
|
||||
}
|
||||
|
||||
|
|
@ -1839,13 +1844,14 @@ evdev_configure_device(struct evdev_device *device)
|
|||
}
|
||||
|
||||
log_info(libinput,
|
||||
"input device '%s', %s is tagged by udev as:%s%s%s%s%s%s%s%s\n",
|
||||
"input device '%s', %s is tagged by udev as:%s%s%s%s%s%s%s%s%s\n",
|
||||
device->devname, devnode,
|
||||
udev_tags & EVDEV_UDEV_TAG_KEYBOARD ? " Keyboard" : "",
|
||||
udev_tags & EVDEV_UDEV_TAG_MOUSE ? " Mouse" : "",
|
||||
udev_tags & EVDEV_UDEV_TAG_TOUCHPAD ? " Touchpad" : "",
|
||||
udev_tags & EVDEV_UDEV_TAG_TOUCHSCREEN ? " Touchscreen" : "",
|
||||
udev_tags & EVDEV_UDEV_TAG_TABLET ? " Tablet" : "",
|
||||
udev_tags & EVDEV_UDEV_TAG_POINTINGSTICK ? " Pointingstick" : "",
|
||||
udev_tags & EVDEV_UDEV_TAG_JOYSTICK ? " Joystick" : "",
|
||||
udev_tags & EVDEV_UDEV_TAG_ACCELEROMETER ? " Accelerometer" : "",
|
||||
udev_tags & EVDEV_UDEV_TAG_BUTTONSET ? " Buttonset" : "");
|
||||
|
|
@ -1904,7 +1910,8 @@ evdev_configure_device(struct evdev_device *device)
|
|||
return device->dispatch == NULL ? -1 : 0;
|
||||
}
|
||||
|
||||
if (udev_tags & EVDEV_UDEV_TAG_MOUSE) {
|
||||
if (udev_tags & EVDEV_UDEV_TAG_MOUSE ||
|
||||
udev_tags & EVDEV_UDEV_TAG_POINTINGSTICK) {
|
||||
if (libevdev_has_event_code(evdev, EV_REL, REL_X) &&
|
||||
libevdev_has_event_code(evdev, EV_REL, REL_Y) &&
|
||||
evdev_device_init_pointer_acceleration(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue