Skip to content

Commit

Permalink
Fixes incorrect detection of touchpads (#66)
Browse files Browse the repository at this point in the history
Some touchpad drivers (such as applespi) claim to have both EV_ABS and EV_REL
capabilities. These touchpads are then reported as mice by libudev-zero.
  • Loading branch information
smattie authored Feb 13, 2024
1 parent c027f87 commit bbeb7ad
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions udev_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -458,13 +458,7 @@ static void set_properties_from_evdev(struct udev_device *udev_device)
udev_list_entry_add(&udev_device->properties, "ID_INPUT_SWITCH", "1", 0);
}

if (test_bit(ev_bits, EV_REL)) {
if (test_bit(rel_bits, REL_Y) && test_bit(rel_bits, REL_X) &&
test_bit(key_bits, BTN_MOUSE)) {
udev_list_entry_add(&udev_device->properties, "ID_INPUT_MOUSE", "1", 0);
}
}
else if (test_bit(ev_bits, EV_ABS)) {
if (test_bit(ev_bits, EV_ABS)) {
if (test_bit(key_bits, BTN_SELECT) || test_bit(key_bits, BTN_TR) ||
test_bit(key_bits, BTN_START) || test_bit(key_bits, BTN_TL)) {
if (test_bit(key_bits, BTN_TOUCH)) {
Expand Down Expand Up @@ -494,6 +488,12 @@ static void set_properties_from_evdev(struct udev_device *udev_device)
}
}
}
else if (test_bit(ev_bits, EV_REL)) {
if (test_bit(rel_bits, REL_Y) && test_bit(rel_bits, REL_X) &&
test_bit(key_bits, BTN_MOUSE)) {
udev_list_entry_add(&udev_device->properties, "ID_INPUT_MOUSE", "1", 0);
}
}

if (!test_bit(ev_bits, EV_KEY)) {
return;
Expand Down

0 comments on commit bbeb7ad

Please sign in to comment.