diff --git a/0001-touchpad-fix-DWT-pairing-for-Macbook-Pro-2015.patch b/0001-touchpad-fix-DWT-pairing-for-Macbook-Pro-2015.patch new file mode 100644 index 0000000..3dbe228 --- /dev/null +++ b/0001-touchpad-fix-DWT-pairing-for-Macbook-Pro-2015.patch @@ -0,0 +1,627 @@ +From b3f11180e337d6cd7fd997685b65e5ed48acc661 Mon Sep 17 00:00:00 2001 +From: Caibin Chen +Date: Sun, 13 Dec 2015 22:27:55 -0800 +Subject: [PATCH libinput] touchpad: fix DWT pairing for Macbook Pro 2015 + +Label internal keyboards through the udev hwdb and only pair the internal +(usb) Apple touchpads with those keyboards labelled as such. + +https://bugs.freedesktop.org/show_bug.cgi?id=93367 + +Co-authored-by: Peter Hutterer +Signed-off-by: Peter Hutterer +Reviewed-by: Hans de Goede +--- + src/evdev-mt-touchpad.c | 9 + + src/evdev.c | 1 + + src/evdev.h | 1 + + src/libinput-util.h | 1 + + test/Makefile.am | 1 + + test/litest-device-apple-internal-keyboard.c | 239 +++++++++++++++++++++++++++ + test/litest.c | 2 + + test/litest.h | 1 + + test/touchpad.c | 87 ++++++++-- + udev/90-libinput-model-quirks.hwdb | 3 + + 10 files changed, 328 insertions(+), 17 deletions(-) + create mode 100644 test/litest-device-apple-internal-keyboard.c + +diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c +index d78a54b..aa123cd 100644 +--- a/src/evdev-mt-touchpad.c ++++ b/src/evdev-mt-touchpad.c +@@ -1285,6 +1285,8 @@ tp_want_dwt(struct evdev_device *touchpad, + { + unsigned int bus_tp = libevdev_get_id_bustype(touchpad->evdev), + bus_kbd = libevdev_get_id_bustype(keyboard->evdev); ++ unsigned int vendor_tp = evdev_device_get_id_vendor(touchpad); ++ unsigned int vendor_kbd = evdev_device_get_id_vendor(keyboard); + + if (tp_dwt_device_is_blacklisted(touchpad) || + tp_dwt_device_is_blacklisted(keyboard)) +@@ -1295,6 +1297,13 @@ tp_want_dwt(struct evdev_device *touchpad, + if (bus_tp == BUS_I8042 && bus_kbd != bus_tp) + return false; + ++ /* For Apple touchpads, always use its internal keyboard */ ++ if (vendor_tp == VENDOR_ID_APPLE) { ++ return vendor_kbd == vendor_tp && ++ keyboard->model_flags & ++ EVDEV_MODEL_APPLE_INTERNAL_KEYBOARD; ++ } ++ + /* everything else we don't really know, so we have to assume + they go together */ + +diff --git a/src/evdev.c b/src/evdev.c +index 3708072..a6d8a60 100644 +--- a/src/evdev.c ++++ b/src/evdev.c +@@ -1662,6 +1662,7 @@ evdev_read_model_flags(struct evdev_device *device) + { "LIBINPUT_MODEL_SYNAPTICS_SERIAL_TOUCHPAD", EVDEV_MODEL_SYNAPTICS_SERIAL_TOUCHPAD }, + { "LIBINPUT_MODEL_JUMPING_SEMI_MT", EVDEV_MODEL_JUMPING_SEMI_MT }, + { "LIBINPUT_MODEL_ELANTECH_TOUCHPAD", EVDEV_MODEL_ELANTECH_TOUCHPAD }, ++ { "LIBINPUT_MODEL_APPLE_INTERNAL_KEYBOARD", EVDEV_MODEL_APPLE_INTERNAL_KEYBOARD }, + { NULL, EVDEV_MODEL_DEFAULT }, + }; + const struct model_map *m = model_map; +diff --git a/src/evdev.h b/src/evdev.h +index 36bf7b4..97177ec 100644 +--- a/src/evdev.h ++++ b/src/evdev.h +@@ -108,6 +108,7 @@ enum evdev_device_model { + EVDEV_MODEL_JUMPING_SEMI_MT = (1 << 10), + EVDEV_MODEL_ELANTECH_TOUCHPAD = (1 << 11), + EVDEV_MODEL_LENOVO_X220_TOUCHPAD_FW81 = (1 << 12), ++ EVDEV_MODEL_APPLE_INTERNAL_KEYBOARD = (1 << 13), + }; + + struct mt_slot { +diff --git a/src/libinput-util.h b/src/libinput-util.h +index a627e5d..25de8e5 100644 +--- a/src/libinput-util.h ++++ b/src/libinput-util.h +@@ -38,6 +38,7 @@ + #define VENDOR_ID_APPLE 0x5ac + #define VENDOR_ID_WACOM 0x56a + #define VENDOR_ID_SYNAPTICS_SERIAL 0x002 ++#define PRODUCT_ID_APPLE_KBD_TOUCHPAD 0x273 + #define PRODUCT_ID_SYNAPTICS_SERIAL 0x007 + + /* The HW DPI rate we normalize to before calculating pointer acceleration */ +diff --git a/test/Makefile.am b/test/Makefile.am +index e4ed8e5..3b18cf4 100644 +--- a/test/Makefile.am ++++ b/test/Makefile.am +@@ -15,6 +15,7 @@ liblitest_la_SOURCES = \ + litest-int.h \ + litest-device-alps-semi-mt.c \ + litest-device-alps-dualpoint.c \ ++ litest-device-apple-internal-keyboard.c \ + litest-device-asus-rog-gladius.c \ + litest-device-atmel-hover.c \ + litest-device-bcm5974.c \ +diff --git a/test/litest-device-apple-internal-keyboard.c b/test/litest-device-apple-internal-keyboard.c +new file mode 100644 +index 0000000..c24403d +--- /dev/null ++++ b/test/litest-device-apple-internal-keyboard.c +@@ -0,0 +1,239 @@ ++/* ++ * Copyright © 2015 Red Hat, Inc. ++ * ++ * Permission is hereby granted, free of charge, to any person obtaining a ++ * copy of this software and associated documentation files (the "Software"), ++ * to deal in the Software without restriction, including without limitation ++ * the rights to use, copy, modify, merge, publish, distribute, sublicense, ++ * and/or sell copies of the Software, and to permit persons to whom the ++ * Software is furnished to do so, subject to the following conditions: ++ * ++ * The above copyright notice and this permission notice (including the next ++ * paragraph) shall be included in all copies or substantial portions of the ++ * Software. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ++ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ++ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ++ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ++ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ++ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER ++ * DEALINGS IN THE SOFTWARE. ++ */ ++ ++#if HAVE_CONFIG_H ++#include "config.h" ++#endif ++ ++#include "litest.h" ++#include "litest-int.h" ++ ++static void litest_apple_keyboard_setup(void) ++{ ++ struct litest_device *d = litest_create_device(LITEST_APPLE_KEYBOARD); ++ litest_set_current_device(d); ++} ++ ++static struct input_id input_id = { ++ .bustype = 0x3, ++ .vendor = 0x5ac, ++ .product = 0x273, ++}; ++ ++static int events[] = { ++ EV_KEY, KEY_ESC, ++ EV_KEY, KEY_1, ++ EV_KEY, KEY_2, ++ EV_KEY, KEY_3, ++ EV_KEY, KEY_4, ++ EV_KEY, KEY_5, ++ EV_KEY, KEY_6, ++ EV_KEY, KEY_7, ++ EV_KEY, KEY_8, ++ EV_KEY, KEY_9, ++ EV_KEY, KEY_0, ++ EV_KEY, KEY_MINUS, ++ EV_KEY, KEY_EQUAL, ++ EV_KEY, KEY_BACKSPACE, ++ EV_KEY, KEY_TAB, ++ EV_KEY, KEY_Q, ++ EV_KEY, KEY_W, ++ EV_KEY, KEY_E, ++ EV_KEY, KEY_R, ++ EV_KEY, KEY_T, ++ EV_KEY, KEY_Y, ++ EV_KEY, KEY_U, ++ EV_KEY, KEY_I, ++ EV_KEY, KEY_O, ++ EV_KEY, KEY_P, ++ EV_KEY, KEY_LEFTBRACE, ++ EV_KEY, KEY_RIGHTBRACE, ++ EV_KEY, KEY_ENTER, ++ EV_KEY, KEY_LEFTCTRL, ++ EV_KEY, KEY_A, ++ EV_KEY, KEY_S, ++ EV_KEY, KEY_D, ++ EV_KEY, KEY_F, ++ EV_KEY, KEY_G, ++ EV_KEY, KEY_H, ++ EV_KEY, KEY_J, ++ EV_KEY, KEY_K, ++ EV_KEY, KEY_L, ++ EV_KEY, KEY_SEMICOLON, ++ EV_KEY, KEY_APOSTROPHE, ++ EV_KEY, KEY_GRAVE, ++ EV_KEY, KEY_LEFTSHIFT, ++ EV_KEY, KEY_BACKSLASH, ++ EV_KEY, KEY_Z, ++ EV_KEY, KEY_X, ++ EV_KEY, KEY_C, ++ EV_KEY, KEY_V, ++ EV_KEY, KEY_B, ++ EV_KEY, KEY_N, ++ EV_KEY, KEY_M, ++ EV_KEY, KEY_COMMA, ++ EV_KEY, KEY_DOT, ++ EV_KEY, KEY_SLASH, ++ EV_KEY, KEY_RIGHTSHIFT, ++ EV_KEY, KEY_KPASTERISK, ++ EV_KEY, KEY_LEFTALT, ++ EV_KEY, KEY_SPACE, ++ EV_KEY, KEY_CAPSLOCK, ++ EV_KEY, KEY_F1, ++ EV_KEY, KEY_F2, ++ EV_KEY, KEY_F3, ++ EV_KEY, KEY_F4, ++ EV_KEY, KEY_F5, ++ EV_KEY, KEY_F6, ++ EV_KEY, KEY_F7, ++ EV_KEY, KEY_F8, ++ EV_KEY, KEY_F9, ++ EV_KEY, KEY_F10, ++ EV_KEY, KEY_NUMLOCK, ++ EV_KEY, KEY_SCROLLLOCK, ++ EV_KEY, KEY_KP7, ++ EV_KEY, KEY_KP8, ++ EV_KEY, KEY_KP9, ++ EV_KEY, KEY_KPMINUS, ++ EV_KEY, KEY_KP4, ++ EV_KEY, KEY_KP5, ++ EV_KEY, KEY_KP6, ++ EV_KEY, KEY_KPPLUS, ++ EV_KEY, KEY_KP1, ++ EV_KEY, KEY_KP2, ++ EV_KEY, KEY_KP3, ++ EV_KEY, KEY_KP0, ++ EV_KEY, KEY_KPDOT, ++ EV_KEY, KEY_ZENKAKUHANKAKU, ++ EV_KEY, KEY_102ND, ++ EV_KEY, KEY_F11, ++ EV_KEY, KEY_F12, ++ EV_KEY, KEY_RO, ++ EV_KEY, KEY_KATAKANA, ++ EV_KEY, KEY_HIRAGANA, ++ EV_KEY, KEY_HENKAN, ++ EV_KEY, KEY_KATAKANAHIRAGANA, ++ EV_KEY, KEY_MUHENKAN, ++ EV_KEY, KEY_KPJPCOMMA, ++ EV_KEY, KEY_KPENTER, ++ EV_KEY, KEY_RIGHTCTRL, ++ EV_KEY, KEY_KPSLASH, ++ EV_KEY, KEY_SYSRQ, ++ EV_KEY, KEY_RIGHTALT, ++ EV_KEY, KEY_HOME, ++ EV_KEY, KEY_UP, ++ EV_KEY, KEY_PAGEUP, ++ EV_KEY, KEY_LEFT, ++ EV_KEY, KEY_RIGHT, ++ EV_KEY, KEY_END, ++ EV_KEY, KEY_DOWN, ++ EV_KEY, KEY_PAGEDOWN, ++ EV_KEY, KEY_INSERT, ++ EV_KEY, KEY_DELETE, ++ EV_KEY, KEY_MUTE, ++ EV_KEY, KEY_VOLUMEDOWN, ++ EV_KEY, KEY_VOLUMEUP, ++ EV_KEY, KEY_POWER, ++ EV_KEY, KEY_KPEQUAL, ++ EV_KEY, KEY_PAUSE, ++ EV_KEY, KEY_SCALE, ++ EV_KEY, KEY_KPCOMMA, ++ EV_KEY, KEY_HANGEUL, ++ EV_KEY, KEY_HANJA, ++ EV_KEY, KEY_YEN, ++ EV_KEY, KEY_LEFTMETA, ++ EV_KEY, KEY_RIGHTMETA, ++ EV_KEY, KEY_COMPOSE, ++ EV_KEY, KEY_STOP, ++ EV_KEY, KEY_AGAIN, ++ EV_KEY, KEY_PROPS, ++ EV_KEY, KEY_UNDO, ++ EV_KEY, KEY_FRONT, ++ EV_KEY, KEY_COPY, ++ EV_KEY, KEY_OPEN, ++ EV_KEY, KEY_PASTE, ++ EV_KEY, KEY_FIND, ++ EV_KEY, KEY_CUT, ++ EV_KEY, KEY_HELP, ++ EV_KEY, KEY_CALC, ++ EV_KEY, KEY_SLEEP, ++ EV_KEY, KEY_WWW, ++ EV_KEY, KEY_COFFEE, ++ EV_KEY, KEY_BACK, ++ EV_KEY, KEY_FORWARD, ++ EV_KEY, KEY_EJECTCD, ++ EV_KEY, KEY_NEXTSONG, ++ EV_KEY, KEY_PLAYPAUSE, ++ EV_KEY, KEY_PREVIOUSSONG, ++ EV_KEY, KEY_STOPCD, ++ EV_KEY, KEY_REWIND, ++ EV_KEY, KEY_REFRESH, ++ EV_KEY, KEY_EDIT, ++ EV_KEY, KEY_SCROLLUP, ++ EV_KEY, KEY_SCROLLDOWN, ++ EV_KEY, KEY_KPLEFTPAREN, ++ EV_KEY, KEY_KPRIGHTPAREN, ++ EV_KEY, KEY_F13, ++ EV_KEY, KEY_F14, ++ EV_KEY, KEY_F15, ++ EV_KEY, KEY_F16, ++ EV_KEY, KEY_F17, ++ EV_KEY, KEY_F18, ++ EV_KEY, KEY_F19, ++ EV_KEY, KEY_F20, ++ EV_KEY, KEY_F21, ++ EV_KEY, KEY_F22, ++ EV_KEY, KEY_F23, ++ EV_KEY, KEY_F24, ++ EV_KEY, KEY_DASHBOARD, ++ EV_KEY, KEY_FASTFORWARD, ++ EV_KEY, KEY_BRIGHTNESSDOWN, ++ EV_KEY, KEY_BRIGHTNESSUP, ++ EV_KEY, KEY_SWITCHVIDEOMODE, ++ EV_KEY, KEY_KBDILLUMTOGGLE, ++ EV_KEY, KEY_KBDILLUMDOWN, ++ EV_KEY, KEY_KBDILLUMUP, ++ EV_KEY, KEY_UNKNOWN, ++ EV_KEY, KEY_FN, ++ EV_MSC, MSC_SCAN, ++ ++ EV_LED, LED_NUML, ++ EV_LED, LED_CAPSL, ++ EV_LED, LED_SCROLLL, ++ EV_LED, LED_COMPOSE, ++ EV_LED, LED_KANA, ++ -1, -1 ++}; ++ ++struct litest_test_device litest_apple_keyboard_device = { ++ .type = LITEST_APPLE_KEYBOARD, ++ .features = LITEST_KEYS, ++ .shortname = "apple_keyboard", ++ .setup = litest_apple_keyboard_setup, ++ .interface = NULL, ++ ++ .name = "Apple Inc. Apple Internal Keyboard / Trackpad", ++ .id = &input_id, ++ .events = events, ++ .absinfo = NULL, ++}; +diff --git a/test/litest.c b/test/litest.c +index fc188b6..0e3a815 100644 +--- a/test/litest.c ++++ b/test/litest.c +@@ -367,6 +367,7 @@ extern struct litest_test_device litest_magicpad_device; + extern struct litest_test_device litest_elantech_touchpad_device; + extern struct litest_test_device litest_mouse_gladius_device; + extern struct litest_test_device litest_mouse_wheel_click_angle_device; ++extern struct litest_test_device litest_apple_keyboard_device; + + struct litest_test_device* devices[] = { + &litest_synaptics_clickpad_device, +@@ -400,6 +401,7 @@ struct litest_test_device* devices[] = { + &litest_elantech_touchpad_device, + &litest_mouse_gladius_device, + &litest_mouse_wheel_click_angle_device, ++ &litest_apple_keyboard_device, + NULL, + }; + +diff --git a/test/litest.h b/test/litest.h +index 1268e10..7cd550e 100644 +--- a/test/litest.h ++++ b/test/litest.h +@@ -144,6 +144,7 @@ enum litest_device_type { + LITEST_ELANTECH_TOUCHPAD = -30, + LITEST_MOUSE_GLADIUS = -31, + LITEST_MOUSE_WHEEL_CLICK_ANGLE = -32, ++ LITEST_APPLE_KEYBOARD = -33, + }; + + enum litest_device_feature { +diff --git a/test/touchpad.c b/test/touchpad.c +index dab2781..4eb9418 100644 +--- a/test/touchpad.c ++++ b/test/touchpad.c +@@ -2282,6 +2282,18 @@ has_disable_while_typing(struct litest_device *device) + return libinput_device_config_dwt_is_available(device->libinput_device); + } + ++static inline struct litest_device * ++dwt_init_paired_keyboard(struct libinput *li, ++ struct litest_device *touchpad) ++{ ++ enum litest_device_type which = LITEST_KEYBOARD; ++ ++ if (libevdev_get_id_vendor(touchpad->evdev) == VENDOR_ID_APPLE) ++ which = LITEST_APPLE_KEYBOARD; ++ ++ return litest_add_device(li, which); ++} ++ + START_TEST(touchpad_dwt) + { + struct litest_device *touchpad = litest_current_device(); +@@ -2291,7 +2303,7 @@ START_TEST(touchpad_dwt) + if (!has_disable_while_typing(touchpad)) + return; + +- keyboard = litest_add_device(li, LITEST_KEYBOARD); ++ keyboard = dwt_init_paired_keyboard(li, touchpad); + litest_disable_tap(touchpad->libinput_device); + litest_drain_events(li); + +@@ -2333,7 +2345,7 @@ START_TEST(touchpad_dwt_enable_touch) + if (!has_disable_while_typing(touchpad)) + return; + +- keyboard = litest_add_device(li, LITEST_KEYBOARD); ++ keyboard = dwt_init_paired_keyboard(li, touchpad); + litest_disable_tap(touchpad->libinput_device); + litest_drain_events(li); + +@@ -2371,7 +2383,7 @@ START_TEST(touchpad_dwt_touch_hold) + if (!has_disable_while_typing(touchpad)) + return; + +- keyboard = litest_add_device(li, LITEST_KEYBOARD); ++ keyboard = dwt_init_paired_keyboard(li, touchpad); + litest_disable_tap(touchpad->libinput_device); + litest_drain_events(li); + +@@ -2408,7 +2420,7 @@ START_TEST(touchpad_dwt_key_hold) + if (!has_disable_while_typing(touchpad)) + return; + +- keyboard = litest_add_device(li, LITEST_KEYBOARD); ++ keyboard = dwt_init_paired_keyboard(li, touchpad); + litest_disable_tap(touchpad->libinput_device); + litest_drain_events(li); + +@@ -2436,7 +2448,7 @@ START_TEST(touchpad_dwt_type) + if (!has_disable_while_typing(touchpad)) + return; + +- keyboard = litest_add_device(li, LITEST_KEYBOARD); ++ keyboard = dwt_init_paired_keyboard(li, touchpad); + litest_disable_tap(touchpad->libinput_device); + litest_drain_events(li); + +@@ -2474,7 +2486,7 @@ START_TEST(touchpad_dwt_type_short_timeout) + if (!has_disable_while_typing(touchpad)) + return; + +- keyboard = litest_add_device(li, LITEST_KEYBOARD); ++ keyboard = dwt_init_paired_keyboard(li, touchpad); + litest_disable_tap(touchpad->libinput_device); + litest_drain_events(li); + +@@ -2511,7 +2523,7 @@ START_TEST(touchpad_dwt_tap) + if (!has_disable_while_typing(touchpad)) + return; + +- keyboard = litest_add_device(li, LITEST_KEYBOARD); ++ keyboard = dwt_init_paired_keyboard(li, touchpad); + litest_enable_tap(touchpad->libinput_device); + litest_drain_events(li); + +@@ -2541,7 +2553,7 @@ START_TEST(touchpad_dwt_tap_drag) + if (!has_disable_while_typing(touchpad)) + return; + +- keyboard = litest_add_device(li, LITEST_KEYBOARD); ++ keyboard = dwt_init_paired_keyboard(li, touchpad); + litest_enable_tap(touchpad->libinput_device); + litest_drain_events(li); + +@@ -2575,7 +2587,7 @@ START_TEST(touchpad_dwt_click) + if (!has_disable_while_typing(touchpad)) + return; + +- keyboard = litest_add_device(li, LITEST_KEYBOARD); ++ keyboard = dwt_init_paired_keyboard(li, touchpad); + litest_disable_tap(touchpad->libinput_device); + litest_drain_events(li); + +@@ -2608,7 +2620,7 @@ START_TEST(touchpad_dwt_edge_scroll) + + litest_enable_edge_scroll(touchpad); + +- keyboard = litest_add_device(li, LITEST_KEYBOARD); ++ keyboard = dwt_init_paired_keyboard(li, touchpad); + litest_drain_events(li); + + litest_keyboard_key(keyboard, KEY_A, true); +@@ -2655,7 +2667,7 @@ START_TEST(touchpad_dwt_edge_scroll_interrupt) + + litest_enable_edge_scroll(touchpad); + +- keyboard = litest_add_device(li, LITEST_KEYBOARD); ++ keyboard = dwt_init_paired_keyboard(li, touchpad); + litest_drain_events(li); + + litest_touch_down(touchpad, 0, 99, 20); +@@ -2779,7 +2791,7 @@ START_TEST(touchpad_dwt_disabled) + + disable_dwt(touchpad); + +- keyboard = litest_add_device(li, LITEST_KEYBOARD); ++ keyboard = dwt_init_paired_keyboard(li, touchpad); + litest_disable_tap(touchpad->libinput_device); + litest_drain_events(li); + +@@ -2808,7 +2820,7 @@ START_TEST(touchpad_dwt_disable_during_touch) + + enable_dwt(touchpad); + +- keyboard = litest_add_device(li, LITEST_KEYBOARD); ++ keyboard = dwt_init_paired_keyboard(li, touchpad); + litest_disable_tap(touchpad->libinput_device); + litest_drain_events(li); + +@@ -2843,7 +2855,7 @@ START_TEST(touchpad_dwt_disable_before_touch) + + enable_dwt(touchpad); + +- keyboard = litest_add_device(li, LITEST_KEYBOARD); ++ keyboard = dwt_init_paired_keyboard(li, touchpad); + litest_disable_tap(touchpad->libinput_device); + litest_drain_events(li); + +@@ -2874,7 +2886,7 @@ START_TEST(touchpad_dwt_enable_during_touch) + + disable_dwt(touchpad); + +- keyboard = litest_add_device(li, LITEST_KEYBOARD); ++ keyboard = dwt_init_paired_keyboard(li, touchpad); + litest_disable_tap(touchpad->libinput_device); + litest_drain_events(li); + +@@ -2908,7 +2920,7 @@ START_TEST(touchpad_dwt_enable_before_touch) + + disable_dwt(touchpad); + +- keyboard = litest_add_device(li, LITEST_KEYBOARD); ++ keyboard = dwt_init_paired_keyboard(li, touchpad); + litest_disable_tap(touchpad->libinput_device); + litest_drain_events(li); + +@@ -2939,7 +2951,7 @@ START_TEST(touchpad_dwt_enable_during_tap) + litest_enable_tap(touchpad->libinput_device); + disable_dwt(touchpad); + +- keyboard = litest_add_device(li, LITEST_KEYBOARD); ++ keyboard = dwt_init_paired_keyboard(li, touchpad); + litest_drain_events(li); + + litest_keyboard_key(keyboard, KEY_A, true); +@@ -2964,6 +2976,46 @@ START_TEST(touchpad_dwt_enable_during_tap) + litest_delete_device(keyboard); + } + END_TEST ++ ++START_TEST(touchpad_dwt_apple) ++{ ++ struct litest_device *touchpad = litest_current_device(); ++ struct litest_device *keyboard, *apple_keyboard; ++ struct libinput *li = touchpad->libinput; ++ ++ ck_assert(has_disable_while_typing(touchpad)); ++ ++ /* Only the apple keyboard can trigger DWT */ ++ keyboard = litest_add_device(li, LITEST_KEYBOARD); ++ litest_drain_events(li); ++ ++ litest_keyboard_key(keyboard, KEY_A, true); ++ litest_keyboard_key(keyboard, KEY_A, false); ++ litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); ++ ++ litest_touch_down(touchpad, 0, 50, 50); ++ litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1); ++ litest_touch_up(touchpad, 0); ++ litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); ++ ++ apple_keyboard = litest_add_device(li, LITEST_APPLE_KEYBOARD); ++ litest_drain_events(li); ++ ++ litest_keyboard_key(apple_keyboard, KEY_A, true); ++ litest_keyboard_key(apple_keyboard, KEY_A, false); ++ litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); ++ ++ litest_touch_down(touchpad, 0, 50, 50); ++ litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10, 1); ++ litest_touch_up(touchpad, 0); ++ libinput_dispatch(li); ++ litest_assert_empty_queue(li); ++ ++ litest_delete_device(keyboard); ++ litest_delete_device(apple_keyboard); ++} ++END_TEST ++ + static int + has_thumb_detect(struct litest_device *dev) + { +@@ -3632,6 +3684,7 @@ litest_setup_tests(void) + litest_add("touchpad:dwt", touchpad_dwt_enable_during_touch, LITEST_TOUCHPAD, LITEST_ANY); + litest_add("touchpad:dwt", touchpad_dwt_enable_before_touch, LITEST_TOUCHPAD, LITEST_ANY); + litest_add("touchpad:dwt", touchpad_dwt_enable_during_tap, LITEST_TOUCHPAD, LITEST_ANY); ++ litest_add_for_device("touchpad:dwt", touchpad_dwt_apple, LITEST_BCM5974); + + litest_add("touchpad:thumb", touchpad_thumb_begin_no_motion, LITEST_CLICKPAD, LITEST_ANY); + litest_add("touchpad:thumb", touchpad_thumb_update_no_motion, LITEST_CLICKPAD, LITEST_ANY); +diff --git a/udev/90-libinput-model-quirks.hwdb b/udev/90-libinput-model-quirks.hwdb +index 814ec40..baebcb3 100644 +--- a/udev/90-libinput-model-quirks.hwdb ++++ b/udev/90-libinput-model-quirks.hwdb +@@ -34,6 +34,9 @@ libinput:touchpad:input:b0005v05ACp* + LIBINPUT_MODEL_APPLE_TOUCHPAD=1 + LIBINPUT_ATTR_SIZE_HINT=104x75 + ++libinput:name:*Apple Inc. Apple Internal Keyboard*:dmi:* ++ LIBINPUT_MODEL_APPLE_INTERNAL_KEYBOARD=1 ++ + ########################################## + # Elantech + ########################################## +-- +2.5.0 + diff --git a/libinput.spec b/libinput.spec index 722e516..0b9aba2 100644 --- a/libinput.spec +++ b/libinput.spec @@ -5,7 +5,7 @@ Name: libinput Version: 1.1.4 -Release: 1%{?gitdate:.%{gitdate}git%{gitversion}}%{?dist} +Release: 2%{?gitdate:.%{gitdate}git%{gitversion}}%{?dist} Summary: Input device library License: MIT @@ -21,6 +21,8 @@ Source0: http://www.freedesktop.org/software/libinput/libinput-%{version} # Not upstream, keep until kernel 4.2 or 4.1.x with dbf3c37086 Patch01: 0001-touchpad-serial-synaptics-need-to-fake-new-touches-o.patch +Patch02: 0001-touchpad-fix-DWT-pairing-for-Macbook-Pro-2015.patch + BuildRequires: git BuildRequires: autoconf automake libtool pkgconfig BuildRequires: libevdev-devel @@ -97,6 +99,9 @@ find $RPM_BUILD_ROOT -name '*.la' -delete %changelog +* Mon Jan 11 2016 Peter Hutterer 1.1.4-2 +- fix disable-while-typing on macbooks + * Tue Dec 22 2015 Peter Hutterer 1.1.4-1 - libinput 1.1.4