Package: release.debian.org
Severity: normal
Tags: buster
User: [email protected]
Usertags: pu

Hi Stable Release Managers,

libinput in buster is affected by the bug #952700 (fixed in unstable
already back when the new version was uploaded) and can be described
as:

libinput has an issue which was reported upstream in
https://gitlab.freedesktop.org/libinput/libinput/issues/291 and makes
external lenovo keyboard trackpoint and mouse buttons erroneously
suspended in yoga tablet mode. The pointing stick gets disabled on
tablet mode switch.

I was able to test the respective bug in the given combination.

Attached is the proposed debdiff for this update.

Regards,
Salvatore
diff -Nru libinput-1.12.6/debian/changelog libinput-1.12.6/debian/changelog
--- libinput-1.12.6/debian/changelog    2019-03-31 03:42:45.000000000 +0200
+++ libinput-1.12.6/debian/changelog    2020-02-27 21:27:20.000000000 +0100
@@ -1,3 +1,10 @@
+libinput (1.12.6-2+deb10u1) buster; urgency=medium
+
+  * Non-maintainer upload.
+  * quirks: add trackpoint integration attribute (Closes: #952700)
+
+ -- Salvatore Bonaccorso <[email protected]>  Thu, 27 Feb 2020 21:27:20 +0100
+
 libinput (1.12.6-2) unstable; urgency=medium
 
   * Ship /usr/share/libinput in the udeb, since that's now needed by the
diff -Nru 
libinput-1.12.6/debian/patches/quirks-add-trackpoint-integration-attribute.patch
 
libinput-1.12.6/debian/patches/quirks-add-trackpoint-integration-attribute.patch
--- 
libinput-1.12.6/debian/patches/quirks-add-trackpoint-integration-attribute.patch
    1970-01-01 01:00:00.000000000 +0100
+++ 
libinput-1.12.6/debian/patches/quirks-add-trackpoint-integration-attribute.patch
    2020-02-27 21:27:20.000000000 +0100
@@ -0,0 +1,224 @@
+From: Peter Hutterer <[email protected]>
+Date: Tue, 28 May 2019 09:54:27 +1000
+Subject: quirks: add trackpoint integration attribute
+Origin: 
https://gitlab.freedesktop.org/libinput/libinput/commit/6e60f8fb19cad03747b877dfcf587d9684dfc6f7
+Bug: https://gitlab.freedesktop.org/libinput/libinput/issues/291
+Bug-Debian: https://bugs.debian.org/952700
+
+Some versions [1] of the Lenovo ThinkPad Compact USB Keyboard with TrackPoint 
USB
+have the pointing stick on an event node that has keys but is not a regular
+keyboard. Thus the stick falls through the cracks and gets disabled on tablet
+mode switch. Instead of adding more hacks let's do this properly: tag the
+pointing stick as external and have the code in place to deal with that.
+
+[1] This may be caused by recent kernel changes
+
+Fixes #291
+
+Signed-off-by: Peter Hutterer <[email protected]>
+(cherry picked from commit 8dfe8c68eb9bde9eecc7de5665903d258df42272)
+---
+ doc/user/device-quirks.rst     |  3 +++
+ quirks/50-system-lenovo.quirks |  9 ++++++++-
+ src/evdev-fallback.c           | 14 +++++++++-----
+ src/evdev.c                    | 32 ++++++++++++++++++++++++++++----
+ src/quirks.c                   |  8 ++++++++
+ src/quirks.h                   |  1 +
+ test/test-quirks.c             | 34 ++++++++++++++++++++++++++++++++++
+ 7 files changed, 91 insertions(+), 10 deletions(-)
+
+--- a/doc/user/device-quirks.rst
++++ b/doc/user/device-quirks.rst
+@@ -181,3 +181,6 @@ AttrEventCodeDisable=EV_ABS;BTN_STYLUS;E
+     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.
++AttrPointingStickIntegration=internal|external
++    Indicates the integration of the pointing stick. This is a string enum.
++    Only needed for external pointing sticks. These are rare.
+--- a/quirks/50-system-lenovo.quirks
++++ b/quirks/50-system-lenovo.quirks
+@@ -59,13 +59,20 @@ MatchDMIModalias=dmi:*svnLENOVO:*:pvrThi
+ ModelLenovoT450Touchpad=1
+ AttrPalmPressureThreshold=150
+ 
+-[Lenovo ThinkPad Compact USB Keyboard with TrackPoint]
++[Lenovo ThinkPad Compact USB Keyboard with TrackPoint (keyboard)]
+ MatchUdevType=keyboard
+ MatchBus=usb
+ MatchVendor=0x17EF
+ MatchProduct=0x6047
+ AttrKeyboardIntegration=external
+ 
++[Lenovo ThinkPad Compact USB Keyboard with TrackPoint (trackpoint)]
++MatchUdevType=pointingstick
++MatchBus=usb
++MatchVendor=0x17EF
++MatchProduct=0x6047
++AttrPointingStickIntegration=external
++
+ # Lenovo Thinkpad Yoga (not the consumer versions) disables the keyboard
+ # mechanically. We must not disable the keyboard because some keys are
+ # still accessible on the screen and volume rocker.
+--- a/src/evdev-fallback.c
++++ b/src/evdev-fallback.c
+@@ -1313,8 +1313,8 @@ fallback_tablet_mode_switch_event(uint64
+ }
+ 
+ static void
+-fallback_keyboard_pair_tablet_mode(struct evdev_device *keyboard,
+-                                 struct evdev_device *tablet_mode_switch)
++fallback_pair_tablet_mode(struct evdev_device *keyboard,
++                        struct evdev_device *tablet_mode_switch)
+ {
+       struct fallback_dispatch *dispatch =
+               fallback_dispatch(keyboard->dispatch);
+@@ -1322,8 +1322,12 @@ fallback_keyboard_pair_tablet_mode(struc
+       if ((keyboard->tags & EVDEV_TAG_EXTERNAL_KEYBOARD))
+               return;
+ 
+-      if ((keyboard->tags &
+-           (EVDEV_TAG_TRACKPOINT|EVDEV_TAG_INTERNAL_KEYBOARD)) == 0)
++      if ((keyboard->tags & EVDEV_TAG_TRACKPOINT)) {
++              if (keyboard->tags & EVDEV_TAG_EXTERNAL_MOUSE)
++                      return;
++      /* This filters out all internal keyboard-like devices (Video
++       * Switch) */
++      } else if ((keyboard->tags & EVDEV_TAG_INTERNAL_KEYBOARD) == 0)
+               return;
+ 
+       if (evdev_device_has_model_quirk(keyboard,
+@@ -1360,7 +1364,7 @@ fallback_interface_device_added(struct e
+                               struct evdev_device *added_device)
+ {
+       fallback_lid_pair_keyboard(device, added_device);
+-      fallback_keyboard_pair_tablet_mode(device, added_device);
++      fallback_pair_tablet_mode(device, added_device);
+ }
+ 
+ static void
+--- a/src/evdev.c
++++ b/src/evdev.c
+@@ -387,10 +387,34 @@ static void
+ evdev_tag_trackpoint(struct evdev_device *device,
+                    struct udev_device *udev_device)
+ {
+-      if (libevdev_has_property(device->evdev,
+-                                INPUT_PROP_POINTING_STICK) ||
+-          parse_udev_flag(device, udev_device, "ID_INPUT_POINTINGSTICK"))
+-              device->tags |= EVDEV_TAG_TRACKPOINT;
++      struct quirks_context *quirks;
++      struct quirks *q;
++      char *prop;
++
++      if (!libevdev_has_property(device->evdev,
++                                INPUT_PROP_POINTING_STICK) &&
++          !parse_udev_flag(device, udev_device, "ID_INPUT_POINTINGSTICK"))
++              return;
++
++      device->tags |= EVDEV_TAG_TRACKPOINT;
++
++      quirks = evdev_libinput_context(device)->quirks;
++      q = quirks_fetch_for_device(quirks, device->udev_device);
++      if (q && quirks_get_string(q, QUIRK_ATTR_TRACKPOINT_INTEGRATION, 
&prop)) {
++              if (streq(prop, "internal")) {
++                      /* noop, this is the default anyway */
++              } else if (streq(prop, "external")) {
++                      device->tags |= EVDEV_TAG_EXTERNAL_MOUSE;
++                      evdev_log_info(device,
++                                     "is an external pointing stick\n");
++              } else {
++                      evdev_log_info(device,
++                                     "tagged with unknown value %s\n",
++                                     prop);
++              }
++      }
++
++      quirks_unref(q);
+ }
+ 
+ static inline void
+--- a/src/quirks.c
++++ b/src/quirks.c
+@@ -259,6 +259,7 @@ quirk_get_name(enum quirk q)
+       case QUIRK_ATTR_PALM_SIZE_THRESHOLD:            return 
"AttrPalmSizeThreshold";
+       case QUIRK_ATTR_LID_SWITCH_RELIABILITY:         return 
"AttrLidSwitchReliability";
+       case QUIRK_ATTR_KEYBOARD_INTEGRATION:           return 
"AttrKeyboardIntegration";
++      case QUIRK_ATTR_TRACKPOINT_INTEGRATION:         return 
"AttrPointingStickIntegration";
+       case QUIRK_ATTR_TPKBCOMBO_LAYOUT:               return 
"AttrTPKComboLayout";
+       case QUIRK_ATTR_PRESSURE_RANGE:                 return 
"AttrPressureRange";
+       case QUIRK_ATTR_PALM_PRESSURE_THRESHOLD:        return 
"AttrPalmPressureThreshold";
+@@ -654,6 +655,13 @@ parse_attr(struct quirks_context *ctx,
+               if (!streq(value, "internal") && !streq(value, "external"))
+                       goto out;
+               p->type = PT_STRING;
++              p->value.s = safe_strdup(value);
++              rc = true;
++      } else if (streq(key, 
quirk_get_name(QUIRK_ATTR_TRACKPOINT_INTEGRATION))) {
++              p->id = QUIRK_ATTR_TRACKPOINT_INTEGRATION;
++              if (!streq(value, "internal") && !streq(value, "external"))
++                      goto out;
++              p->type = PT_STRING;
+               p->value.s = safe_strdup(value);
+               rc = true;
+       } else if (streq(key, quirk_get_name(QUIRK_ATTR_TPKBCOMBO_LAYOUT))) {
+--- a/src/quirks.h
++++ b/src/quirks.h
+@@ -94,6 +94,7 @@ enum quirk {
+       QUIRK_ATTR_PALM_SIZE_THRESHOLD,
+       QUIRK_ATTR_LID_SWITCH_RELIABILITY,
+       QUIRK_ATTR_KEYBOARD_INTEGRATION,
++      QUIRK_ATTR_TRACKPOINT_INTEGRATION,
+       QUIRK_ATTR_TPKBCOMBO_LAYOUT,
+       QUIRK_ATTR_PRESSURE_RANGE,
+       QUIRK_ATTR_PALM_PRESSURE_THRESHOLD,
+--- a/test/test-quirks.c
++++ b/test/test-quirks.c
+@@ -1204,6 +1204,39 @@ START_TEST(quirks_parse_string_attr)
+ }
+ END_TEST
+ 
++START_TEST(quirks_parse_integration_attr)
++{
++      struct litest_device *dev = litest_current_device();
++      char *do_not_use; /* freed before we can use it */
++      bool
++
++      rc = test_attr_parse(dev,
++                           QUIRK_ATTR_KEYBOARD_INTEGRATION,
++                           "internal",
++                           (qparsefunc)quirks_get_string,
++                           &do_not_use);
++      ck_assert(rc);
++      rc = test_attr_parse(dev,
++                           QUIRK_ATTR_KEYBOARD_INTEGRATION,
++                           "external",
++                           (qparsefunc)quirks_get_string,
++                           &do_not_use);
++      ck_assert(rc);
++      rc = test_attr_parse(dev,
++                           QUIRK_ATTR_TRACKPOINT_INTEGRATION,
++                           "internal",
++                           (qparsefunc)quirks_get_string,
++                           &do_not_use);
++      ck_assert(rc);
++      rc = test_attr_parse(dev,
++                           QUIRK_ATTR_TRACKPOINT_INTEGRATION,
++                           "external",
++                           (qparsefunc)quirks_get_string,
++                           &do_not_use);
++      ck_assert(rc);
++}
++END_TEST
++
+ START_TEST(quirks_model_one)
+ {
+       struct litest_device *dev = litest_current_device();
+@@ -1432,6 +1465,7 @@ TEST_COLLECTION(quirks)
+       litest_add_for_device("quirks:parsing", quirks_parse_uint_attr, 
LITEST_MOUSE);
+       litest_add_for_device("quirks:parsing", quirks_parse_double_attr, 
LITEST_MOUSE);
+       litest_add_for_device("quirks:parsing", quirks_parse_string_attr, 
LITEST_MOUSE);
++      litest_add_for_device("quirks:parsing", quirks_parse_integration_attr, 
LITEST_MOUSE);
+ 
+       litest_add_for_device("quirks:model", quirks_model_one, LITEST_MOUSE);
+       litest_add_for_device("quirks:model", quirks_model_zero, LITEST_MOUSE);
diff -Nru libinput-1.12.6/debian/patches/series 
libinput-1.12.6/debian/patches/series
--- libinput-1.12.6/debian/patches/series       1970-01-01 01:00:00.000000000 
+0100
+++ libinput-1.12.6/debian/patches/series       2020-02-27 21:27:20.000000000 
+0100
@@ -0,0 +1 @@
+quirks-add-trackpoint-integration-attribute.patch

Reply via email to