diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2014-07-21 14:20:35 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2014-07-21 20:20:45 +1000 |
commit | 0915c2c51a8b3c86c8a19abe9e572af5b58bd4ec (patch) | |
tree | 8e9353c5973a56244682966dde96c72fdec6d301 | |
parent | f179c70bb5b97185997d68ec373f74ded576f836 (diff) | |
download | libinput-0915c2c51a8b3c86c8a19abe9e572af5b58bd4ec.tar.gz |
touchpad: always enable palm detection on apple touchpads
They don't set resolution so we can't calculate the size but we know they're
big enough to need palm detection.
And fix the descriptor for the bcm5974. For some reason this was advertising
synaptics coordinates. Fix it to represent (one of) the apple touchpads.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
-rw-r--r-- | src/evdev-mt-touchpad-buttons.c | 2 | ||||
-rw-r--r-- | src/evdev-mt-touchpad.c | 19 | ||||
-rw-r--r-- | src/evdev-mt-touchpad.h | 2 | ||||
-rw-r--r-- | test/litest-bcm5974.c | 19 | ||||
-rw-r--r-- | test/touchpad.c | 3 |
5 files changed, 29 insertions, 16 deletions
diff --git a/src/evdev-mt-touchpad-buttons.c b/src/evdev-mt-touchpad-buttons.c index bd3c0e25..fe33d0b1 100644 --- a/src/evdev-mt-touchpad-buttons.c +++ b/src/evdev-mt-touchpad-buttons.c @@ -521,7 +521,7 @@ tp_init_buttons(struct tp_dispatch *tp, tp->buttons.motion_dist = diagonal * DEFAULT_BUTTON_MOTION_THRESHOLD; - if (libevdev_get_id_vendor(device->evdev) == 0x5ac) /* Apple */ + if (libevdev_get_id_vendor(device->evdev) == VENDOR_ID_APPLE) tp->buttons.use_clickfinger = true; if (tp->buttons.is_clickpad && !tp->buttons.use_clickfinger) { diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c index 5db204f6..0755f2cd 100644 --- a/src/evdev-mt-touchpad.c +++ b/src/evdev-mt-touchpad.c @@ -757,17 +757,20 @@ tp_init_palmdetect(struct tp_dispatch *tp, tp->palm.right_edge = INT_MAX; tp->palm.left_edge = INT_MIN; - /* We don't know how big the touchpad is */ - if (device->abs.absinfo_x->resolution == 1) - return 0; - width = abs(device->abs.absinfo_x->maximum - device->abs.absinfo_x->minimum); - /* Enable palm detection on touchpads >= 80 mm. Anything smaller - probably won't need it, until we find out it does */ - if (width/device->abs.absinfo_x->resolution < 80) - return 0; + /* Apple touchpads are always big enough to warrant palm detection */ + if (evdev_device_get_id_vendor(device) != VENDOR_ID_APPLE) { + /* We don't know how big the touchpad is */ + if (device->abs.absinfo_x->resolution == 1) + return 0; + + /* Enable palm detection on touchpads >= 80 mm. Anything smaller + probably won't need it, until we find out it does */ + if (width/device->abs.absinfo_x->resolution < 80) + return 0; + } /* palm edges are 5% of the width on each side */ tp->palm.right_edge = device->abs.absinfo_x->maximum - width * 0.05; diff --git a/src/evdev-mt-touchpad.h b/src/evdev-mt-touchpad.h index 47791201..192c401a 100644 --- a/src/evdev-mt-touchpad.h +++ b/src/evdev-mt-touchpad.h @@ -33,6 +33,8 @@ #define TOUCHPAD_HISTORY_LENGTH 4 #define TOUCHPAD_MIN_SAMPLES 4 +#define VENDOR_ID_APPLE 0x5ac + enum touchpad_event { TOUCHPAD_EVENT_NONE = 0, TOUCHPAD_EVENT_MOTION = (1 << 0), diff --git a/test/litest-bcm5974.c b/test/litest-bcm5974.c index 10a9eb46..c7bd8573 100644 --- a/test/litest-bcm5974.c +++ b/test/litest-bcm5974.c @@ -65,13 +65,18 @@ static struct litest_device_interface interface = { }; static struct input_absinfo absinfo[] = { - { ABS_X, 1472, 5472, 0, 0, 75 }, - { ABS_Y, 1408, 4448, 0, 0, 129 }, - { ABS_PRESSURE, 0, 255, 0, 0, 0 }, - { ABS_TOOL_WIDTH, 0, 15, 0, 0, 0 }, - { ABS_MT_SLOT, 0, 1, 0, 0, 0 }, - { ABS_MT_POSITION_X, 1472, 5472, 0, 0, 75 }, - { ABS_MT_POSITION_Y, 1408, 4448, 0, 0, 129 }, + { ABS_X, -4824, 4824, 0, 0, 0 }, + { ABS_Y, -172, 4290, 0, 0, 0 }, + { ABS_PRESSURE, 0, 256, 5, 0, 0 }, + { ABS_TOOL_WIDTH, 0, 16, 0, 0, 0 }, + { ABS_MT_SLOT, 0, 15, 0, 0, 0 }, + { ABS_MT_POSITION_X, -4824, 4824, 17, 0, 0 }, + { ABS_MT_POSITION_Y, -172, 4290, 17, 0, 0 }, + { ABS_MT_ORIENTATION, -16384, 16384, 3276, 0, 0 }, + { ABS_MT_TOUCH_MAJOR, 0, 2048, 81, 0, 0 }, + { ABS_MT_TOUCH_MINOR, 0, 2048, 81, 0, 0 }, + { ABS_MT_WIDTH_MAJOR, 0, 2048, 81, 0, 0 }, + { ABS_MT_WIDTH_MINOR, 0, 2048, 81, 0, 0 }, { ABS_MT_TRACKING_ID, 0, 65535, 0, 0, 0 }, { ABS_MT_PRESSURE, 0, 255, 0, 0, 0 }, { .value = -1 }, diff --git a/test/touchpad.c b/test/touchpad.c index 9b232bf4..0de3cbb2 100644 --- a/test/touchpad.c +++ b/test/touchpad.c @@ -1247,6 +1247,9 @@ touchpad_has_palm_detect_size(struct litest_device *dev) double width, height; int rc; + if (libinput_device_get_id_vendor(dev->libinput_device) == 0x5ac) /* Apple */ + return 1; + rc = libinput_device_get_size(dev->libinput_device, &width, &height); return rc == 0 && width >= 80; |