Hello community, here is the log from the commit of package libinput for openSUSE:Factory checked in at 2018-11-13 16:22:02 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libinput (Old) and /work/SRC/openSUSE:Factory/.libinput.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libinput" Tue Nov 13 16:22:02 2018 rev:69 rq:646896 version:1.12.3 Changes: -------- --- /work/SRC/openSUSE:Factory/libinput/libinput.changes 2018-11-06 14:03:59.787483584 +0100 +++ /work/SRC/openSUSE:Factory/.libinput.new/libinput.changes 2018-11-13 16:22:12.215015183 +0100 @@ -1,0 +2,6 @@ +Wed Nov 7 09:26:29 UTC 2018 - Jan Engelhardt <[email protected]> + +- Update to new upstream release 1.12.3 + * A new quirk "AttrEventCodeDisable" was added + +------------------------------------------------------------------- Old: ---- libinput-1.12.2.tar.xz libinput-1.12.2.tar.xz.sig New: ---- libinput-1.12.3.tar.xz libinput-1.12.3.tar.xz.sig ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libinput.spec ++++++ --- /var/tmp/diff_new_pack.ARF8SU/_old 2018-11-13 16:22:13.051013720 +0100 +++ /var/tmp/diff_new_pack.ARF8SU/_new 2018-11-13 16:22:13.055013713 +0100 @@ -22,7 +22,7 @@ Name: libinput %define lname libinput10 -Version: 1.12.2 +Version: 1.12.3 Release: 0 Summary: Input device and event processing library License: MIT ++++++ libinput-1.12.2.tar.xz -> libinput-1.12.3.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.12.2/doc/user/device-quirks.rst new/libinput-1.12.3/doc/user/device-quirks.rst --- old/libinput-1.12.2/doc/user/device-quirks.rst 2018-10-24 07:45:24.000000000 +0200 +++ new/libinput-1.12.3/doc/user/device-quirks.rst 2018-11-07 05:57:20.000000000 +0100 @@ -177,3 +177,7 @@ Indicates the position of the touchpad on an external touchpad+keyboard combination device. This is a string enum. Don't specify it unless the touchpad is below. +AttrEventCodeDisable=EV_ABS;BTN_STYLUS;EV_KEY:0x123; + Disables the evdev event type/code tuples on the device. Entries may be + a named event type, or a named event code, or a named event type with a + hexadecimal event code, separated by a single colon. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.12.2/meson.build new/libinput-1.12.3/meson.build --- old/libinput-1.12.2/meson.build 2018-10-24 07:45:24.000000000 +0200 +++ new/libinput-1.12.3/meson.build 2018-11-07 05:57:20.000000000 +0100 @@ -1,5 +1,5 @@ project('libinput', 'c', 'cpp', - version : '1.12.2', + version : '1.12.3', license : 'MIT/Expat', default_options : [ 'c_std=gnu99', 'warning_level=2' ], meson_version : '>= 0.41.0') @@ -217,7 +217,7 @@ ] libinput_util = static_library('libinput-util', src_libinput_util, - dependencies : dep_udev, + dependencies : [dep_udev, dep_libevdev], include_directories : includes_include) dep_libinput_util = declare_dependency(link_with : libinput_util) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.12.2/quirks/30-vendor-aiptek.quirks new/libinput-1.12.3/quirks/30-vendor-aiptek.quirks --- old/libinput-1.12.2/quirks/30-vendor-aiptek.quirks 2018-10-24 07:45:24.000000000 +0200 +++ new/libinput-1.12.3/quirks/30-vendor-aiptek.quirks 2018-11-07 05:57:20.000000000 +0100 @@ -4,4 +4,4 @@ MatchUdevType=tablet MatchBus=usb MatchVendor=0x08CA -ModelTabletNoTilt=1 +AttrEventCodeDisable=ABS_TILT_X;ABS_TILT_Y; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.12.2/quirks/30-vendor-kensington.quirks new/libinput-1.12.3/quirks/30-vendor-kensington.quirks --- old/libinput-1.12.2/quirks/30-vendor-kensington.quirks 2018-10-24 07:45:24.000000000 +0200 +++ new/libinput-1.12.3/quirks/30-vendor-kensington.quirks 2018-11-07 05:57:20.000000000 +0100 @@ -1,6 +1,7 @@ +# Kensington Orbit claims to have a middle button, same for [Kensington Orbit Scroll Wheel] MatchBus=usb MatchVendor=0x047d MatchProduct=0x2048 -ModelKensingtonOrbit=1 ModelTrackball=1 +AttrEventCodeDisable=BTN_MIDDLE diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.12.2/quirks/30-vendor-logitech.quirks new/libinput-1.12.3/quirks/30-vendor-logitech.quirks --- old/libinput-1.12.2/quirks/30-vendor-logitech.quirks 2018-10-24 07:45:24.000000000 +0200 +++ new/libinput-1.12.3/quirks/30-vendor-logitech.quirks 2018-11-07 05:57:20.000000000 +0100 @@ -4,12 +4,13 @@ MatchName=*Logitech M570* ModelTrackball=1 +# Logitech Marble Mouse claims to have a middle button [Logitech Marble Mouse Trackball] MatchUdevType=mouse MatchBus=usb MatchVendor=0x46D MatchProduct=0xC408 -ModelLogitechMarbleMouse=1 +AttrEventCodeDisable=BTN_MIDDLE [Logitech K400] MatchUdevType=mouse diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.12.2/quirks/50-system-apple.quirks new/libinput-1.12.3/quirks/50-system-apple.quirks --- old/libinput-1.12.2/quirks/50-system-apple.quirks 2018-10-24 07:45:24.000000000 +0200 +++ new/libinput-1.12.3/quirks/50-system-apple.quirks 2018-11-07 05:57:20.000000000 +0100 @@ -19,12 +19,15 @@ MatchName=*Apple Inc. Apple Internal Keyboard* AttrKeyboardIntegration=internal +# The Apple MagicMouse has a touchpad built-in but the kernel still +# emulates a full 2/3 button mouse for us. Ignore anything from the +# ABS interface [Apple MagicMouse] MatchUdevType=mouse MatchBus=bluetooth MatchVendor=0x05AC MatchProduct=0x030D -ModelAppleMagicMouse=1 +AttrEventCodeDisable=EV_ABS [Apple Magic Trackpad v1 (2010, clickpad)] MatchUdevType=touchpad diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.12.2/quirks/50-system-asus.quirks new/libinput-1.12.3/quirks/50-system-asus.quirks --- old/libinput-1.12.2/quirks/50-system-asus.quirks 2018-10-24 07:45:24.000000000 +0200 +++ new/libinput-1.12.3/quirks/50-system-asus.quirks 2018-11-07 05:57:20.000000000 +0100 @@ -10,7 +10,10 @@ MatchDMIModalias=dmi:*svnASUSTeKComputerInc.:pnUX21E:* AttrPressureRange=24:10 +# Asus UX302LA touchpad doesn't update the pressure values once two +# fingers are down. So let's just pretend it doesn't have pressure +# at all. https://gitlab.freedesktop.org/libinput/libinput/issues/145 [Asus UX302LA] MatchName=*ETPS/2 Elantech Touchpad* MatchDMIModalias=dmi:*svnASUSTeKCOMPUTERINC.:pnUX302LA:* -ModelAsusUX302LATouchpad=1 +AttrEventCodeDisable=ABS_MT_PRESSURE;ABS_PRESSURE; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.12.2/quirks/50-system-cyborg.quirks new/libinput-1.12.3/quirks/50-system-cyborg.quirks --- old/libinput-1.12.2/quirks/50-system-cyborg.quirks 2018-10-24 07:45:24.000000000 +0200 +++ new/libinput-1.12.3/quirks/50-system-cyborg.quirks 2018-11-07 05:57:20.000000000 +0100 @@ -1,8 +1,31 @@ # Do not edit this file, it will be overwritten on update +# The Cyborg RAT has a mode button that cycles through event codes. +# On press, we get a release for the current mode and a press for the +# next mode: +# E: 0.000001 0004 0004 589833 # EV_MSC / MSC_SCAN 589833 +# E: 0.000001 0001 0118 0000 # EV_KEY / (null) 0 +# E: 0.000001 0004 0004 589834 # EV_MSC / MSC_SCAN 589834 +# E: 0.000001 0001 0119 0001 # EV_KEY / (null) 1 +# E: 0.000001 0000 0000 0000 # ------------ SYN_REPORT (0) ---------- +0ms +# E: 0.705000 0004 0004 589834 # EV_MSC / MSC_SCAN 589834 +# E: 0.705000 0001 0119 0000 # EV_KEY / (null) 0 +# E: 0.705000 0004 0004 589835 # EV_MSC / MSC_SCAN 589835 +# E: 0.705000 0001 011a 0001 # EV_KEY / (null) 1 +# E: 0.705000 0000 0000 0000 # ------------ SYN_REPORT (0) ---------- +705ms +# E: 1.496995 0004 0004 589833 # EV_MSC / MSC_SCAN 589833 +# E: 1.496995 0001 0118 0001 # EV_KEY / (null) 1 +# E: 1.496995 0004 0004 589835 # EV_MSC / MSC_SCAN 589835 +# E: 1.496995 0001 011a 0000 # EV_KEY / (null) 0 +# E: 1.496995 0000 0000 0000 # ------------ SYN_REPORT (0) ---------- +791ms +# +# https://bugs.freedesktop.org/show_bug.cgi?id=92127 +# +# Disable the event codes to avoid stuck buttons. [Saitek Cyborg RAT5] MatchUdevType=mouse MatchBus=usb MatchVendor=0x06A3 MatchProduct=0x0CD5 -ModelCyborgRat=1 +# EV_KEY 0x118, 0x119, 0x11a +AttrEventCodeDisable=EV_KEY:0x118;EV_KEY:0x119;EV_KEY:0x11a diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.12.2/quirks/50-system-hp.quirks new/libinput-1.12.3/quirks/50-system-hp.quirks --- old/libinput-1.12.2/quirks/50-system-hp.quirks 2018-10-24 07:45:24.000000000 +0200 +++ new/libinput-1.12.3/quirks/50-system-hp.quirks 2018-11-07 05:57:20.000000000 +0100 @@ -1,14 +1,18 @@ # Do not edit this file, it will be overwritten on update - +# +# Claims to have double/tripletap but doesn't actually send it +# https://bugs.freedesktop.org/show_bug.cgi?id=98538 [HP Compaq 6910p] MatchName=*SynPS/2 Synaptics TouchPad MatchDMIModalias=dmi:*svnHewlett-Packard:*pnHPCompaq6910p* -ModelHP6910Touchpad=1 +AttrEventCodeDisable=BTN_TOOL_DOUBLETAP;BTN_TOOL_TRIPLETAP; +# Claims to have double/tripletap but doesn't actually send it +# https://bugzilla.redhat.com/show_bug.cgi?id=1351285 and [HP Compaq 8510w] MatchName=*SynPS/2 Synaptics TouchPad MatchDMIModalias=dmi:*svnHewlett-Packard:*pnHPCompaq8510w* -ModelHP8510Touchpad=1 +AttrEventCodeDisable=BTN_TOOL_DOUBLETAP;BTN_TOOL_TRIPLETAP; [HP Pavillion dmi4] MatchName=*SynPS/2 Synaptics TouchPad diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.12.2/quirks/50-system-lenovo.quirks new/libinput-1.12.3/quirks/50-system-lenovo.quirks --- old/libinput-1.12.2/quirks/50-system-lenovo.quirks 2018-10-24 07:45:24.000000000 +0200 +++ new/libinput-1.12.3/quirks/50-system-lenovo.quirks 2018-11-07 05:57:20.000000000 +0100 @@ -70,11 +70,12 @@ MatchDMIModalias=dmi:*svnLENOVO:*pvrThinkPad*Yoga*:* ModelTabletModeNoSuspend=1 -# Lenovo Carbon X1 6th gen (RMI4 only, PS/2 is broken on this device) +# Lenovo Carbon X1 6th gen (RMI4 only, PS/2 is broken on this device, +# sends bogus ABS_MT_TOOL_TYPE events for MT_TOOL_PALM [Lenovo Carbon X1 6th gen] MatchName=Synaptics TM3288-011 MatchDMIModalias=dmi:*svnLenovo:*pvrThinkPadX1Carbon6th:* -ModelLenovoCarbonX16th=1 +AttrEventCodeDisable=ABS_MT_TOOL_TYPE [Lenovo X41 Tablet] MatchName=AT Translated Set 2 keyboard @@ -94,6 +95,13 @@ MatchDMIModalias=dmi:*svnLENOVO:*pvrThinkPadX220Tablet:* ModelTabletModeNoSuspend=1 +# Special bezel button deactivation with +# keyboard also applies to X230 Tablet +[Lenovo X230 Tablet] +MatchName=AT Translated Set 2 keyboard +MatchDMIModalias=dmi:*svnLENOVO:*pvrThinkPadX230Tablet:* +ModelTabletModeNoSuspend=1 + # Lenovo MIIX 720 comes with a detachable keyboard. We must not disable # the keyboard because some keys are still accessible on the screen and # volume rocker. See diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.12.2/src/evdev.c new/libinput-1.12.3/src/evdev.c --- old/libinput-1.12.2/src/evdev.c 2018-10-24 07:45:24.000000000 +0200 +++ new/libinput-1.12.3/src/evdev.c 2018-11-07 05:57:20.000000000 +0100 @@ -1144,21 +1144,23 @@ evdev_read_wheel_click_props(struct evdev_device *device) { struct wheel_angle angles; + const char *wheel_count = "MOUSE_WHEEL_CLICK_COUNT"; + const char *wheel_angle = "MOUSE_WHEEL_CLICK_ANGLE"; + const char *hwheel_count = "MOUSE_WHEEL_CLICK_COUNT_HORIZONTAL"; + const char *hwheel_angle = "MOUSE_WHEEL_CLICK_ANGLE_HORIZONTAL"; /* CLICK_COUNT overrides CLICK_ANGLE */ - if (!evdev_read_wheel_click_count_prop(device, - "MOUSE_WHEEL_CLICK_COUNT", - &angles.y)) - evdev_read_wheel_click_prop(device, - "MOUSE_WHEEL_CLICK_ANGLE", - &angles.y); - if (!evdev_read_wheel_click_count_prop(device, - "MOUSE_WHEEL_CLICK_COUNT_HORIZONTAL", - &angles.x)) { - if (!evdev_read_wheel_click_prop(device, - "MOUSE_WHEEL_CLICK_ANGLE_HORIZONTAL", - &angles.x)) - angles.x = angles.y; + if (evdev_read_wheel_click_count_prop(device, wheel_count, &angles.y) || + evdev_read_wheel_click_prop(device, wheel_angle, &angles.y)) { + evdev_log_debug(device, + "wheel: vert click angle: %.2f\n", angles.y); + } + if (evdev_read_wheel_click_count_prop(device, hwheel_count, &angles.x) || + evdev_read_wheel_click_prop(device, hwheel_angle, &angles.x)) { + evdev_log_debug(device, + "wheel: horizontal click angle: %.2f\n", angles.y); + } else { + angles.x = angles.y; } return angles; @@ -1897,53 +1899,9 @@ { struct quirks_context *quirks; struct quirks *q; + const struct quirk_tuples *t; char *prop; - /* The Cyborg RAT has a mode button that cycles through event codes. - * On press, we get a release for the current mode and a press for the - * next mode: - * E: 0.000001 0004 0004 589833 # EV_MSC / MSC_SCAN 589833 - * E: 0.000001 0001 0118 0000 # EV_KEY / (null) 0 - * E: 0.000001 0004 0004 589834 # EV_MSC / MSC_SCAN 589834 - * E: 0.000001 0001 0119 0001 # EV_KEY / (null) 1 - * E: 0.000001 0000 0000 0000 # ------------ SYN_REPORT (0) ---------- +0ms - * E: 0.705000 0004 0004 589834 # EV_MSC / MSC_SCAN 589834 - * E: 0.705000 0001 0119 0000 # EV_KEY / (null) 0 - * E: 0.705000 0004 0004 589835 # EV_MSC / MSC_SCAN 589835 - * E: 0.705000 0001 011a 0001 # EV_KEY / (null) 1 - * E: 0.705000 0000 0000 0000 # ------------ SYN_REPORT (0) ---------- +705ms - * E: 1.496995 0004 0004 589833 # EV_MSC / MSC_SCAN 589833 - * E: 1.496995 0001 0118 0001 # EV_KEY / (null) 1 - * E: 1.496995 0004 0004 589835 # EV_MSC / MSC_SCAN 589835 - * E: 1.496995 0001 011a 0000 # EV_KEY / (null) 0 - * E: 1.496995 0000 0000 0000 # ------------ SYN_REPORT (0) ---------- +791ms - * - * https://bugs.freedesktop.org/show_bug.cgi?id=92127 - * - * Disable the event codes to avoid stuck buttons. - */ - if (evdev_device_has_model_quirk(device, QUIRK_MODEL_CYBORG_RAT)) { - libevdev_disable_event_code(device->evdev, EV_KEY, 0x118); - libevdev_disable_event_code(device->evdev, EV_KEY, 0x119); - libevdev_disable_event_code(device->evdev, EV_KEY, 0x11a); - } - /* The Apple MagicMouse has a touchpad built-in but the kernel still - * emulates a full 2/3 button mouse for us. Ignore anything from the - * ABS interface - */ - if (evdev_device_has_model_quirk(device, QUIRK_MODEL_APPLE_MAGICMOUSE)) - libevdev_disable_event_type(device->evdev, EV_ABS); - - /* Claims to have double/tripletap but doesn't actually send it - * https://bugzilla.redhat.com/show_bug.cgi?id=1351285 and - * https://bugs.freedesktop.org/show_bug.cgi?id=98538 - */ - if (evdev_device_has_model_quirk(device, QUIRK_MODEL_HP8510_TOUCHPAD) || - evdev_device_has_model_quirk(device, QUIRK_MODEL_HP6910_TOUCHPAD)) { - libevdev_disable_event_code(device->evdev, EV_KEY, BTN_TOOL_DOUBLETAP); - libevdev_disable_event_code(device->evdev, EV_KEY, BTN_TOOL_TRIPLETAP); - } - /* Touchpad is a clickpad but INPUT_PROP_BUTTONPAD is not set, see * fdo bug 97147. Remove when RMI4 is commonplace */ if (evdev_device_has_model_quirk(device, QUIRK_MODEL_HP_STREAM11_TOUCHPAD)) @@ -1955,41 +1913,6 @@ if (evdev_device_has_model_quirk(device, QUIRK_MODEL_HP_ZBOOK_STUDIO_G3)) libevdev_set_abs_maximum(device->evdev, ABS_MT_SLOT, 1); - /* Logitech Marble Mouse claims to have a middle button, same for - * the Kensington Orbit */ - if (evdev_device_has_model_quirk(device, - QUIRK_MODEL_LOGITECH_MARBLE_MOUSE) || - evdev_device_has_model_quirk(device, - QUIRK_MODEL_KENSINGTON_ORBIT)) - libevdev_disable_event_code(device->evdev, EV_KEY, BTN_MIDDLE); - - /* Aiptek tablets have tilt but don't send events */ - if (evdev_device_has_model_quirk(device, QUIRK_MODEL_TABLET_NO_TILT)) { - libevdev_disable_event_code(device->evdev, EV_ABS, ABS_TILT_X); - libevdev_disable_event_code(device->evdev, EV_ABS, ABS_TILT_Y); - } - - /* Lenovo Carbon X1 6th gen sends bogus ABS_MT_TOOL_TYPE events for - * MT_TOOL_PALM */ - if (evdev_device_has_model_quirk(device, QUIRK_MODEL_LENOVO_CARBON_X1_6TH)) - libevdev_disable_event_code(device->evdev, - EV_ABS, - ABS_MT_TOOL_TYPE); - - /* Asus UX302LA touchpad doesn't update the pressure values once two - * fingers are down. So let's just pretend it doesn't have pressure - * at all. https://gitlab.freedesktop.org/libinput/libinput/issues/145 - */ - if (evdev_device_has_model_quirk(device, - QUIRK_MODEL_ASUS_UX320LA_TOUCHPAD)) { - libevdev_disable_event_code(device->evdev, - EV_ABS, - ABS_MT_PRESSURE); - libevdev_disable_event_code(device->evdev, - EV_ABS, - ABS_PRESSURE); - } - /* Generally we don't care about MSC_TIMESTAMP and it can cause * unnecessary wakeups but on some devices we need to watch it for * pointer jumps */ @@ -2000,7 +1923,32 @@ !streq(prop, "watch")) { libevdev_disable_event_code(device->evdev, EV_MSC, MSC_TIMESTAMP); } + + if (q && quirks_get_tuples(q, QUIRK_ATTR_EVENT_CODE_DISABLE, &t)) { + int type, code; + + for (size_t i = 0; i < t->ntuples; i++) { + type = t->tuples[i].first; + code = t->tuples[i].second; + + if (code == EVENT_CODE_UNDEFINED) + libevdev_disable_event_type(device->evdev, + type); + else + libevdev_disable_event_code(device->evdev, + type, + code); + evdev_log_debug(device, + "quirks: disabling %s %s (%#x %#x)\n", + libevdev_event_type_get_name(type), + libevdev_event_code_get_name(type, code), + type, + code); + } + } + quirks_unref(q); + } static void diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.12.2/src/libinput-util.c new/libinput-1.12.3/src/libinput-util.c --- old/libinput-1.12.2/src/libinput-util.c 2018-10-24 07:45:24.000000000 +0200 +++ new/libinput-1.12.3/src/libinput-util.c 2018-11-07 05:57:20.000000000 +0100 @@ -36,6 +36,7 @@ #include <stdbool.h> #include <stdio.h> #include <stdlib.h> +#include <libevdev/libevdev.h> #include "libinput-util.h" #include "libinput-private.h" @@ -398,6 +399,125 @@ return true; } +static bool +parse_evcode_string(const char *s, int *type_out, int *code_out) +{ + int type, code; + + if (strneq(s, "EV_", 3)) { + type = libevdev_event_type_from_name(s); + if (type == -1) + return false; + + code = EVENT_CODE_UNDEFINED; + } else { + struct map { + const char *str; + int type; + } map[] = { + { "KEY_", EV_KEY }, + { "BTN_", EV_KEY }, + { "ABS_", EV_ABS }, + { "REL_", EV_REL }, + { "SW_", EV_SW }, + }; + struct map *m; + bool found = false; + + ARRAY_FOR_EACH(map, m) { + if (!strneq(s, m->str, strlen(m->str))) + continue; + + type = m->type; + code = libevdev_event_code_from_name(type, s); + if (code == -1) + return false; + + found = true; + break; + } + if (!found) + return false; + } + + *type_out = type; + *code_out = code; + + return true; +} + +/** + * Parses a string of the format "EV_ABS;KEY_A;BTN_TOOL_DOUBLETAP;ABS_X;" + * where each element must be a named event type OR a named event code OR a + * tuple in the form of EV_KEY:0x123, i.e. a named event type followed by a + * hex event code. + * + * events must point to an existing array of size nevents. + * nevents specifies the size of the array in events and returns the number + * of items, elements exceeding nevents are simply ignored, just make sure + * events is large enough for your use-case. + * + * The results are returned as input events with type and code set, all + * other fields undefined. Where only the event type is specified, the code + * is set to EVENT_CODE_UNDEFINED. + * + * On success, events contains nevents events. + */ +bool +parse_evcode_property(const char *prop, struct input_event *events, size_t *nevents) +{ + char **strv = NULL; + bool rc = false; + size_t ncodes = 0; + size_t idx; + struct input_event evs[*nevents]; + + memset(evs, 0, sizeof evs); + + strv = strv_from_string(prop, ";"); + if (!strv) + goto out; + + for (idx = 0; strv[idx]; idx++) + ncodes++; + + /* A randomly chosen max so we avoid crazy quirks */ + if (ncodes == 0 || ncodes > 32) + goto out; + + ncodes = min(*nevents, ncodes); + for (idx = 0; strv[idx]; idx++) { + char *s = strv[idx]; + + int type, code; + + if (strstr(s, ":") == NULL) { + if (!parse_evcode_string(s, &type, &code)) + goto out; + } else { + int consumed; + char stype[13] = {0}; /* EV_FF_STATUS + '\0' */ + + if (sscanf(s, "%12[A-Z_]:%x%n", stype, &code, &consumed) != 2 || + strlen(s) != (size_t)consumed || + (type = libevdev_event_type_from_name(stype)) == -1 || + code < 0 || code > libevdev_event_type_get_max(type)) + goto out; + } + + evs[idx].type = type; + evs[idx].code = code; + } + + memcpy(events, evs, ncodes * sizeof *events); + *nevents = ncodes; + rc = true; + +out: + strv_free(strv); + return rc; +} + /** * Return the next word in a string pointed to by state before the first * separator character. Call repeatedly to tokenize a whole string. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.12.2/src/libinput-util.h new/libinput-1.12.3/src/libinput-util.h --- old/libinput-1.12.2/src/libinput-util.h 2018-10-24 07:45:24.000000000 +0200 +++ new/libinput-1.12.3/src/libinput-util.h 2018-11-07 05:57:20.000000000 +0100 @@ -44,6 +44,7 @@ #include <string.h> #include <time.h> #include <unistd.h> +#include <linux/input.h> #include "libinput.h" @@ -426,6 +427,8 @@ bool parse_dimension_property(const char *prop, size_t *width, size_t *height); bool parse_calibration_property(const char *prop, float calibration[6]); bool parse_range_property(const char *prop, int *hi, int *lo); +#define EVENT_CODE_UNDEFINED 0xffff +bool parse_evcode_property(const char *prop, struct input_event *events, size_t *nevents); enum tpkbcombo_layout { TPKBCOMBO_LAYOUT_UNKNOWN, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.12.2/src/quirks.c new/libinput-1.12.3/src/quirks.c --- old/libinput-1.12.2/src/quirks.c 2018-10-24 07:45:24.000000000 +0200 +++ new/libinput-1.12.3/src/quirks.c 2018-11-07 05:57:20.000000000 +0100 @@ -57,6 +57,7 @@ PT_DIMENSION, PT_RANGE, PT_DOUBLE, + PT_TUPLES, }; /** @@ -75,9 +76,10 @@ uint32_t u; int32_t i; char *s; + double d; struct quirk_dimensions dim; struct quirk_range range; - double d; + struct quirk_tuples tuples; } value; }; @@ -229,25 +231,17 @@ { switch(q) { case QUIRK_MODEL_ALPS_TOUCHPAD: return "ModelALPSTouchpad"; - case QUIRK_MODEL_APPLE_MAGICMOUSE: return "ModelAppleMagicMouse"; case QUIRK_MODEL_APPLE_TOUCHPAD: return "ModelAppleTouchpad"; case QUIRK_MODEL_APPLE_TOUCHPAD_ONEBUTTON: return "ModelAppleTouchpadOneButton"; - case QUIRK_MODEL_ASUS_UX320LA_TOUCHPAD: return "ModelAsusUX302LATouchpad"; case QUIRK_MODEL_BOUNCING_KEYS: return "ModelBouncingKeys"; case QUIRK_MODEL_CHROMEBOOK: return "ModelChromebook"; case QUIRK_MODEL_CLEVO_W740SU: return "ModelClevoW740SU"; - case QUIRK_MODEL_CYBORG_RAT: return "ModelCyborgRat"; - case QUIRK_MODEL_HP6910_TOUCHPAD: return "ModelHP6910Touchpad"; - case QUIRK_MODEL_HP8510_TOUCHPAD: return "ModelHP8510Touchpad"; case QUIRK_MODEL_HP_PAVILION_DM4_TOUCHPAD: return "ModelHPPavilionDM4Touchpad"; case QUIRK_MODEL_HP_STREAM11_TOUCHPAD: return "ModelHPStream11Touchpad"; case QUIRK_MODEL_HP_ZBOOK_STUDIO_G3: return "ModelHPZBookStudioG3"; - case QUIRK_MODEL_KENSINGTON_ORBIT: return "ModelKensingtonOrbit"; - case QUIRK_MODEL_LENOVO_CARBON_X1_6TH: return "ModelLenovoCarbonX16th"; case QUIRK_MODEL_LENOVO_SCROLLPOINT: return "ModelLenovoScrollPoint"; case QUIRK_MODEL_LENOVO_T450_TOUCHPAD: return "ModelLenovoT450Touchpad"; case QUIRK_MODEL_LENOVO_X230: return "ModelLenovoX230"; - case QUIRK_MODEL_LOGITECH_MARBLE_MOUSE: return "ModelLogitechMarbleMouse"; case QUIRK_MODEL_SYNAPTICS_SERIAL_TOUCHPAD: return "ModelSynapticsSerialTouchpad"; case QUIRK_MODEL_SYSTEM76_BONOBO: return "ModelSystem76Bonobo"; case QUIRK_MODEL_SYSTEM76_GALAGO: return "ModelSystem76Galago"; @@ -273,6 +267,7 @@ case QUIRK_ATTR_USE_VELOCITY_AVERAGING: return "AttrUseVelocityAveraging"; case QUIRK_ATTR_THUMB_SIZE_THRESHOLD: return "AttrThumbSizeThreshold"; case QUIRK_ATTR_MSC_TIMESTAMP: return "AttrMscTimestamp"; + case QUIRK_ATTR_EVENT_CODE_DISABLE: return "AttrEventCodeDisable"; default: abort(); } @@ -727,6 +722,22 @@ p->type = PT_STRING; p->value.s = safe_strdup(value); rc = true; + } else if (streq(key, quirk_get_name(QUIRK_ATTR_EVENT_CODE_DISABLE))) { + size_t nevents = 32; + struct input_event events[nevents]; + p->id = QUIRK_ATTR_EVENT_CODE_DISABLE; + if (!parse_evcode_property(value, events, &nevents) || + nevents == 0) + goto out; + + for (size_t i = 0; i < nevents; i++) { + p->value.tuples.tuples[i].first = events[i].type; + p->value.tuples.tuples[i].second = events[i].code; + } + p->value.tuples.ntuples = nevents; + p->type = PT_TUPLES; + + rc = true; } else { qlog_error(ctx, "Unknown key %s in %s\n", key, s->name); } @@ -1543,3 +1554,23 @@ return true; } + +bool +quirks_get_tuples(struct quirks *q, + enum quirk which, + const struct quirk_tuples **tuples) +{ + struct property *p; + + if (!q) + return false; + + p = quirk_find_prop(q, which); + if (!p) + return false; + + assert(p->type == PT_TUPLES); + *tuples = &p->value.tuples; + + return true; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.12.2/src/quirks.h new/libinput-1.12.3/src/quirks.h --- old/libinput-1.12.2/src/quirks.h 2018-10-24 07:45:24.000000000 +0200 +++ new/libinput-1.12.3/src/quirks.h 2018-11-07 05:57:20.000000000 +0100 @@ -50,30 +50,30 @@ int lower, upper; }; +struct quirk_tuples { + struct { + int first; + int second; + } tuples[32]; + size_t ntuples; +}; + /** * Quirks known to libinput */ enum quirk { QUIRK_MODEL_ALPS_TOUCHPAD = 100, - QUIRK_MODEL_APPLE_MAGICMOUSE, QUIRK_MODEL_APPLE_TOUCHPAD, QUIRK_MODEL_APPLE_TOUCHPAD_ONEBUTTON, - QUIRK_MODEL_ASUS_UX320LA_TOUCHPAD, QUIRK_MODEL_BOUNCING_KEYS, QUIRK_MODEL_CHROMEBOOK, QUIRK_MODEL_CLEVO_W740SU, - QUIRK_MODEL_CYBORG_RAT, - QUIRK_MODEL_HP6910_TOUCHPAD, - QUIRK_MODEL_HP8510_TOUCHPAD, QUIRK_MODEL_HP_PAVILION_DM4_TOUCHPAD, QUIRK_MODEL_HP_STREAM11_TOUCHPAD, QUIRK_MODEL_HP_ZBOOK_STUDIO_G3, - QUIRK_MODEL_KENSINGTON_ORBIT, - QUIRK_MODEL_LENOVO_CARBON_X1_6TH, QUIRK_MODEL_LENOVO_SCROLLPOINT, QUIRK_MODEL_LENOVO_T450_TOUCHPAD, QUIRK_MODEL_LENOVO_X230, - QUIRK_MODEL_LOGITECH_MARBLE_MOUSE, QUIRK_MODEL_SYNAPTICS_SERIAL_TOUCHPAD, QUIRK_MODEL_SYSTEM76_BONOBO, QUIRK_MODEL_SYSTEM76_GALAGO, @@ -102,7 +102,7 @@ QUIRK_ATTR_USE_VELOCITY_AVERAGING, QUIRK_ATTR_THUMB_SIZE_THRESHOLD, QUIRK_ATTR_MSC_TIMESTAMP, - + QUIRK_ATTR_EVENT_CODE_DISABLE, _QUIRK_LAST_ATTR_QUIRK_, /* Guard: do not modify */ }; @@ -293,3 +293,16 @@ quirks_get_range(struct quirks *q, enum quirk which, struct quirk_range *val); + +/** + * Get the tuples of the given quirk. + * This function will assert if the quirk type does not match the + * requested type. If the quirk is not set for this device, tuples is + * unchanged. + * + * @return true if the quirk value is valid, false otherwise. + */ +bool +quirks_get_tuples(struct quirks *q, + enum quirk which, + const struct quirk_tuples **tuples); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.12.2/test/test-misc.c new/libinput-1.12.3/test/test-misc.c --- old/libinput-1.12.2/test/test-misc.c 2018-10-24 07:45:24.000000000 +0200 +++ new/libinput-1.12.3/test/test-misc.c 2018-11-07 05:57:20.000000000 +0100 @@ -1013,6 +1013,81 @@ } END_TEST +START_TEST(evcode_prop_parser) +{ + struct parser_test_tuple { + const char *prop; + bool success; + size_t ntuples; + int tuples[20]; + } tests[] = { + { "EV_KEY", true, 1, {EV_KEY, 0xffff} }, + { "EV_ABS;", true, 1, {EV_ABS, 0xffff} }, + { "ABS_X;", true, 1, {EV_ABS, ABS_X} }, + { "SW_TABLET_MODE;", true, 1, {EV_SW, SW_TABLET_MODE} }, + { "EV_SW", true, 1, {EV_SW, 0xffff} }, + { "ABS_Y", true, 1, {EV_ABS, ABS_Y} }, + { "EV_ABS:0x00", true, 1, {EV_ABS, ABS_X} }, + { "EV_ABS:01", true, 1, {EV_ABS, ABS_Y} }, + { "ABS_TILT_X;ABS_TILT_Y;", true, 2, + { EV_ABS, ABS_TILT_X, + EV_ABS, ABS_TILT_Y} }, + { "BTN_TOOL_DOUBLETAP;EV_KEY;KEY_A", true, 3, + { EV_KEY, BTN_TOOL_DOUBLETAP, + EV_KEY, 0xffff, + EV_KEY, KEY_A } }, + { "REL_Y;ABS_Z;BTN_STYLUS", true, 3, + { EV_REL, REL_Y, + EV_ABS, ABS_Z, + EV_KEY, BTN_STYLUS } }, + { "REL_Y;EV_KEY:0x123;BTN_STYLUS", true, 3, + { EV_REL, REL_Y, + EV_KEY, 0x123, + EV_KEY, BTN_STYLUS } }, + { .prop = "", .success = false }, + { .prop = "EV_FOO", .success = false }, + { .prop = "EV_KEY;EV_FOO", .success = false }, + { .prop = "BTN_STYLUS;EV_FOO", .success = false }, + { .prop = "BTN_UNKNOWN", .success = false }, + { .prop = "BTN_UNKNOWN;EV_KEY", .success = false }, + { .prop = "PR_UNKNOWN", .success = false }, + { .prop = "BTN_STYLUS;PR_UNKNOWN;ABS_X", .success = false }, + { .prop = "EV_REL:0xffff", .success = false }, + { .prop = "EV_REL:0x123.", .success = false }, + { .prop = "EV_REL:ffff", .success = false }, + { .prop = "EV_REL:blah", .success = false }, + { .prop = "KEY_A:0x11", .success = false }, + { .prop = "EV_KEY:0x11 ", .success = false }, + { .prop = "EV_KEY:0x11not", .success = false }, + { .prop = "none", .success = false }, + { .prop = NULL }, + }; + struct parser_test_tuple *t; + + for (int i = 0; tests[i].prop; i++) { + bool success; + size_t nevents = 32; + struct input_event events[nevents]; + + t = &tests[i]; + success = parse_evcode_property(t->prop, events, &nevents); + ck_assert(success == t->success); + if (!success) + continue; + + ck_assert_int_eq(nevents, t->ntuples); + for (size_t j = 0; j < nevents; j++) { + int type, code; + + type = events[j].type; + code = events[j].code; + ck_assert_int_eq(t->tuples[j * 2], type); + ck_assert_int_eq(t->tuples[j * 2 + 1], code); + } + } +} +END_TEST + START_TEST(time_conversion) { ck_assert_int_eq(us(10), 10); @@ -1728,6 +1803,7 @@ litest_add_deviceless("misc:parser", reliability_prop_parser); litest_add_deviceless("misc:parser", calibration_prop_parser); litest_add_deviceless("misc:parser", range_prop_parser); + litest_add_deviceless("misc:parser", evcode_prop_parser); litest_add_deviceless("misc:parser", safe_atoi_test); litest_add_deviceless("misc:parser", safe_atoi_base_16_test); litest_add_deviceless("misc:parser", safe_atoi_base_8_test); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.12.2/tools/libinput-measure-touchpad-pressure.py new/libinput-1.12.3/tools/libinput-measure-touchpad-pressure.py --- old/libinput-1.12.2/tools/libinput-measure-touchpad-pressure.py 2018-10-24 07:45:24.000000000 +0200 +++ new/libinput-1.12.3/tools/libinput-measure-touchpad-pressure.py 2018-11-07 05:57:20.000000000 +0100 @@ -170,7 +170,12 @@ caps = all_caps.get(evdev.ecodes.EV_ABS, []) p = [cap[1] for cap in caps if cap[0] == evdev.ecodes.ABS_MT_PRESSURE] if not p: - raise InvalidDeviceError("device does not have ABS_MT_PRESSURE") + p = [cap[1] for cap in caps if cap[0] == evdev.ecodes.ABS_PRESSURE] + if not p: + raise InvalidDeviceError("device does not have ABS_PRESSURE/ABS_MT_PRESSURE") + self.has_mt_pressure = False + else: + self.has_mt_pressure = True p = p[0] prange = p.max - p.min @@ -247,7 +252,8 @@ except IndexError: # If the finger was down at startup pass - elif event.code == evdev.ecodes.ABS_MT_PRESSURE: + elif ((event.code == evdev.ecodes.ABS_MT_PRESSURE) or + (event.code == evdev.ecodes.ABS_PRESSURE and not device.has_mt_pressure)): try: s = device.current_sequence() s.append(Touch(pressure=event.value)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libinput-1.12.2/tools/shared.c new/libinput-1.12.3/tools/shared.c --- old/libinput-1.12.2/tools/shared.c 2018-10-24 07:45:24.000000000 +0200 +++ new/libinput-1.12.3/tools/shared.c 2018-11-07 05:57:20.000000000 +0100 @@ -588,6 +588,31 @@ return EXIT_FAILURE; } +static void +sprintf_event_codes(char *buf, size_t sz, struct quirks *quirks) +{ + const struct quirk_tuples *t; + size_t off = 0; + int printed; + const char *name; + + quirks_get_tuples(quirks, QUIRK_ATTR_EVENT_CODE_DISABLE, &t); + name = quirk_get_name(QUIRK_ATTR_EVENT_CODE_DISABLE); + printed = snprintf(buf, sz, "%s=", name); + assert(printed != -1); + off += printed; + + for (size_t i = 0; off < sz && i < t->ntuples; i++) { + const char *name = libevdev_event_code_get_name( + t->tuples[i].first, + t->tuples[i].second); + + printed = snprintf(buf + off, sz - off, "%s;", name); + assert(printed != -1); + off += printed; + } +} + void tools_list_device_quirks(struct quirks_context *ctx, struct udev_device *device, @@ -657,13 +682,17 @@ break; case QUIRK_ATTR_TRACKPOINT_MULTIPLIER: quirks_get_double(quirks, q, &d); - snprintf(buf, sizeof(buf), "%s=%0.2f\n", name, d); + snprintf(buf, sizeof(buf), "%s=%0.2f", name, d); callback(userdata, buf); break; case QUIRK_ATTR_USE_VELOCITY_AVERAGING: snprintf(buf, sizeof(buf), "%s=1", name); callback(userdata, buf); break; + case QUIRK_ATTR_EVENT_CODE_DISABLE: + sprintf_event_codes(buf, sizeof(buf), quirks); + callback(userdata, buf); + break; default: abort(); break;
