Skip to content

Commit bbeb7ad

Browse files
authored
Fixes incorrect detection of touchpads (#66)
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.
1 parent c027f87 commit bbeb7ad

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

udev_device.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -458,13 +458,7 @@ static void set_properties_from_evdev(struct udev_device *udev_device)
458458
udev_list_entry_add(&udev_device->properties, "ID_INPUT_SWITCH", "1", 0);
459459
}
460460

461-
if (test_bit(ev_bits, EV_REL)) {
462-
if (test_bit(rel_bits, REL_Y) && test_bit(rel_bits, REL_X) &&
463-
test_bit(key_bits, BTN_MOUSE)) {
464-
udev_list_entry_add(&udev_device->properties, "ID_INPUT_MOUSE", "1", 0);
465-
}
466-
}
467-
else if (test_bit(ev_bits, EV_ABS)) {
461+
if (test_bit(ev_bits, EV_ABS)) {
468462
if (test_bit(key_bits, BTN_SELECT) || test_bit(key_bits, BTN_TR) ||
469463
test_bit(key_bits, BTN_START) || test_bit(key_bits, BTN_TL)) {
470464
if (test_bit(key_bits, BTN_TOUCH)) {
@@ -494,6 +488,12 @@ static void set_properties_from_evdev(struct udev_device *udev_device)
494488
}
495489
}
496490
}
491+
else if (test_bit(ev_bits, EV_REL)) {
492+
if (test_bit(rel_bits, REL_Y) && test_bit(rel_bits, REL_X) &&
493+
test_bit(key_bits, BTN_MOUSE)) {
494+
udev_list_entry_add(&udev_device->properties, "ID_INPUT_MOUSE", "1", 0);
495+
}
496+
}
497497

498498
if (!test_bit(ev_bits, EV_KEY)) {
499499
return;

0 commit comments

Comments
 (0)