[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

libinput: Changes to 'upstream-unstable'



Rebased ref, commits from common ancestor:
commit 8616cc0bb9d483a8ef5955e1880e78f00a8f4746
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Fri Nov 11 13:49:27 2016 +1000

    configure.ac: libinput 1.5.1
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/configure.ac b/configure.ac
index 0ae9b76..43db9bb 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], [0])
+m4_define([libinput_micro_version], [1])
 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:1:10
+LIBINPUT_LT_VERSION=20:2:10
 AC_SUBST(LIBINPUT_LT_VERSION)
 
 AM_SILENT_RULES([yes])

commit 92c30b5a7188e5ec94eb4ebbc7b9a1523c67d341
Author: Hermann Gausterer <git-libinput-2016@mrq1.org>
Date:   Wed Nov 9 16:58:07 2016 +0100

    evdev: fix typo / bugzilla url
    
    Signed-off-by: Hermann Gausterer <git-libinput-2016@mrq1.org>
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/src/evdev.c b/src/evdev.c
index d04636f..fac8fcb 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -2749,7 +2749,7 @@ evdev_pre_configure_model_quirks(struct evdev_device *device)
 
 	/* Claims to have double/tripletap but doesn't actually send it
 	 * https://bugzilla.redhat.com/show_bug.cgi?id=1351285 and
-	 * https://bugzilla.redhat.com/show_bug.cgi?id=98538
+	 * https://bugs.freedesktop.org/show_bug.cgi?id=98538
 	 */
 	if (device->model_flags &
 	    (EVDEV_MODEL_HP8510_TOUCHPAD|EVDEV_MODEL_HP6910_TOUCHPAD)) {

commit 58c7a9cbf0aaa49b4802f2460acee20e4807dc28
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Fri Oct 28 15:08:32 2016 +1000

    evdev: implement support for the MOUSE_WHEEL_CLICK_COUNT property
    
    Not all mice have a click angle with integer degrees. The new
    MOUSE_WHEEL_CLICK_COUNT property specifies how many clicks per full rotation,
    the angle can be calculated from that.
    
    See https://github.com/systemd/systemd/pull/4440 for more information
    
    CLICK_COUNT overrides CLICK_ANGLE, so we check for the former first and then
    fall back to the angle if need be. No changes to the user-facing API.
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/src/evdev.c b/src/evdev.c
index 2412751..d04636f 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -2008,7 +2008,7 @@ evdev_device_init_pointer_acceleration(struct evdev_device *device,
 static inline bool
 evdev_read_wheel_click_prop(struct evdev_device *device,
 			    const char *prop,
-			    int *angle)
+			    double *angle)
 {
 	int val;
 
@@ -2032,18 +2032,53 @@ evdev_read_wheel_click_prop(struct evdev_device *device,
 	return false;
 }
 
+static inline bool
+evdev_read_wheel_click_count_prop(struct evdev_device *device,
+				  const char *prop,
+				  double *angle)
+{
+	int val;
+
+	prop = udev_device_get_property_value(device->udev_device, prop);
+	if (!prop)
+		return false;
+
+	val = parse_mouse_wheel_click_angle_property(prop);
+	if (val) {
+		*angle = 360.0/val;
+		return true;
+	}
+
+	log_error(evdev_libinput_context(device),
+		  "Mouse wheel click count '%s' is present but invalid, "
+		  "using %d degrees for angle instead instead\n",
+		  device->devname,
+		  DEFAULT_WHEEL_CLICK_ANGLE);
+	*angle = DEFAULT_WHEEL_CLICK_ANGLE;
+
+	return false;
+}
+
 static inline struct wheel_angle
 evdev_read_wheel_click_props(struct evdev_device *device)
 {
 	struct wheel_angle angles;
 
-	evdev_read_wheel_click_prop(device,
-				    "MOUSE_WHEEL_CLICK_ANGLE",
-				    &angles.x);
-	if (!evdev_read_wheel_click_prop(device,
-					 "MOUSE_WHEEL_CLICK_ANGLE_HORIZONTAL",
-					 &angles.y))
-		angles.y = angles.x;
+	/* CLICK_COUNT overrides CLICK_ANGLE */
+	if (!evdev_read_wheel_click_count_prop(device,
+					      "MOUSE_WHEEL_CLICK_COUNT",
+					      &angles.x))
+		evdev_read_wheel_click_prop(device,
+					    "MOUSE_WHEEL_CLICK_ANGLE",
+					    &angles.x);
+	if (!evdev_read_wheel_click_count_prop(device,
+					      "MOUSE_WHEEL_CLICK_COUNT_HORIZONTAL",
+					      &angles.y)) {
+		if (!evdev_read_wheel_click_prop(device,
+						 "MOUSE_WHEEL_CLICK_ANGLE_HORIZONTAL",
+						 &angles.y))
+			angles.y = angles.x;
+	}
 
 	return angles;
 }
diff --git a/src/libinput-private.h b/src/libinput-private.h
index 5b46da7..52f129a 100644
--- a/src/libinput-private.h
+++ b/src/libinput-private.h
@@ -73,7 +73,7 @@ struct normalized_range_coords {
 
 /* A pair of angles in degrees */
 struct wheel_angle {
-	int x, y;
+	double x, y;
 };
 
 /* A pair of angles in degrees */
diff --git a/src/libinput-util.c b/src/libinput-util.c
index 4b90fbb..6c051c3 100644
--- a/src/libinput-util.c
+++ b/src/libinput-util.c
@@ -176,6 +176,38 @@ parse_mouse_dpi_property(const char *prop)
 }
 
 /**
+ * Helper function to parse the MOUSE_WHEEL_CLICK_COUNT property from udev.
+ * Property is of the form:
+ * MOUSE_WHEEL_CLICK_COUNT=<integer>
+ * Where the number indicates the number of wheel clicks per 360 deg
+ * rotation.
+ *
+ * We skip preceding whitespaces and parse the first number seen. If
+ * multiple numbers are specified, we ignore those.
+ *
+ * @param prop The value of the udev property (without the MOUSE_WHEEL_CLICK_COUNT=)
+ * @return The click count of the wheel (may be negative) or 0 on error.
+ */
+int
+parse_mouse_wheel_click_count_property(const char *prop)
+{
+	int count = 0,
+	    nread = 0;
+
+	while(*prop != 0 && *prop == ' ')
+		prop++;
+
+	sscanf(prop, "%d%n", &count, &nread);
+	if (nread == 0 || count == 0 || abs(count) > 360)
+		return 0;
+	if (prop[nread] != ' ' && prop[nread] != '\0')
+		return 0;
+
+        return count;
+}
+
+/**
+ *
  * Helper function to parse the MOUSE_WHEEL_CLICK_ANGLE property from udev.
  * Property is of the form:
  * MOUSE_WHEEL_CLICK_ANGLE=<integer>
diff --git a/src/libinput-util.h b/src/libinput-util.h
index e31860d..b7bef80 100644
--- a/src/libinput-util.h
+++ b/src/libinput-util.h
@@ -370,6 +370,7 @@ enum ratelimit_state ratelimit_test(struct ratelimit *r);
 
 int parse_mouse_dpi_property(const char *prop);
 int parse_mouse_wheel_click_angle_property(const char *prop);
+int parse_mouse_wheel_click_count_property(const char *prop);
 double parse_trackpoint_accel_property(const char *prop);
 bool parse_dimension_property(const char *prop, size_t *width, size_t *height);
 
diff --git a/test/Makefile.am b/test/Makefile.am
index 7ff12e4..f4a9252 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -35,6 +35,7 @@ liblitest_la_SOURCES = \
 	litest-device-mouse-roccat.c \
 	litest-device-mouse-low-dpi.c \
 	litest-device-mouse-wheel-click-angle.c \
+	litest-device-mouse-wheel-click-count.c \
 	litest-device-ms-surface-cover.c \
 	litest-device-protocol-a-touch-screen.c \
 	litest-device-qemu-usb-tablet.c \
diff --git a/test/litest-device-mouse-wheel-click-count.c b/test/litest-device-mouse-wheel-click-count.c
new file mode 100644
index 0000000..419b702
--- /dev/null
+++ b/test/litest-device-mouse-wheel-click-count.c
@@ -0,0 +1,77 @@
+/*
+ * 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.
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "litest.h"
+#include "litest-int.h"
+
+static void litest_mouse_setup(void)
+{
+	struct litest_device *d = litest_create_device(LITEST_MOUSE_WHEEL_CLICK_COUNT);
+	litest_set_current_device(d);
+}
+
+static struct input_id input_id = {
+	.bustype = 0x3,
+	.vendor = 0x1234,
+	.product = 0x5678,
+};
+
+static int events[] = {
+	EV_KEY, BTN_LEFT,
+	EV_KEY, BTN_RIGHT,
+	EV_KEY, BTN_MIDDLE,
+	EV_REL, REL_X,
+	EV_REL, REL_Y,
+	EV_REL, REL_WHEEL,
+	-1 , -1,
+};
+
+static const char udev_rule[] =
+"ACTION==\"remove\", GOTO=\"wheel_click_count_end\"\n"
+"KERNEL!=\"event*\", GOTO=\"wheel_click_count_end\"\n"
+"\n"
+"ATTRS{name}==\"litest Wheel Click Count Mouse*\",\\\n"
+"    ENV{MOUSE_WHEEL_CLICK_ANGLE}=\"-15\",\n"
+"    ENV{MOUSE_WHEEL_CLICK_ANGLE_HORIZONTAL}=\"13\",\n\\"
+"    ENV{MOUSE_WHEEL_CLICK_COUNT}=\"-14\",\n"
+"    ENV{MOUSE_WHEEL_CLICK_COUNT_HORIZONTAL}=\"27\"\\\n"
+"\n"
+"LABEL=\"wheel_click_count_end\"";
+
+struct litest_test_device litest_mouse_wheel_click_count_device = {
+	.type = LITEST_MOUSE_WHEEL_CLICK_COUNT,
+	.features = LITEST_RELATIVE | LITEST_BUTTON | LITEST_WHEEL,
+	.shortname = "mouse-wheelclickcount",
+	.setup = litest_mouse_setup,
+	.interface = NULL,
+
+	.name = "Wheel Click Count Mouse",
+	.id = &input_id,
+	.absinfo = NULL,
+	.events = events,
+	.udev_rule = udev_rule,
+};
diff --git a/test/litest.c b/test/litest.c
index fd62d21..515eb18 100644
--- a/test/litest.c
+++ b/test/litest.c
@@ -402,6 +402,7 @@ extern struct litest_test_device litest_wacom_cintiq_13hdt_finger_device;
 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;
 
 struct litest_test_device* devices[] = {
 	&litest_synaptics_clickpad_device,
@@ -458,6 +459,7 @@ struct litest_test_device* devices[] = {
 	&litest_wacom_cintiq_13hdt_pen_device,
 	&litest_wacom_cintiq_13hdt_pad_device,
 	&litest_wacom_hid4800_tablet_device,
+	&litest_mouse_wheel_click_count_device,
 	NULL,
 };
 
diff --git a/test/litest.h b/test/litest.h
index 4602355..d52ebd2 100644
--- a/test/litest.h
+++ b/test/litest.h
@@ -224,6 +224,7 @@ enum litest_device_type {
 	LITEST_WACOM_CINTIQ_13HDT_PAD,
 	LITEST_WACOM_CINTIQ_13HDT_FINGER,
 	LITEST_WACOM_HID4800_PEN,
+	LITEST_MOUSE_WHEEL_CLICK_COUNT,
 };
 
 enum litest_device_feature {
diff --git a/test/misc.c b/test/misc.c
index 582d4fc..4afd4d0 100644
--- a/test/misc.c
+++ b/test/misc.c
@@ -750,6 +750,35 @@ START_TEST(wheel_click_parser)
 }
 END_TEST
 
+START_TEST(wheel_click_count_parser)
+{
+	struct parser_test tests[] = {
+		{ "1", 1 },
+		{ "10", 10 },
+		{ "-12", -12 },
+		{ "360", 360 },
+		{ "66 ", 66 },
+		{ "   100 ", 100 },
+
+		{ "0", 0 },
+		{ "-0", 0 },
+		{ "a", 0 },
+		{ "10a", 0 },
+		{ "10-", 0 },
+		{ "sadfasfd", 0 },
+		{ "361", 0 },
+		{ NULL, 0 }
+	};
+
+	int i, angle;
+
+	for (i = 0; tests[i].tag != NULL; i++) {
+		angle = parse_mouse_wheel_click_count_property(tests[i].tag);
+		ck_assert_int_eq(angle, tests[i].expected_value);
+	}
+}
+END_TEST
+
 struct parser_test_float {
 	char *tag;
 	double expected_value;
@@ -956,6 +985,7 @@ litest_setup_tests_misc(void)
 	litest_add_no_device("misc:ratelimit", ratelimit_helpers);
 	litest_add_no_device("misc:parser", dpi_parser);
 	litest_add_no_device("misc:parser", wheel_click_parser);
+	litest_add_no_device("misc:parser", wheel_click_count_parser);
 	litest_add_no_device("misc:parser", trackpoint_accel_parser);
 	litest_add_no_device("misc:parser", dimension_prop_parser);
 	litest_add_no_device("misc:time", time_conversion);
diff --git a/test/pointer.c b/test/pointer.c
index 175cb3b..4f33de5 100644
--- a/test/pointer.c
+++ b/test/pointer.c
@@ -473,14 +473,45 @@ START_TEST(pointer_button_auto_release)
 }
 END_TEST
 
-static inline int
+static inline double
+wheel_click_count(struct litest_device *dev, int which)
+{
+	struct udev_device *d;
+	const char *prop = NULL;
+	int count;
+	double angle = 0.0;
+
+	d = libinput_device_get_udev_device(dev->libinput_device);
+	litest_assert_ptr_notnull(d);
+
+	if (which == REL_HWHEEL)
+		prop = udev_device_get_property_value(d, "MOUSE_WHEEL_CLICK_COUNT_HORIZONTAL");
+	if(!prop)
+		prop = udev_device_get_property_value(d, "MOUSE_WHEEL_CLICK_COUNT");
+	if (!prop)
+		goto out;
+
+	count = parse_mouse_wheel_click_count_property(prop);
+	angle = 360.0/count;
+
+out:
+	udev_device_unref(d);
+	return angle;
+}
+
+static inline double
 wheel_click_angle(struct litest_device *dev, int which)
 {
 	struct udev_device *d;
 	const char *prop = NULL;
 	const int default_angle = 15;
-	int angle = default_angle;
+	double angle;
+
+	angle = wheel_click_count(dev, which);
+	if (angle != 0.0)
+		return angle;
 
+	angle = default_angle;
 	d = libinput_device_get_udev_device(dev->libinput_device);
 	litest_assert_ptr_notnull(d);
 
@@ -492,7 +523,7 @@ wheel_click_angle(struct litest_device *dev, int which)
 		goto out;
 
 	angle = parse_mouse_wheel_click_angle_property(prop);
-	if (angle == 0)
+	if (angle == 0.0)
 		angle = default_angle;
 
 out:
@@ -508,7 +539,7 @@ test_wheel_event(struct litest_device *dev, int which, int amount)
 	struct libinput_event_pointer *ptrev;
 	enum libinput_pointer_axis axis;
 
-	int scroll_step, expected, discrete;;
+	double scroll_step, expected, discrete;
 
 	scroll_step = wheel_click_angle(dev, which);
 	expected = amount * scroll_step;
@@ -535,10 +566,12 @@ test_wheel_event(struct litest_device *dev, int which, int amount)
 				     axis,
 				     LIBINPUT_POINTER_AXIS_SOURCE_WHEEL);
 
-	litest_assert_int_eq(libinput_event_pointer_get_axis_value(ptrev, axis),
-			 expected);
-	litest_assert_int_eq(libinput_event_pointer_get_axis_value_discrete(ptrev, axis),
-			     discrete);
+	litest_assert_double_eq(
+			libinput_event_pointer_get_axis_value(ptrev, axis),
+			expected);
+	litest_assert_double_eq(
+			libinput_event_pointer_get_axis_value_discrete(ptrev, axis),
+			discrete);
 	libinput_event_destroy(event);
 }
 

commit e0ccfc87f047ff3c5595e268869c071c0b48428d
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Thu Nov 3 14:01:17 2016 +1000

    doc: expand trackpoint pointer acceleration documentation a bit
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/doc/pointer-acceleration.dox b/doc/pointer-acceleration.dox
index 2fbb4cc..502bc7b 100644
--- a/doc/pointer-acceleration.dox
+++ b/doc/pointer-acceleration.dox
@@ -108,14 +108,33 @@ The image above shows the touchpad acceleration profile in comparison to the
 
 @section ptraccel-trackpoint Pointer acceleration on trackpoints
 
+Trackpoint hardware is quite varied in how it reacts to user pressure and
+unlike other devices it cannot easily be normalized for physical properties.
+Measuring pressure objectively across a variety of hardware is nontrivial.
+libinput relies on some sytem-wide configured properties, specifically the
+@ref udev_config. The two properties that influence trackpoint acceleration
+````POINTINGSTICK_CONST_ACCEL```` which is a constant factor applied to the
+trackpoint's motion data. For example, a factor of 3 will see all input data
+multipled by 3. This multiplication is done by libinput.
+
+Additionally, some trackpoints provide the ability to adjust the sensitivity in
+hardware by modifying a sysfs file on the serio node. The udev property
+````POINTINGSTICK_SENSITIVITY```` indicates the desired value, a udev
+builtin is expected to apply this to the device, i.e.  libinput does not
+handle this property. Once applied, the sensitivity adjusts the deltas
+coming out of the hardware.
+
 Trackpoint pointer acceleration uses the @ref ptraccel-low-dpi profile, with a
-constant deceleration factor taking the place of the DPI settings.
+constant acceleration factor taking the place of the DPI settings.
 
 @image html ptraccel-trackpoint.svg "Pointer acceleration curves for trackpoints"
 
 The image above shows the trackpoint acceleration profile in comparison to the
-@ref ptraccel-linear. The constant acceleration factor, usually applied by
-udev, shapes the acceleration profile.
+@ref ptraccel-linear.
+
+The constant acceleration factor, usually applied in
+@ref udev_config, shapes the acceleration profile and is pre-applied before
+any user-specific acceleration adjustments.
 
 @section ptraccel-profile-flat The flat pointer acceleration profile
 

commit 76008034ca04e8bf235f9be001c50176ade24479
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Wed Nov 2 21:11:00 2016 +1000

    evdev: add hwdb quirk for HP Compaq 6910
    
    Same as the HP Compat 8510, it doesn't send BTN_TOOL_DOUBLETAP/TRIPLETAP. This
    may be a general issue with those series but they're 6 years old now, so
    it's questionable to spend extra effort detecting them.
    
    https://bugs.freedesktop.org/show_bug.cgi?id=98538
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>

diff --git a/src/evdev.c b/src/evdev.c
index f423251..2412751 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -2143,6 +2143,7 @@ evdev_read_model_flags(struct evdev_device *device)
 		MODEL(TRACKBALL),
 		MODEL(APPLE_MAGICMOUSE),
 		MODEL(HP8510_TOUCHPAD),
+		MODEL(HP6910_TOUCHPAD),
 #undef MODEL
 		{ "ID_INPUT_TRACKBALL", EVDEV_MODEL_TRACKBALL },
 		{ NULL, EVDEV_MODEL_DEFAULT },
@@ -2712,9 +2713,11 @@ evdev_pre_configure_model_quirks(struct evdev_device *device)
 		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
+	 * https://bugzilla.redhat.com/show_bug.cgi?id=1351285 and
+	 * https://bugzilla.redhat.com/show_bug.cgi?id=98538
 	 */
-	if (device->model_flags & EVDEV_MODEL_HP8510_TOUCHPAD) {
+	if (device->model_flags &
+	    (EVDEV_MODEL_HP8510_TOUCHPAD|EVDEV_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);
 	}
diff --git a/src/evdev.h b/src/evdev.h
index 4e28e05..b811f51 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -120,6 +120,7 @@ enum evdev_device_model {
 	EVDEV_MODEL_TRACKBALL = (1 << 19),
 	EVDEV_MODEL_APPLE_MAGICMOUSE = (1 << 20),
 	EVDEV_MODEL_HP8510_TOUCHPAD = (1 << 21),
+	EVDEV_MODEL_HP6910_TOUCHPAD = (1 << 22),
 };
 
 struct mt_slot {
diff --git a/udev/90-libinput-model-quirks.hwdb b/udev/90-libinput-model-quirks.hwdb
index fed28e2..4bfc0f9 100644
--- a/udev/90-libinput-model-quirks.hwdb
+++ b/udev/90-libinput-model-quirks.hwdb
@@ -91,7 +91,11 @@ libinput:name:Cypress APA Trackpad ?cyapa?:dmi:*
 # HP
 ##########################################
 
-# HP 8510w
+# HP Compaq6910p
+libinput:name:SynPS/2 Synaptics TouchPad:dmi:*svnHewlett-Packard:*pnHPCompaq6910p*
+ LIBINPUT_MODEL_HP6910_TOUCHPAD=1
+
+# HP Compaq 8510w
 libinput:name:SynPS/2 Synaptics TouchPad:dmi:*svnHewlett-Packard:*pnHPCompaq8510w*
  LIBINPUT_MODEL_HP8510_TOUCHPAD=1
 

commit a58a9de70d7bc963006ba9ded049a2b97f0cdadd
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Wed Nov 2 10:45:39 2016 +1000

    evdev: actually ignore joysticks
    
    A joystick has ID_INPUT_JOYSTICK *and* ID_INPUT set, so we need to check for
    both.
    
    https://bugs.freedesktop.org/show_bug.cgi?id=98009
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>

diff --git a/src/evdev.c b/src/evdev.c
index d49b391..f423251 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -2468,7 +2468,7 @@ evdev_configure_device(struct evdev_device *device)
 
 	/* libwacom *adds* TABLET, TOUCHPAD but leaves JOYSTICK in place, so
 	   make sure we only ignore real joystick devices */
-	if ((udev_tags & EVDEV_UDEV_TAG_JOYSTICK) == udev_tags) {
+	if (udev_tags == (EVDEV_UDEV_TAG_INPUT|EVDEV_UDEV_TAG_JOYSTICK)) {
 		log_info(libinput,
 			 "input device '%s', %s is a joystick, ignoring\n",
 			 device->devname, devnode);
diff --git a/test/device.c b/test/device.c
index 4ed12d9..f44a988 100644
--- a/test/device.c
+++ b/test/device.c
@@ -1058,6 +1058,39 @@ START_TEST(abs_mt_device_missing_res)
 }
 END_TEST
 
+START_TEST(ignore_joystick)
+{
+	struct libinput *li;
+	struct libevdev_uinput *uinput;
+	struct libinput_device *device;
+	struct input_absinfo absinfo[] = {
+		{ ABS_X, 0, 10, 0, 0, 10 },
+		{ ABS_Y, 0, 10, 0, 0, 10 },
+		{ ABS_RX, 0, 10, 0, 0, 10 },
+		{ ABS_RY, 0, 10, 0, 0, 10 },
+		{ ABS_THROTTLE, 0, 2, 0, 0, 0 },
+		{ ABS_RUDDER, 0, 255, 0, 0, 0 },
+		{ -1, -1, -1, -1, -1, -1 }
+	};
+
+	li = litest_create_context();
+	litest_disable_log_handler(li);
+	litest_drain_events(li);
+
+	uinput = litest_create_uinput_abs_device("joystick test device", NULL,
+						 absinfo,
+						 EV_KEY, BTN_TRIGGER,
+						 EV_KEY, BTN_A,
+						 -1);
+	device = libinput_path_add_device(li,
+					  libevdev_uinput_get_devnode(uinput));
+	litest_assert_ptr_null(device);
+	libevdev_uinput_destroy(uinput);
+	litest_restore_log_handler(li);
+	libinput_unref(li);
+}
+END_TEST
+
 START_TEST(device_wheel_only)
 {
 	struct litest_device *dev = litest_current_device();
@@ -1464,6 +1497,7 @@ litest_setup_tests_device(void)
 	litest_add_ranged_no_device("device:invalid devices", abs_mt_device_no_range, &abs_mt_range);
 	litest_add_no_device("device:invalid devices", abs_device_missing_res);
 	litest_add_no_device("device:invalid devices", abs_mt_device_missing_res);
+	litest_add_no_device("device:invalid devices", ignore_joystick);
 
 	litest_add("device:wheel", device_wheel_only, LITEST_WHEEL, LITEST_RELATIVE|LITEST_ABSOLUTE|LITEST_TABLET);
 	litest_add_no_device("device:accelerometer", device_accelerometer);

commit e09705522a69d2de94d147f3482089275a8109df
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Tue Sep 13 16:57:25 2016 +1000

    udev: add the hwdb_parser.py test from systemd
    
    upstream for this file lives in systemd, any changes to the actual parser
    should flow back there.
    
    libinput's matches are fairly simple. We have the various LIBINPUT_MODEL_ tags
    that just take a "1" and the two attributes that are dimensions.
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>

diff --git a/configure.ac b/configure.ac
index 47e1594..0ae9b76 100644
--- a/configure.ac
+++ b/configure.ac
@@ -46,6 +46,10 @@ AC_PROG_CC_C99
 AC_PROG_CXX # Only used by build C++ test
 AC_PROG_GREP
 
+# Only used for testing the hwdb
+AM_PATH_PYTHON([3.0],, [:])
+AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != :])
+
 # Initialize libtool
 LT_PREREQ([2.2])
 LT_INIT
diff --git a/udev/Makefile.am b/udev/Makefile.am
index f06dc56..17ae0b8 100644
--- a/udev/Makefile.am
+++ b/udev/Makefile.am
@@ -41,3 +41,10 @@ DISTCLEANFILES = \
 		 80-libinput-device-groups.rules \
 		 90-libinput-model-quirks.rules 
 EXTRA_DIST = 80-libinput-test-device.rules
+
+if HAVE_PYTHON
+TESTS = parse_hwdb.py
+TEST_EXTENSIONS = .py
+PY_LOG_COMPILER = $(PYTHON)
+endif
+EXTRA_DIST += parse_hwdb.py
diff --git a/udev/parse_hwdb.py b/udev/parse_hwdb.py
new file mode 100755
index 0000000..99e9c59
--- /dev/null
+++ b/udev/parse_hwdb.py
@@ -0,0 +1,178 @@
+#!/usr/bin/python3
+# vim: set expandtab shiftwidth=4:
+# -*- Mode: python; coding: utf-8; indent-tabs-mode: nil -*- */
+#
+# ANY MODIFICATIONS TO THIS FILE SHOULD BE MERGED INTO THE SYSTEMD UPSTREAM
+#
+# This file is part of systemd. It is distributed under the MIT license, see
+# below.
+#
+# Copyright 2016 Zbigniew Jędrzejewski-Szmek
+#
+# The MIT License (MIT)
+#
+# 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 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.
+
+import functools
+import glob
+import string
+import sys
+import os
+
+try:
+    from pyparsing import (Word, White, Literal, ParserElement, Regex,
+                           LineStart, LineEnd,
+                           ZeroOrMore, OneOrMore, Combine, Or, Optional, Suppress, Group,
+                           nums, alphanums, printables,
+                           stringEnd, pythonStyleComment,
+                           ParseBaseException)
+except ImportError:
+    print('pyparsing is not available')
+    sys.exit(77)
+
+try:
+    from evdev.ecodes import ecodes
+except ImportError:
+    ecodes = None
+    print('WARNING: evdev is not available')
+
+EOL = LineEnd().suppress()
+EMPTYLINE = LineStart() + LineEnd()
+COMMENTLINE = pythonStyleComment + EOL
+INTEGER = Word(nums)
+REAL = Combine((INTEGER + Optional('.' + Optional(INTEGER))) ^ ('.' + INTEGER))
+UDEV_TAG = Word(string.ascii_uppercase, alphanums + '_')
+
+TYPES = {
+         'libinput': ('name', 'touchpad', 'mouse'),
+         }
+
+@functools.lru_cache()
+def hwdb_grammar():
+    ParserElement.setDefaultWhitespaceChars('')
+
+    prefix = Or(category + ':' + Or(conn) + ':'
+                for category, conn in TYPES.items())
+    matchline = Combine(prefix + Word(printables + ' ' + '®')) + EOL
+    propertyline = (White(' ', exact=1).suppress() +
+                    Combine(UDEV_TAG - '=' - Word(alphanums + '_=:@*.! ') - Optional(pythonStyleComment)) +
+                    EOL)
+    propertycomment = White(' ', exact=1) + pythonStyleComment + EOL
+
+    group = (OneOrMore(matchline('MATCHES*') ^ COMMENTLINE.suppress()) -
+             OneOrMore(propertyline('PROPERTIES*') ^ propertycomment.suppress()) -
+             (EMPTYLINE ^ stringEnd()).suppress() )
+    commentgroup = OneOrMore(COMMENTLINE).suppress() - EMPTYLINE.suppress()
+
+    grammar = OneOrMore(group('GROUPS*') ^ commentgroup) + stringEnd()
+
+    return grammar
+
+@functools.lru_cache()
+def property_grammar():
+    ParserElement.setDefaultWhitespaceChars(' ')
+
+    model_props = [Regex(r'LIBINPUT_MODEL_[_0-9A-Z]+')('NAME')
+                   - Suppress('=') -
+                   (Literal('1'))('VALUE')
+                  ]
+
+    dimension = INTEGER('X') + Suppress('x') + INTEGER('Y')
+    sz_props = (
+            ('LIBINPUT_ATTR_SIZE_HINT', Group(dimension('SETTINGS*'))),
+            ('LIBINPUT_ATTR_RESOLUTION_HINT', Group(dimension('SETTINGS*'))),
+            )
+    size_props = [Literal(name)('NAME') - Suppress('=') - val('VALUE')
+                   for name, val in sz_props]
+
+    grammar = Or(model_props + size_props);
+
+    return grammar
+
+ERROR = False
+def error(fmt, *args, **kwargs):
+    global ERROR
+    ERROR = True
+    print(fmt.format(*args, **kwargs))
+
+def convert_properties(group):
+    matches = [m[0] for m in group.MATCHES]
+    props = [p[0] for p in group.PROPERTIES]
+    return matches, props
+
+def parse(fname):
+    grammar = hwdb_grammar()
+    try:
+        parsed = grammar.parseFile(fname)
+    except ParseBaseException as e:
+        error('Cannot parse {}: {}', fname, e)
+        return []
+    return [convert_properties(g) for g in parsed.GROUPS]
+
+def check_match_uniqueness(groups):
+    matches = sum((group[0] for group in groups), [])
+    matches.sort()
+    prev = None
+    for match in matches:
+        if match == prev:
+            error('Match {!r} is duplicated', match)
+        prev = match
+
+def check_one_dimension(prop, value):
+    if int(value[0]) <= 0 or int(value[1]) <= 0:
+        error('Dimension {} invalid', value)
+
+def check_properties(groups):
+    grammar = property_grammar()
+    for matches, props in groups:
+        prop_names = set()
+        for prop in props:
+            # print('--', prop)
+            prop = prop.partition('#')[0].rstrip()
+            try:
+                parsed = grammar.parseString(prop)
+            except ParseBaseException as e:
+                error('Failed to parse: {!r}', prop)
+                continue
+            # print('{!r}'.format(parsed))
+            if parsed.NAME in prop_names:
+                error('Property {} is duplicated', parsed.NAME)
+            prop_names.add(parsed.NAME)
+            if parsed.NAME == "LIBINPUT_ATTR_SIZE_HINT" or \
+               parsed.NAME == "LIBINPUT_ATTR_RESOLUTION_HINT":
+                check_one_dimension(prop, parsed.VALUE)
+
+def print_summary(fname, groups):
+    print('{}: {} match groups, {} matches, {} properties'
+          .format(fname,
+                  len(groups),
+                  sum(len(matches) for matches, props in groups),
+                  sum(len(props) for matches, props in groups),
+          ))
+
+if __name__ == '__main__':
+    args = sys.argv[1:] or glob.glob(os.path.dirname(sys.argv[0]) + '/*.hwdb')
+
+    for fname in args:
+        groups = parse(fname)
+        print_summary(fname, groups)
+        check_match_uniqueness(groups)
+        check_properties(groups)
+
+    sys.exit(ERROR)

commit 63990614b055ce9f5935d413ec9d5bf5ee1f7caf
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Mon Jan 4 10:55:37 2016 +1000

    Move touch_notify_frame declaration to the other touch functions
    
    No functional changes
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>

diff --git a/src/libinput-private.h b/src/libinput-private.h
index 28656e0..5b46da7 100644
--- a/src/libinput-private.h
+++ b/src/libinput-private.h
@@ -530,6 +530,10 @@ touch_notify_touch_up(struct libinput_device *device,
 		      int32_t seat_slot);
 
 void
+touch_notify_frame(struct libinput_device *device,
+		   uint64_t time);
+
+void
 gesture_notify_swipe(struct libinput_device *device,
 		     uint64_t time,
 		     enum libinput_event_type type,
@@ -561,10 +565,6 @@ gesture_notify_pinch_end(struct libinput_device *device,
 			 int cancelled);
 
 void
-touch_notify_frame(struct libinput_device *device,
-		   uint64_t time);
-
-void
 tablet_notify_axis(struct libinput_device *device,
 		   uint64_t time,
 		   struct libinput_tablet_tool *tool,

commit 418a910092525af82dcea571c6c52cd30c07793c
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Mon Jan 4 10:49:23 2016 +1000

    Add missing event type checks to libinput_event_gesture_get_base_event
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>

diff --git a/src/libinput.c b/src/libinput.c
index 6ad497e..1e97ad1 100644
--- a/src/libinput.c
+++ b/src/libinput.c
@@ -3032,6 +3032,16 @@ libinput_event_touch_get_base_event(struct libinput_event_touch *event)
 LIBINPUT_EXPORT struct libinput_event *
 libinput_event_gesture_get_base_event(struct libinput_event_gesture *event)
 {
+	require_event_type(libinput_event_get_context(&event->base),
+			   event->base.type,
+			   NULL,
+			   LIBINPUT_EVENT_GESTURE_SWIPE_BEGIN,
+			   LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE,
+			   LIBINPUT_EVENT_GESTURE_SWIPE_END,
+			   LIBINPUT_EVENT_GESTURE_PINCH_BEGIN,
+			   LIBINPUT_EVENT_GESTURE_PINCH_UPDATE,
+			   LIBINPUT_EVENT_GESTURE_PINCH_END);
+
 	return &event->base;
 }
 

commit 3ef9b7fea549241d81a5e2f92bfca0f2e532c098
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Mon Jan 4 10:00:03 2016 +1000

    touchpad: check for trackpoint/keyboard at the top of the helpers
    
    No functional changes, just to filter out devices that don't match
    immediately.
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>

diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index 2ee0f79..d72cb19 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -1509,6 +1509,9 @@ tp_dwt_pair_keyboard(struct evdev_device *touchpad,
 	struct tp_dispatch *tp = (struct tp_dispatch*)touchpad->dispatch;
 	unsigned int bus_kbd = libevdev_get_id_bustype(keyboard->evdev);
 
+	if ((keyboard->tags & EVDEV_TAG_KEYBOARD) == 0)
+		return;
+


Reply to: