configure.ac | 4 src/evdev-mt-touchpad-buttons.c | 4 src/evdev-mt-touchpad-gestures.c | 14 +- src/evdev-mt-touchpad.c | 13 + src/evdev.c | 2 src/evdev.h | 2 src/libinput-util.h | 1 src/libinput.c | 2 test/Makefile.am | 2 test/device.c | 20 ++ test/litest-device-acer-hawaii-keyboard.c | 208 ++++++++++++++++++++++++++++++ test/litest-device-acer-hawaii-touchpad.c | 113 ++++++++++++++++ test/litest-device-alps-dualpoint.c | 2 test/litest-device-magic-trackpad.c | 11 + test/litest-device-synaptics-i2c.c | 2 test/litest.c | 4 test/litest.h | 2 test/touchpad.c | 57 +++++++- tools/ptraccel-debug.c | 11 + tools/shared.c | 2 udev/90-libinput-model-quirks.hwdb | 8 + 21 files changed, 454 insertions(+), 30 deletions(-)
New commits: commit 73b39cee3baa7d284153d8fa0d6f8c387b39f289 Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Fri Jan 13 17:39:11 2017 +1000 configure.ac: libinput 1.5.4 Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> diff --git a/configure.ac b/configure.ac index b30a6fd..9f5ef6a 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ AC_PREREQ([2.64]) m4_define([libinput_major_version], [1]) m4_define([libinput_minor_version], [5]) -m4_define([libinput_micro_version], [3]) +m4_define([libinput_micro_version], [4]) m4_define([libinput_version], [libinput_major_version.libinput_minor_version.libinput_micro_version]) @@ -35,7 +35,7 @@ AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz]) # b) If interfaces have been changed or added, but binary compatibility has # been preserved, change to C+1:0:A+1 # c) If the interface is the same as the previous version, change to C:R+1:A -LIBINPUT_LT_VERSION=20:4:10 +LIBINPUT_LT_VERSION=20:5:10 AC_SUBST(LIBINPUT_LT_VERSION) AM_SILENT_RULES([yes]) commit 089ab53e8a40ac58559c2ab50baf57dd45091346 Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Tue Jan 10 08:20:52 2017 +1000 udev: mark Asus X555LAB as touchpad with visible marker https://bugs.freedesktop.org/show_bug.cgi?id=99200 Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> Reviewed-by: Hans de Goede <hdego...@redhat.com> (cherry picked from commit 72e01485c0161e8382546c4f0edbb8a3317d0207) diff --git a/udev/90-libinput-model-quirks.hwdb b/udev/90-libinput-model-quirks.hwdb index e467e59..04bdf9a 100644 --- a/udev/90-libinput-model-quirks.hwdb +++ b/udev/90-libinput-model-quirks.hwdb @@ -42,6 +42,12 @@ libinput:mouse:input:b0005v05ACp030D* LIBINPUT_MODEL_APPLE_MAGICMOUSE=1 ########################################## +# Asus +########################################## +libinput:name:*ETPS/2 Elantech Touchpad*:dmi:*svnASUSTeKCOMPUTERINC.:pnX555LAB:* + LIBINPUT_MODEL_TOUCHPAD_VISIBLE_MARKER=1 + +########################################## # Cyborg ########################################## # Saitek Cyborg R.A.T.5 Mouse commit aee85d3d425fb31431fe19b68df0f34ca393ef38 Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Mon Jan 9 11:27:06 2017 +1000 touchpad: add a model tag to mark touchpads with visible marker We used to mark dell touchpads this way but let's make this more generic. Nothing else used the dell touchpad model flag, so we can simply replace it. Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> Reviewed-by: Hans de Goede <hdego...@redhat.com> (cherry picked from commit 43ba2dbb30b33f2367de20fb33fde8083bd3c7c8) diff --git a/src/evdev-mt-touchpad-buttons.c b/src/evdev-mt-touchpad-buttons.c index b59cf13..f4fe6b7 100644 --- a/src/evdev-mt-touchpad-buttons.c +++ b/src/evdev-mt-touchpad-buttons.c @@ -569,10 +569,8 @@ tp_init_softbuttons(struct tp_dispatch *tp, * * On touchpads with visible markings we reduce the size of the * middle button since users have a visual guide. - * - * All Dell touchpads appear to have a middle marker. */ - if (tp->device->model_flags & EVDEV_MODEL_DELL_TOUCHPAD) { + if (tp->device->model_flags & EVDEV_MODEL_TOUCHPAD_VISIBLE_MARKER) { mm.x = width/2 - 5; /* 10mm wide */ edges = evdev_device_mm_to_units(device, &mm); mb_le = edges.x; diff --git a/src/evdev.c b/src/evdev.c index b29c328..103f5b2 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -2174,7 +2174,7 @@ evdev_read_model_flags(struct evdev_device *device) MODEL(CYAPA), MODEL(HP_STREAM11_TOUCHPAD), MODEL(LENOVO_T450_TOUCHPAD), - MODEL(DELL_TOUCHPAD), + MODEL(TOUCHPAD_VISIBLE_MARKER), MODEL(TRACKBALL), MODEL(APPLE_MAGICMOUSE), MODEL(HP8510_TOUCHPAD), diff --git a/src/evdev.h b/src/evdev.h index 73b4774..e2e68a5 100644 --- a/src/evdev.h +++ b/src/evdev.h @@ -116,7 +116,7 @@ enum evdev_device_model { EVDEV_MODEL_CYAPA = (1 << 15), EVDEV_MODEL_HP_STREAM11_TOUCHPAD = (1 << 16), EVDEV_MODEL_LENOVO_T450_TOUCHPAD= (1 << 17), - EVDEV_MODEL_DELL_TOUCHPAD = (1 << 18), + EVDEV_MODEL_TOUCHPAD_VISIBLE_MARKER = (1 << 18), EVDEV_MODEL_TRACKBALL = (1 << 19), EVDEV_MODEL_APPLE_MAGICMOUSE = (1 << 20), EVDEV_MODEL_HP8510_TOUCHPAD = (1 << 21), diff --git a/test/litest-device-alps-dualpoint.c b/test/litest-device-alps-dualpoint.c index 5020427..087facf 100644 --- a/test/litest-device-alps-dualpoint.c +++ b/test/litest-device-alps-dualpoint.c @@ -108,7 +108,7 @@ static const char udev_rule[] = "ENV{ID_INPUT_TOUCHPAD}==\"\", GOTO=\"touchpad_end\"\n" "\n" "ATTRS{name}==\"litest AlpsPS/2 ALPS DualPoint TouchPad\"," -" ENV{LIBINPUT_MODEL_DELL_TOUCHPAD}=\"1\"\n" +" ENV{LIBINPUT_MODEL_TOUCHPAD_VISIBLE_MARKER}=\"1\"\n" "\n" "LABEL=\"touchpad_end\""; diff --git a/test/litest-device-synaptics-i2c.c b/test/litest-device-synaptics-i2c.c index be826a4..b498ab7 100644 --- a/test/litest-device-synaptics-i2c.c +++ b/test/litest-device-synaptics-i2c.c @@ -94,7 +94,7 @@ static const char udev_rule[] = "ENV{ID_INPUT_TOUCHPAD}==\"\", GOTO=\"touchpad_end\"\n" "\n" "ATTRS{name}==\"litest DLL0704:01 06CB:76AD Touchpad\"," -" ENV{LIBINPUT_MODEL_DELL_TOUCHPAD}=\"1\"\n" +" ENV{LIBINPUT_MODEL_TOUCHPAD_VISIBLE_MARKER}=\"1\"\n" "\n" "LABEL=\"touchpad_end\""; diff --git a/udev/90-libinput-model-quirks.hwdb b/udev/90-libinput-model-quirks.hwdb index eb74f61..e467e59 100644 --- a/udev/90-libinput-model-quirks.hwdb +++ b/udev/90-libinput-model-quirks.hwdb @@ -53,7 +53,7 @@ libinput:mouse:input:b0003v06A3p0CD5* ########################################## libinput:name:SynPS/2 Synaptics TouchPad:dmi:*svnDellInc.:* libinput:name:* Touchpad:dmi:*svnDellInc.:* - LIBINPUT_MODEL_DELL_TOUCHPAD=1 + LIBINPUT_MODEL_TOUCHPAD_VISIBLE_MARKER=1 ########################################## # Elantech commit 0e820d466f8ff72e3a923ecfdb7ca10fc386d8b0 Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Wed Jan 11 09:59:59 2017 +1000 Remove a couple of double semicolons Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> (cherry picked from commit 7b3e583abe4b0213ec25294c06272d958f288cfc) diff --git a/src/libinput.c b/src/libinput.c index 1e97ad1..4daa11d 100644 --- a/src/libinput.c +++ b/src/libinput.c @@ -1555,7 +1555,7 @@ libinput_init(struct libinput *libinput, assert(interface->open_restricted != NULL); assert(interface->close_restricted != NULL); - libinput->epoll_fd = epoll_create1(EPOLL_CLOEXEC);; + libinput->epoll_fd = epoll_create1(EPOLL_CLOEXEC); if (libinput->epoll_fd < 0) return -1; diff --git a/test/touchpad.c b/test/touchpad.c index c3204a3..0f6ab8b 100644 --- a/test/touchpad.c +++ b/test/touchpad.c @@ -2079,7 +2079,7 @@ START_TEST(touchpad_hover_down_up) litest_hover_start(dev, 0, 50, 50); litest_hover_start(dev, 1, 50, 50); litest_touch_down(dev, 2, 50, 50); - litest_pop_event_frame(dev);; + litest_pop_event_frame(dev); litest_assert_empty_queue(li); @@ -2088,7 +2088,7 @@ START_TEST(touchpad_hover_down_up) litest_hover_move(dev, 0, 55, 55); litest_hover_end(dev, 1); litest_touch_up(dev, 2); - litest_pop_event_frame(dev);; + litest_pop_event_frame(dev); litest_assert_empty_queue(li); @@ -2112,14 +2112,14 @@ START_TEST(touchpad_hover_2fg_noevent) litest_push_event_frame(dev); litest_hover_start(dev, 0, 25, 25); litest_hover_start(dev, 1, 50, 50); - litest_pop_event_frame(dev);; + litest_pop_event_frame(dev); litest_hover_move_two_touches(dev, 25, 25, 50, 50, 50, 50, 10, 0); litest_push_event_frame(dev); litest_hover_end(dev, 0); litest_hover_end(dev, 1); - litest_pop_event_frame(dev);; + litest_pop_event_frame(dev); litest_assert_empty_queue(li); } @@ -2137,19 +2137,19 @@ START_TEST(touchpad_hover_2fg_1fg_down) litest_push_event_frame(dev); litest_hover_start(dev, 0, 25, 25); litest_touch_down(dev, 1, 50, 50); - litest_pop_event_frame(dev);; + litest_pop_event_frame(dev); for (i = 0; i < 10; i++) { litest_push_event_frame(dev); litest_hover_move(dev, 0, 25 + 5 * i, 25 + 5 * i); litest_touch_move(dev, 1, 50 + 5 * i, 50 - 5 * i); - litest_pop_event_frame(dev);; + litest_pop_event_frame(dev); } litest_push_event_frame(dev); litest_hover_end(dev, 0); litest_touch_up(dev, 1); - litest_pop_event_frame(dev);; + litest_pop_event_frame(dev); litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); } commit fd7c27c8b86a3e38922407d6636ea3f358318b57 Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Tue Jan 3 07:58:18 2017 +1000 tools: add allowed range to --set-speed help output Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> (cherry picked from commit 16bf0deb233fb374de318b0629dc5ad502319387) diff --git a/tools/shared.c b/tools/shared.c index 3ab4b68..e520303 100644 --- a/tools/shared.c +++ b/tools/shared.c @@ -102,7 +102,7 @@ tools_usage() "--set-scroll-method=[none|twofinger|edge|button] ... set the desired scroll method\n" "--set-scroll-button=BTN_MIDDLE ... set the button to the given button code\n" "--set-profile=[adaptive|flat].... set pointer acceleration profile\n" - "--set-speed=<value>.... set pointer acceleration speed\n" + "--set-speed=<value>.... set pointer acceleration speed (allowed range [-1, 1]) \n" "--set-tap-map=[lrm|lmr] ... set button mapping for tapping\n" "\n" "These options apply to all applicable devices, if a feature\n" commit 0a910a8ae64f6db1cbf2c800422bae9becd8233d Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Tue Dec 20 10:36:37 2016 +1000 gestures: if fingers don't move, force a gesture by finger position If the fingers rest on the touchpad without moving for a timeout, switch to pinch or swipe based on the finger position. We already switched to two-finger scrolling based on the timeout, now we also do so for 3 and 4 finger gestures. This gives us better reaction to small movements. This also fixes previously unreachable code: the test for the finger position required at least 3 fingers down but was within a condition that ensured only 2 fingers were down. This was introduced in 11917061fe320c. Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> Reviewed-by: Hans de Goede <hdego...@redhat.com> (cherry picked from commit af1e6c08acf97c7c4911d13294f6fa1d68d07fab) diff --git a/src/evdev-mt-touchpad-gestures.c b/src/evdev-mt-touchpad-gestures.c index 8b854b3..d1e1f55 100644 --- a/src/evdev-mt-touchpad-gestures.c +++ b/src/evdev-mt-touchpad-gestures.c @@ -331,21 +331,23 @@ tp_gesture_handle_state_unknown(struct tp_dispatch *tp, uint64_t time) int yres = tp->device->abs.absinfo_y->resolution; int vert_distance; - /* for two-finger gestures, if the fingers stay unmoving for a - * while, assume (slow) scroll */ - if (tp->gesture.finger_count == 2) { - if (time > (tp->gesture.initial_time + DEFAULT_GESTURE_2FG_SCROLL_TIMEOUT)) { + if (time > (tp->gesture.initial_time + DEFAULT_GESTURE_2FG_SCROLL_TIMEOUT)) { + /* for two-finger gestures, if the fingers stay unmoving for a + * while, assume (slow) scroll */ + if (tp->gesture.finger_count == 2) { tp_gesture_set_scroll_buildup(tp); return GESTURE_STATE_SCROLL; } - /* Else check if one finger is > 20mm below the others */ + /* for 3+ finger gestures, check if one finger is > 20mm + below the others */ vert_distance = abs(first->point.y - second->point.y); if (vert_distance > 20 * yres && - tp->gesture.finger_count > 2 && tp->gesture.enabled) { tp_gesture_init_pinch(tp); return GESTURE_STATE_PINCH; + } else { + return GESTURE_STATE_SWIPE; } } commit a89619d7922e9cf0121e65d0c3c855efac0340c0 Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Mon Dec 19 15:36:34 2016 +1000 touchpad: if an external touchpad and keyboard share a VID/PID assume dwt This requires to expand the blacklisting to be a bit more specific so we don't initialize dwt config on devices that won't need it. https://bugs.freedesktop.org/show_bug.cgi?id=99140 Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> Reviewed-by: Hans de Goede <hdego...@redhat.com> (cherry picked from commit 0a82d2fa39c8ef5127afc8e6b4a8715e7879bc52) Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c index 05e2ae5..e29d7b7 100644 --- a/src/evdev-mt-touchpad.c +++ b/src/evdev-mt-touchpad.c @@ -1450,12 +1450,14 @@ static bool tp_dwt_device_is_blacklisted(struct evdev_device *device) { unsigned int bus = libevdev_get_id_bustype(device->evdev); + unsigned int vendor_id = libevdev_get_id_vendor(device->evdev); /* evemu will set the right bus type */ - if (bus == BUS_VIRTUAL) + if (bus == BUS_VIRTUAL || bus == BUS_BLUETOOTH) return true; - if (device->tags & EVDEV_TAG_EXTERNAL_TOUCHPAD) + /* Wacom doesn't have devices that need dwt */ + if (vendor_id == VENDOR_ID_WACOM) return true; return false; @@ -1469,11 +1471,18 @@ tp_want_dwt(struct evdev_device *touchpad, 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); + unsigned int product_tp = evdev_device_get_id_product(touchpad); + unsigned int product_kbd = evdev_device_get_id_product(keyboard); if (tp_dwt_device_is_blacklisted(touchpad) || tp_dwt_device_is_blacklisted(keyboard)) return false; + /* External touchpads with the same vid/pid as the keyboard are + considered a happy couple */ + if (touchpad->tags & EVDEV_TAG_EXTERNAL_TOUCHPAD) + return vendor_tp == vendor_kbd && product_tp == product_kbd; + /* If the touchpad is on serio, the keyboard is too, so ignore any other devices */ if (bus_tp == BUS_I8042 && bus_kbd != bus_tp) diff --git a/src/libinput-util.h b/src/libinput-util.h index 3fd3747..ba09ab6 100644 --- a/src/libinput-util.h +++ b/src/libinput-util.h @@ -42,6 +42,7 @@ #include "libinput.h" #define VENDOR_ID_APPLE 0x5ac +#define VENDOR_ID_CHICONY 0x4f2 #define VENDOR_ID_LOGITECH 0x46d #define VENDOR_ID_WACOM 0x56a #define VENDOR_ID_SYNAPTICS_SERIAL 0x002 diff --git a/test/Makefile.am b/test/Makefile.am index 3f63a7a..378d001 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -13,6 +13,8 @@ noinst_LTLIBRARIES = liblitest.la liblitest_la_SOURCES = \ litest.h \ litest-int.h \ + litest-device-acer-hawaii-keyboard.c \ + litest-device-acer-hawaii-touchpad.c \ litest-device-alps-semi-mt.c \ litest-device-alps-dualpoint.c \ litest-device-anker-mouse-kbd.c \ diff --git a/test/litest-device-acer-hawaii-keyboard.c b/test/litest-device-acer-hawaii-keyboard.c new file mode 100644 index 0000000..1691e9c --- /dev/null +++ b/test/litest-device-acer-hawaii-keyboard.c @@ -0,0 +1,208 @@ +/* + * Copyright © 2016 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. + */ + +#include "config.h" + +#include "litest.h" +#include "litest-int.h" + +static void litest_keyboard_setup(void) +{ + struct litest_device *d = litest_create_device(LITEST_ACER_HAWAII_KEYBOARD); + litest_set_current_device(d); +} + +static struct input_id input_id = { + .bustype = 0x3, + .vendor = 0x4f2, + .product = 0x1558, +}; + +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_LINEFEED, + 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_MACRO, + EV_KEY, KEY_MUTE, + EV_KEY, KEY_VOLUMEDOWN, + EV_KEY, KEY_VOLUMEUP, + EV_KEY, KEY_POWER, + EV_KEY, KEY_KPEQUAL, + EV_KEY, KEY_KPPLUSMINUS, + 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_MENU, + EV_KEY, KEY_CALC, + EV_KEY, KEY_SETUP, + EV_KEY, KEY_SLEEP, + EV_KEY, KEY_WAKEUP, + EV_KEY, KEY_SCREENLOCK, + EV_KEY, KEY_DIRECTION, + EV_KEY, KEY_CYCLEWINDOWS, + EV_KEY, KEY_MAIL, + EV_KEY, KEY_BOOKMARKS, + EV_KEY, KEY_COMPUTER, + EV_KEY, KEY_BACK, + EV_KEY, KEY_FORWARD, + EV_KEY, KEY_NEXTSONG, + EV_KEY, KEY_PLAYPAUSE, + EV_KEY, KEY_PREVIOUSSONG, + EV_KEY, KEY_STOPCD, + EV_KEY, KEY_HOMEPAGE, + EV_KEY, KEY_REFRESH, + EV_KEY, KEY_F14, + EV_KEY, KEY_F15, + EV_KEY, KEY_SEARCH, + EV_KEY, KEY_MEDIA, + EV_KEY, KEY_FN, + -1, -1, +}; + +struct litest_test_device litest_acer_hawaii_keyboard_device = { + .type = LITEST_ACER_HAWAII_KEYBOARD, + .features = LITEST_KEYS, + .shortname = "hawaii-keyboard", + .setup = litest_keyboard_setup, + .interface = NULL, + + .name = "Chicony ACER Hawaii Keyboard", + .id = &input_id, + .events = events, + .absinfo = NULL, +}; diff --git a/test/litest-device-acer-hawaii-touchpad.c b/test/litest-device-acer-hawaii-touchpad.c new file mode 100644 index 0000000..1dcd4ce --- /dev/null +++ b/test/litest-device-acer-hawaii-touchpad.c @@ -0,0 +1,113 @@ +/* + * Copyright © 2016 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. + */ + +#include "config.h" + +#include "litest.h" +#include "litest-int.h" + +static void +litest_touchpad_setup(void) +{ + struct litest_device *d = litest_create_device(LITEST_ACER_HAWAII_TOUCHPAD); + litest_set_current_device(d); +} + +static struct input_event down[] = { + { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, + { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, + { .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN }, + { .type = EV_ABS, .code = ABS_MT_TRACKING_ID, .value = LITEST_AUTO_ASSIGN }, + { .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN }, + { .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN }, + { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, + { .type = -1, .code = -1 }, +}; + +static struct input_event move[] = { + { .type = EV_ABS, .code = ABS_MT_SLOT, .value = LITEST_AUTO_ASSIGN }, + { .type = EV_ABS, .code = ABS_X, .value = LITEST_AUTO_ASSIGN }, + { .type = EV_ABS, .code = ABS_Y, .value = LITEST_AUTO_ASSIGN }, + { .type = EV_ABS, .code = ABS_MT_POSITION_X, .value = LITEST_AUTO_ASSIGN }, + { .type = EV_ABS, .code = ABS_MT_POSITION_Y, .value = LITEST_AUTO_ASSIGN }, + { .type = EV_SYN, .code = SYN_REPORT, .value = 0 }, + { .type = -1, .code = -1 }, +}; + +static struct litest_device_interface interface = { + .touch_down_events = down, + .touch_move_events = move, +}; + +static struct input_id input_id = { + .bustype = 0x3, + .vendor = 0x4f2, + .product = 0x1558, +}; + +static int events[] = { + EV_KEY, BTN_LEFT, + EV_KEY, BTN_TOOL_FINGER, + EV_KEY, BTN_TOOL_QUINTTAP, + EV_KEY, BTN_TOUCH, + EV_KEY, BTN_TOOL_DOUBLETAP, + EV_KEY, BTN_TOOL_TRIPLETAP, + EV_KEY, BTN_TOOL_QUADTAP, + INPUT_PROP_MAX, INPUT_PROP_POINTER, + INPUT_PROP_MAX, INPUT_PROP_BUTTONPAD, + -1, -1, +}; + +static struct input_absinfo absinfo[] = { + { ABS_X, 0, 1151, 0, 0, 12 }, + { ABS_Y, 0, 738, 0, 0, 14 }, + { ABS_MT_SLOT, 0, 14, 0, 0, 0 }, + { ABS_MT_POSITION_X, 0, 1151, 0, 0, 12 }, + { ABS_MT_POSITION_Y, 0, 738, 0, 0, 14 }, + { ABS_MT_TRACKING_ID, 0, 65535, 0, 0, 0 }, + { .value = -1 } +}; + +static const char udev_rule[] = +"ACTION==\"remove\", GOTO=\"touchpad_end\"\n" +"KERNEL!=\"event*\", GOTO=\"touchpad_end\"\n" +"ENV{ID_INPUT_TOUCHPAD}==\"\", GOTO=\"touchpad_end\"\n" +"\n" +"ATTRS{name}==\"litest Chicony ACER Hawaii Keyboard Touchpad\"," +" ENV{ID_INPUT_TOUCHPAD_INTEGRATION}=\"external\"\n" +"\n" +"LABEL=\"touchpad_end\""; + +struct litest_test_device litest_acer_hawaii_touchpad_device = { + .type = LITEST_ACER_HAWAII_TOUCHPAD, + .features = LITEST_TOUCHPAD | LITEST_CLICKPAD | LITEST_BUTTON, + .shortname = "hawaii-touchpad", + .setup = litest_touchpad_setup, + .interface = &interface, + + .name = "Chicony ACER Hawaii Keyboard Touchpad", + .id = &input_id, + .events = events, + .absinfo = absinfo, + .udev_rule = udev_rule, +}; diff --git a/test/litest.c b/test/litest.c index b74f905..6e635d0 100644 --- a/test/litest.c +++ b/test/litest.c @@ -406,6 +406,8 @@ extern struct litest_test_device litest_wacom_cintiq_13hdt_pen_device; extern struct litest_test_device litest_wacom_cintiq_13hdt_pad_device; extern struct litest_test_device litest_wacom_hid4800_tablet_device; extern struct litest_test_device litest_mouse_wheel_click_count_device; +extern struct litest_test_device litest_acer_hawaii_keyboard_device; +extern struct litest_test_device litest_acer_hawaii_touchpad_device; struct litest_test_device* devices[] = { &litest_synaptics_clickpad_device, @@ -463,6 +465,8 @@ struct litest_test_device* devices[] = { &litest_wacom_cintiq_13hdt_pad_device, &litest_wacom_hid4800_tablet_device, &litest_mouse_wheel_click_count_device, + &litest_acer_hawaii_keyboard_device, + &litest_acer_hawaii_touchpad_device, NULL, }; diff --git a/test/litest.h b/test/litest.h index d52ebd2..ea9c7f2 100644 --- a/test/litest.h +++ b/test/litest.h @@ -225,6 +225,8 @@ enum litest_device_type { LITEST_WACOM_CINTIQ_13HDT_FINGER, LITEST_WACOM_HID4800_PEN, LITEST_MOUSE_WHEEL_CLICK_COUNT, + LITEST_ACER_HAWAII_KEYBOARD, + LITEST_ACER_HAWAII_TOUCHPAD, }; enum litest_device_feature { diff --git a/test/touchpad.c b/test/touchpad.c index 5b6f0a4..c3204a3 100644 --- a/test/touchpad.c +++ b/test/touchpad.c @@ -2501,6 +2501,9 @@ dwt_init_paired_keyboard(struct libinput *li, if (libevdev_get_id_vendor(touchpad->evdev) == VENDOR_ID_APPLE) which = LITEST_APPLE_KEYBOARD; + if (libevdev_get_id_vendor(touchpad->evdev) == VENDOR_ID_CHICONY) + which = LITEST_ACER_HAWAII_KEYBOARD; + return litest_add_device(li, which); } @@ -3774,6 +3777,45 @@ START_TEST(touchpad_dwt_apple) } END_TEST +START_TEST(touchpad_dwt_acer_hawaii) +{ + struct litest_device *touchpad = litest_current_device(); + struct litest_device *keyboard, *hawaii_keyboard; + struct libinput *li = touchpad->libinput; + + ck_assert(has_disable_while_typing(touchpad)); + + /* Only the hawaii 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); + + hawaii_keyboard = litest_add_device(li, LITEST_ACER_HAWAII_KEYBOARD); + litest_drain_events(li); + + litest_keyboard_key(hawaii_keyboard, KEY_A, true); + litest_keyboard_key(hawaii_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(hawaii_keyboard); +} +END_TEST + static int has_thumb_detect(struct litest_device *dev) { @@ -4750,6 +4792,7 @@ litest_setup_tests_touchpad(void) 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_for_device("touchpad:dwt", touchpad_dwt_acer_hawaii, LITEST_ACER_HAWAII_TOUCHPAD); 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); commit 6b1428eccd66f8813b9d66c4b90e07818f6c2ef3 Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Tue Dec 20 07:31:27 2016 +1000 test: use the udev property to check for external/internal touchpads Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> Reviewed-by: Hans de Goede <hdego...@redhat.com> (cherry picked from commit b69cfccdcaf9e4b20c9959bde196f81bbe536240) diff --git a/test/device.c b/test/device.c index f44a988..af39508 100644 --- a/test/device.c +++ b/test/device.c @@ -61,6 +61,22 @@ START_TEST(device_sendevents_config_invalid) } END_TEST +static inline bool +touchpad_is_external(struct litest_device *dev) +{ + struct udev_device *udev_device; + const char *prop; + bool is_external; + + udev_device = libinput_device_get_udev_device(dev->libinput_device); + prop = udev_device_get_property_value(udev_device, + "ID_INPUT_TOUCHPAD_INTEGRATION"); + is_external = prop && streq(prop, "external"); + udev_device_unref(udev_device); + + return is_external; +} + START_TEST(device_sendevents_config_touchpad) { struct litest_device *dev = litest_current_device(); @@ -71,7 +87,7 @@ START_TEST(device_sendevents_config_touchpad) /* The wacom devices in the test suite are external */ if (libevdev_get_id_vendor(dev->evdev) != VENDOR_ID_WACOM && - libevdev_get_id_bustype(dev->evdev) != BUS_BLUETOOTH) + !touchpad_is_external(dev)) expected |= LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE; @@ -91,7 +107,7 @@ START_TEST(device_sendevents_config_touchpad_superset) /* The wacom devices in the test suite are external */ if (libevdev_get_id_vendor(dev->evdev) == VENDOR_ID_WACOM || - libevdev_get_id_bustype(dev->evdev) == BUS_BLUETOOTH) + touchpad_is_external(dev)) return; device = dev->libinput_device; commit c58268e0c28314a52f4b55a9f4c7722a9894b1a5 Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Tue Dec 20 07:22:27 2016 +1000 test: mark the magic trackpad as external in udev This should be handled by a udev rule in systemd/hwdb but that rule doesn't apply to virtual devices. Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> Reviewed-by: Hans de Goede <hdego...@redhat.com> (cherry picked from commit 5307051386e1f23d37ab0bd97b4bef6b9944631b) diff --git a/test/litest-device-magic-trackpad.c b/test/litest-device-magic-trackpad.c index 588d6f5..de10f13 100644 --- a/test/litest-device-magic-trackpad.c +++ b/test/litest-device-magic-trackpad.c @@ -95,6 +95,16 @@ static int events[] = { -1, -1 }; +static const char udev_rule[] = +"ACTION==\"remove\", GOTO=\"touchpad_end\"\n" +"KERNEL!=\"event*\", GOTO=\"touchpad_end\"\n" +"ENV{ID_INPUT_TOUCHPAD}==\"\", GOTO=\"touchpad_end\"\n" +"\n" +"ATTRS{name}==\"litest Apple Wireless Trackpad\"," +" ENV{ID_INPUT_TOUCHPAD_INTEGRATION}=\"external\"\n" +"\n" +"LABEL=\"touchpad_end\""; + struct litest_test_device litest_magicpad_device = { .type = LITEST_MAGIC_TRACKPAD, .features = LITEST_TOUCHPAD | LITEST_CLICKPAD | @@ -107,4 +117,5 @@ struct litest_test_device litest_magicpad_device = { .id = &input_id, .events = events, .absinfo = absinfo, + .udev_rule = udev_rule, }; commit 3211a8a23c6ae1e3cd4d5f83b70f8ac5f22d1e64 Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Mon Nov 14 16:50:55 2016 +1000 tools: add some extra help output about the expected input data Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> (cherry picked from commit d1d3ea4d062b536976b328ff10c28444d37985de) diff --git a/tools/ptraccel-debug.c b/tools/ptraccel-debug.c index 3546b46..5538250 100644 --- a/tools/ptraccel-debug.c +++ b/tools/ptraccel-debug.c @@ -181,6 +181,9 @@ usage(void) "If stdin is a pipe, mode defaults to 'sequence' and the pipe is read \n" "for delta coordinates\n" "\n" + "Delta coordinates passed into this tool must be in dpi as\n" + "specified by the --dpi argument\n" + "\n" "Output best viewed with gnuplot. See output for gnuplot commands\n"); } commit 12b7ba70861207e324e752045b5bf09063cdd206 Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Wed Nov 2 11:19:28 2016 +1000 tools: support --help in the ptraccel-debug tool Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> (cherry picked from commit f545cfa9235052eef8d48cde19bafb2cca7fccb9) diff --git a/tools/ptraccel-debug.c b/tools/ptraccel-debug.c index aa887fe..3546b46 100644 --- a/tools/ptraccel-debug.c +++ b/tools/ptraccel-debug.c @@ -202,7 +202,8 @@ main(int argc, char **argv) accel_profile_func_t profile = NULL; enum { - OPT_MODE = 1, + OPT_HELP = 1,