configure.ac       |    2 -
 src/xf86libinput.c |   58 +++++++++++++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 57 insertions(+), 3 deletions(-)

New commits:
commit 728217775626e2086d7c3acd0d242562390f145b
Author: Peter Hutterer <peter.hutte...@who-t.net>
Date:   Wed Oct 19 10:55:12 2016 +1000

    xf86-input-libinput 0.22.0
    
    Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net>

diff --git a/configure.ac b/configure.ac
index 3fad444..9894817 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
 # Initialize Autoconf
 AC_PREREQ([2.60])
 AC_INIT([xf86-input-libinput],
-        [0.21.0],
+        [0.22.0],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
         [xf86-input-libinput])
 AC_CONFIG_SRCDIR([Makefile.am])

commit 1dd61abf7e6af9cdd12d8f5a35fe90954aa03e64
Author: Peter Hutterer <peter.hutte...@who-t.net>
Date:   Wed Oct 19 10:37:32 2016 +1000

    Wrap the input_lock calls into ifdefs
    
    Missing from a790ff35f9
    
    Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net>

diff --git a/src/xf86libinput.c b/src/xf86libinput.c
index 061e495..24219a6 100644
--- a/src/xf86libinput.c
+++ b/src/xf86libinput.c
@@ -1158,12 +1158,20 @@ swap_registered_device(InputInfoPtr pInfo)
        while (next == pInfo || !is_libinput_device(next))
                next = next->next;
 
+#if HAVE_THREADED_INPUT
        input_lock();
+#else
+       int sigstate = xf86BlockSIGIO();
+#endif
        xf86RemoveEnabledDevice(pInfo);
        if (next) /* shouldn't ever be NULL anyway */
                xf86AddEnabledDevice(next);
        driver_context.registered_InputInfoPtr = next;
+#if HAVE_THREADED_INPUT
        input_unlock();
+#else
+       xf86UnblockSIGIO(sigstate);
+#endif
 }
 
 static void

commit c80954386d536b83f2c9290e1a88515c04505818
Author: Peter Hutterer <peter.hutte...@who-t.net>
Date:   Wed Oct 19 09:24:37 2016 +1000

    xf86-input-libinput 0.21.0
    
    Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net>

diff --git a/configure.ac b/configure.ac
index a1f80fe..3fad444 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
 # Initialize Autoconf
 AC_PREREQ([2.60])
 AC_INIT([xf86-input-libinput],
-        [0.20.0],
+        [0.21.0],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
         [xf86-input-libinput])
 AC_CONFIG_SRCDIR([Makefile.am])

commit a790ff35f90e459fe03e0c78ab6f4e9dd5045dd0
Author: Peter Hutterer <peter.hutte...@who-t.net>
Date:   Fri Oct 14 17:00:41 2016 +1000

    Swap the registered input device on DEVICE_OFF when needed
    
    If we don't swap out the pInfo previously passed to xf86AddEnabledDevice(),
    the thread eventually calls read_input on a struct that has been deleted.
    Avoid this by swapping out the to-be-destroyed pInfo with the first one we
    find.
    
    Reproducer: sudo udevadm trigger --type=devices --action=add
    
    Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net>
    Reviewed-by: Hans de Goede <hdego...@redhat.com>

diff --git a/src/xf86libinput.c b/src/xf86libinput.c
index 69f7ae3..061e495 100644
--- a/src/xf86libinput.c
+++ b/src/xf86libinput.c
@@ -87,6 +87,7 @@
 struct xf86libinput_driver {
        struct libinput *libinput;
        int device_enabled_count;
+       void *registered_InputInfoPtr;
 };
 
 static struct xf86libinput_driver driver_context;
@@ -583,6 +584,7 @@ xf86libinput_on(DeviceIntPtr dev)
        if (driver_context.device_enabled_count == 0) {
 #if HAVE_THREADED_INPUT
                xf86AddEnabledDevice(pInfo);
+               driver_context.registered_InputInfoPtr = pInfo;
 #else
                /* Can't use xf86AddEnabledDevice on an epollfd */
                AddEnabledDevice(pInfo->fd);
@@ -1131,6 +1133,39 @@ xf86libinput_init(DeviceIntPtr dev)
        return 0;
 }
 
+static bool
+is_libinput_device(InputInfoPtr pInfo)
+{
+       char *driver;
+       BOOL rc;
+
+       driver = xf86CheckStrOption(pInfo->options, "driver", "");
+       rc = strcmp(driver, "libinput") == 0;
+       free(driver);
+
+       return rc;
+}
+
+static void
+swap_registered_device(InputInfoPtr pInfo)
+{
+       InputInfoPtr next;
+
+       if (pInfo != driver_context.registered_InputInfoPtr)
+               return;
+
+       next = xf86FirstLocalDevice();
+       while (next == pInfo || !is_libinput_device(next))
+               next = next->next;
+
+       input_lock();
+       xf86RemoveEnabledDevice(pInfo);
+       if (next) /* shouldn't ever be NULL anyway */
+               xf86AddEnabledDevice(next);
+       driver_context.registered_InputInfoPtr = next;
+       input_unlock();
+}
+
 static void
 xf86libinput_destroy(DeviceIntPtr dev)
 {
@@ -1138,6 +1173,17 @@ xf86libinput_destroy(DeviceIntPtr dev)
        struct xf86libinput *driver_data = pInfo->private;
        struct xf86libinput_device *shared_device = driver_data->shared_device;
 
+       /* If the device being destroyed is the one we used for
+        * xf86AddEnabledDevice(), we need to swap it out for one that is
+        * still live. xf86AddEnabledDevice() buffers some data and once the
+        * deletes pInfo (when DEVICE_OFF completes) the thread will keep
+        * calling that struct's read_input because we never removed it.
+        * Avoid this by removing ours and substituting one that's still
+        * valid, the fd is the same anyway (libinput's epollfd).
+        */
+       if (driver_context.device_enabled_count > 0)
+               swap_registered_device(pInfo);
+
        xorg_list_del(&driver_data->shared_device_link);
 
        if (driver_data->tablet_tool)

commit 6318ac420b644c7f7a6f2c8e47a64238a4afebeb
Author: Peter Hutterer <peter.hutte...@who-t.net>
Date:   Fri Oct 14 13:34:56 2016 +1000

    Fix tap button map option handling
    
    Copy/paste error
    
    https://bugs.freedesktop.org/show_bug.cgi?id=97989
    
    Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net>

diff --git a/src/xf86libinput.c b/src/xf86libinput.c
index 21f87f5..69f7ae3 100644
--- a/src/xf86libinput.c
+++ b/src/xf86libinput.c
@@ -2146,10 +2146,10 @@ xf86libinput_parse_tap_buttonmap_option(InputInfoPtr 
pInfo,
                free(str);
        }
 
-       if (libinput_device_config_send_events_set_mode(device, map) !=
+       if (libinput_device_config_tap_set_button_map(device, map) !=
            LIBINPUT_CONFIG_STATUS_SUCCESS) {
                xf86IDrvMsg(pInfo, X_ERROR,
-                           "Failed to set Tapping Drag Lock to %d\n",
+                           "Failed to set Tapping Button Map to %d\n",
                            map);
                map = libinput_device_config_tap_get_button_map(device);
        }

Reply via email to