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

xserver-xorg-input-synaptics: Changes to 'upstream-unstable'



Rebased ref, commits from common ancestor:
commit ddd8844a47bfa28974e40fc9aec9b17656415a6c
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Mon May 19 08:06:46 2014 +1000

    eventcomm: Drop requirement for a grab during init
    
    When we required a grab on the device, this was a shortcut so we didn't have
    to query the device only to realise we can't read events off it anyway. Now
    that we don't actually grab the device by default, this is unnecessary.
    
    Something else may have a temporary grab on the device during init, in which
    case we just continue as usual and read events if and when they become
    available.
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>

diff --git a/src/eventcomm.c b/src/eventcomm.c
index 37de38a..2ee072b 100644
--- a/src/eventcomm.c
+++ b/src/eventcomm.c
@@ -278,49 +278,33 @@ EventDeviceOffHook(InputInfoPtr pInfo)
  * - BTN_TOOL_PEN is _not_ set
  *
  * @param evdev Libevdev handle
- * @param test_grab If true, test whether an EVIOCGRAB is possible on the
- * device. A failure to grab the event device returns in a failure.
  *
  * @return TRUE if the device is a touchpad or FALSE otherwise.
  */
 static Bool
-event_query_is_touchpad(struct libevdev *evdev, BOOL test_grab)
+event_query_is_touchpad(struct libevdev *evdev)
 {
-    int ret = FALSE, rc;
-
-    if (test_grab) {
-        rc = libevdev_grab(evdev, LIBEVDEV_GRAB);
-        if (rc < 0)
-            return FALSE;
-    }
-
     /* Check for ABS_X, ABS_Y, ABS_PRESSURE and BTN_TOOL_FINGER */
     if (!libevdev_has_event_type(evdev, EV_SYN) ||
         !libevdev_has_event_type(evdev, EV_ABS) ||
         !libevdev_has_event_type(evdev, EV_KEY))
-        goto unwind;
+        return FALSE;
 
     if (!libevdev_has_event_code(evdev, EV_ABS, ABS_X) ||
         !libevdev_has_event_code(evdev, EV_ABS, ABS_Y))
-        goto unwind;
+        return FALSE;
 
     /* we expect touchpad either report raw pressure or touches */
     if (!libevdev_has_event_code(evdev, EV_KEY, BTN_TOUCH) &&
         !libevdev_has_event_code(evdev, EV_ABS, ABS_PRESSURE))
-        goto unwind;
+        return FALSE;
 
     /* all Synaptics-like touchpad report BTN_TOOL_FINGER */
     if (!libevdev_has_event_code(evdev, EV_KEY, BTN_TOOL_FINGER) ||
         libevdev_has_event_code(evdev, EV_ABS, BTN_TOOL_PEN)) /* Don't match wacom tablets */
-        goto unwind;
-
-    ret = TRUE;
-
- unwind:
-    if (test_grab)
-        libevdev_grab(evdev, LIBEVDEV_UNGRAB);
+        return FALSE;
 
-    return (ret == TRUE);
+    return TRUE;
 }
 
 #define PRODUCT_ANY 0x0000
@@ -512,8 +496,7 @@ EventQueryHardware(InputInfoPtr pInfo)
     SynapticsPrivate *priv = (SynapticsPrivate *) pInfo->private;
     struct eventcomm_proto_data *proto_data = priv->proto_data;
 
-    if (!event_query_is_touchpad(proto_data->evdev,
-                                 (proto_data) ? proto_data->need_grab : TRUE))
+    if (!event_query_is_touchpad(proto_data->evdev))
         return FALSE;
 
     xf86IDrvMsg(pInfo, X_PROBED, "touchpad found\n");
@@ -912,7 +895,7 @@ EventReadDevDimensions(InputInfoPtr pInfo)
         proto_data->axis_map[i] = -1;
     proto_data->cur_slot = -1;
 
-    if (event_query_is_touchpad(proto_data->evdev, proto_data->need_grab)) {
+    if (event_query_is_touchpad(proto_data->evdev)) {
         event_query_touch(pInfo);
         event_query_axis_ranges(pInfo);
     }
@@ -946,7 +929,7 @@ EventAutoDevProbe(InputInfoPtr pInfo, const char *device)
 
             rc = libevdev_new_from_fd(fd, &evdev);
             if (rc >= 0) {
-                touchpad_found = event_query_is_touchpad(evdev, TRUE);
+                touchpad_found = event_query_is_touchpad(evdev);
                 libevdev_free(evdev);
             }
 
@@ -988,7 +971,7 @@ EventAutoDevProbe(InputInfoPtr pInfo, const char *device)
 
             rc = libevdev_new_from_fd(fd, &evdev);
             if (rc >= 0) {
-                touchpad_found = event_query_is_touchpad(evdev, TRUE);
+                touchpad_found = event_query_is_touchpad(evdev);
                 libevdev_free(evdev);
                 if (touchpad_found) {
                     xf86IDrvMsg(pInfo, X_PROBED, "auto-dev sets device to %s\n",

commit 3a4cc96590ca0e0ff526a5e5406f29a402bddd1a
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Tue May 13 11:20:25 2014 +1000

    synaptics 1.8.0
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/configure.ac b/configure.ac
index 712d48d..91b3eda 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
 # Initialize Autoconf
 AC_PREREQ([2.60])
 AC_INIT([xf86-input-synaptics],
-        [1.7.99.2],
+        [1.8.0],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
         [xf86-input-synaptics])
 AC_CONFIG_SRCDIR([Makefile.am])

commit d4d7229c41a20cf6757882a24f45e28d936a27c5
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Wed Apr 30 13:08:53 2014 +1000

    conf: drop the PNPID matching from the fdi file
    
    Rely on INPUT_PROP_TOP_BUTTONPAD and default button areas as well.
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/conf/11-x11-synaptics.fdi b/conf/11-x11-synaptics.fdi
index 8145912..ab8156d 100644
--- a/conf/11-x11-synaptics.fdi
+++ b/conf/11-x11-synaptics.fdi
@@ -31,18 +31,10 @@
 	For other possible options, check CONFIGURATION DETAILS in synaptics man page
         -->
         <merge key="input.x11_options.SoftButtonAreas" type="string">50% 0 82% 0 0 0 0 0</merge>
+        <merge key="input.x11_options.SecondarySoftButtonAreas" type="string">58% 0 0 8% 42% 58% 0 8%</merge>
         <match key="info.product" contains="Apple|bcm5974">
             <merge key="input.x11_options.SoftButtonAreas" type="string">0 0 0 0 0 0 0 0</merge>
         </match>
     </match>
-
-    <match
-        key="/org/freedesktop/Hal/devices/computer:system.hardware.version"
-        contains_outof="ThinkPad T440;ThinkPad X240;ThinkPad T540;ThinkPad Helix;ThinkPad S1 Yoga;ThinkPad L440;ThinkPad X1 Carbon 2nd;ThinkPad T431;ThinkPad L540">
-        <match key="input.product" contains="Synaptics">
-            <merge key="input.x11_options.ClickPad" type="string">on</merge>
-            <merge key="input.x11_options.SecondarySoftButtonAreas" type="string">58% 0 0 8% 42% 58% 0 8%</merge>
-        </match>
-    </match>
   </device>
 </deviceinfo>

commit a31ecb669f40d8db3ab1867eaedfe364bbd6fafe
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Wed Apr 30 07:45:34 2014 +1000

    synaptics 1.7.99.2
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/configure.ac b/configure.ac
index be6b7ad..712d48d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
 # Initialize Autoconf
 AC_PREREQ([2.60])
 AC_INIT([xf86-input-synaptics],
-        [1.7.99.1],
+        [1.7.99.2],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
         [xf86-input-synaptics])
 AC_CONFIG_SRCDIR([Makefile.am])

commit efa424b5c9c084c1c1136a68329709c7dc9ddfda
Author: Clinton Sprain <clintonsprain@gmail.com>
Date:   Tue Apr 29 19:47:17 2014 -0500

    Fix product ID cutoff for MODEL_APPLETOUCH/MODEL_UNIBODY_MACBOOK
    
    Some Macbooks are being tagged as MODEL_UNIBODY_MACBOOKs when they should not
    be. This causes the default sensitivity to be very low for them, making the
    touchpad almost unusable. This change puts those devices into the correct
    bucket again.
    
    Signed-off-by: Clinton Sprain <clintonsprain@gmail.com>
    Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/src/eventcomm.c b/src/eventcomm.c
index 0a6ea48..37de38a 100644
--- a/src/eventcomm.c
+++ b/src/eventcomm.c
@@ -337,7 +337,9 @@ static struct model_lookup_t model_lookup_table[] = {
     {0x0002, 0x0007, 0x0007, MODEL_SYNAPTICS},
     {0x0002, 0x0008, 0x0008, MODEL_ALPS},
     {0x05ac, PRODUCT_ANY, 0x222, MODEL_APPLETOUCH},
-    {0x05ac, 0x223, PRODUCT_ANY, MODEL_UNIBODY_MACBOOK},
+    {0x05ac, 0x223, 0x228, MODEL_UNIBODY_MACBOOK},
+    {0x05ac, 0x229, 0x22b, MODEL_APPLETOUCH},
+    {0x05ac, 0x22c, PRODUCT_ANY, MODEL_UNIBODY_MACBOOK},
     {0x0002, 0x000e, 0x000e, MODEL_ELANTECH},
     {0x0, 0x0, 0x0, 0x0}
 };

commit 7bf27568417691e772e715f8fc6c30ea7ec892d6
Author: Hans de Goede <hdegoede@redhat.com>
Date:   Tue Apr 22 18:58:11 2014 +0200

    Add support for INPUT_PROP_TOPBUTTONPAD
    
    Add a HasSecondaryButtons boolean config option which defaults to true for
    devices with the INPUT_PROP_TOPBUTTONPAD and false for all other devices.
    
    Only parse the SecondarySoftButtonAreas when this option is true, effectively
    disabling the top buttons when it is false. Likewise, only initialize the
    SecondarySoftButtonAreas property if we enable support for it.
    
    This means that it is now safe to always set a SecondarySoftButtonAreas
    default in 50-synaptics.conf, and that he section which was intended for
    use with future pnp-id matching can be dropped, as that is now all handled
    in the kernel.
    
    While at also remove the comment about disabling the bottom edge area, as that
    is now done automatically.
    
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>

diff --git a/conf/50-synaptics.conf b/conf/50-synaptics.conf
index 161c1dd..a3145b8 100644
--- a/conf/50-synaptics.conf
+++ b/conf/50-synaptics.conf
@@ -25,16 +25,15 @@ Section "InputClass"
         Option "Ignore" "on"
 EndSection
 
-# This option enables the bottom right corner to be a right button on
-# non-synaptics clickpads.
+# This option enables the bottom right corner to be a right button on clickpads
+# and the right and middle top areas to be right / middle buttons on clickpads
+# with a top button area.
 # This option is only interpreted by clickpads.
 Section "InputClass"
         Identifier "Default clickpad buttons"
         MatchDriver "synaptics"
         Option "SoftButtonAreas" "50% 0 82% 0 0 0 0 0"
-#       To disable the bottom edge area so the buttons only work as buttons,
-#       not for movement, set the AreaBottomEdge
-#       Option "AreaBottomEdge" "82%"
+        Option "SecondarySoftButtonAreas" "58% 0 0 8% 42% 58% 0 8%"
 EndSection
 
 # This option disables software buttons on Apple touchpads.
@@ -45,19 +44,3 @@ Section "InputClass"
         MatchDriver "synaptics"
         Option "SoftButtonAreas" "0 0 0 0 0 0 0 0"
 EndSection
-
-# The Lenovo *40 series has no physical button for the TrackPoint and needs
-# the top softbutton area enabled by default.
-# Affected devices and their PNPIDs
-#       LEN0033:      Helix
-#       LEN0034:      T431, T540, X1 Carbon
-#       LEN0035:      X240
-#       LEN0036:      T440
-#       LEN0042:      Yoga
-#       LEN2004:      L440, L540
-Section "InputClass"
-        Identifier "Lenovo TrackPoint top software buttons"
-        MatchDriver "synaptics"
-        MatchPnPID  "LEN0033*|LEN0034*|LEN0035*|LEN0036*|LEN0042*|LEN2004*"
-        Option "SecondarySoftButtonAreas" "58% 0 0 8% 42% 58% 0 8%"
-EndSection
diff --git a/man/synaptics.man b/man/synaptics.man
index 2b8d1d9..76756be 100644
--- a/man/synaptics.man
+++ b/man/synaptics.man
@@ -495,17 +495,28 @@ buttons to share an edge value.
 Property: "Synaptics Soft Button Areas"
 .
 .TP
-.BI "Option \*qSecondarySoftButtonAreas\*q \*q" "RBL RBR RBT RBB MBL MBR MBT MBB" \*q
+.BI "Option \*qHasSecondarySoftButtons\*q \*q" boolean \*q
 This option is only available on ClickPad devices.
-Enable secondary soft button click area support on ClickPad devices (usually on
+Enable the secondary software button area support. The exact area must be
+set in option \*qSecondarySoftButtonAreas\*q.  See
+.B ClickPad support
+for more details.
+.
+.TP
+.BI "Option \*qSecondarySoftButtonAreas\*q \*q" "RBL RBR RBT RBB MBL MBR MBT MBB" \*q
+This option is only available on ClickPad devices and only if
+.B Option \*qHasSecondarySoftButtons\*q
+is enabled.
+Define the secondary soft button click areas on ClickPad devices (usually on
 top of the device).
 For the allowed values for this option, see
 .B Option \*qSoftButtonAreas\*q.
 Primary and secondary soft button areas must not overlap each other. If they do,
 the behavior of the driver is undefined.
 Property: "Synaptics Secondary Soft Button Areas". This property is only
-initialized if the option is set in the
-__xconfigfile__(__filemansuffix__).
+initialized if 
+.B Option \*qHasSecondarySoftButtons\*q 
+is enabled and this option is set in the __xconfigfile__(__filemansuffix__).
 .
 
 .SH CONFIGURATION DETAILS
@@ -729,9 +740,15 @@ area, a right or middle click is performed.
 .LP
 Some laptops, most notably the Lenovo T440, T540 and x240 series, provide a
 pointing stick without physical buttons. On those laptops, the top of the
-touchpad acts as software-emulated button area. This area can be configured
+touchpad acts as software-emulated button area. This area can be enabled
+with
+.B Option \*qHasSecondarySoftButtons\*q
+and configured
 with
-.B Option SecondarySoftButtonAreas.
+.B Option \*qSecondarySoftButtonAreas\*q.
+On some platforms, this option
+will be set automatically if the kernel detects a matching device. On Linux,
+the device must have the INPUT_PROP_TOPBUTTONPAD property set.
 
 .SH "DEVICE PROPERTIES"
 Synaptics 1.0 and higher support input device properties if the driver is
diff --git a/src/eventcomm.c b/src/eventcomm.c
index 5871374..0a6ea48 100644
--- a/src/eventcomm.c
+++ b/src/eventcomm.c
@@ -50,6 +50,9 @@
 #ifndef INPUT_PROP_SEMI_MT
 #define INPUT_PROP_SEMI_MT 0x03
 #endif
+#ifndef INPUT_PROP_TOPBUTTONPAD
+#define INPUT_PROP_TOPBUTTONPAD 0x04
+#endif
 #ifndef ABS_MT_TOOL_Y
 #define ABS_MT_TOOL_Y 0x3d
 #endif
@@ -802,6 +805,11 @@ event_query_touch(InputInfoPtr pInfo)
         xf86IDrvMsg(pInfo, X_INFO, "found clickpad property\n");
         para->clickpad = TRUE;
     }
+
+    if (libevdev_has_property(dev, INPUT_PROP_TOPBUTTONPAD)) {
+        xf86IDrvMsg(pInfo, X_INFO, "found top buttonpad property\n");
+        para->has_secondary_buttons = TRUE;
+    }
 #endif
 
 
diff --git a/src/properties.c b/src/properties.c
index 4c75797..718d054 100644
--- a/src/properties.c
+++ b/src/properties.c
@@ -176,6 +176,9 @@ InitSoftButtonProperty(InputInfoPtr pInfo)
     prop_softbutton_areas =
         InitAtom(pInfo->dev, SYNAPTICS_PROP_SOFTBUTTON_AREAS, 32, 8, values);
 
+    if (!para->has_secondary_buttons)
+        return;
+
     values[0] = para->softbutton_areas[TOP_RIGHT_BUTTON_AREA][LEFT];
     values[1] = para->softbutton_areas[TOP_RIGHT_BUTTON_AREA][RIGHT];
     values[2] = para->softbutton_areas[TOP_RIGHT_BUTTON_AREA][TOP];
diff --git a/src/synaptics.c b/src/synaptics.c
index 118d1c6..b25c902 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -674,6 +674,10 @@ set_default_parameters(InputInfoPtr pInfo)
     pars->tap_time_2 = xf86SetIntOption(opts, "MaxDoubleTapTime", 180);
     pars->click_time = xf86SetIntOption(opts, "ClickTime", 100);
     pars->clickpad = xf86SetBoolOption(opts, "ClickPad", pars->clickpad);       /* Probed */
+    if (pars->clickpad)
+        pars->has_secondary_buttons = xf86SetBoolOption(opts,
+                                                        "HasSecondarySoftButtons",
+                                                        pars->has_secondary_buttons);
     pars->clickpad_ignore_motion_time = 100; /* ms */
     /* middle mouse button emulation on a clickpad? nah, you're joking */
     middle_button_timeout = pars->clickpad ? 0 : 75;
@@ -777,7 +781,8 @@ set_default_parameters(InputInfoPtr pInfo)
     }
 
     set_primary_softbutton_areas_option(pInfo);
-    set_secondary_softbutton_areas_option(pInfo);
+    if (pars->has_secondary_buttons)
+        set_secondary_softbutton_areas_option(pInfo);
 }
 
 static double
diff --git a/src/synapticsstr.h b/src/synapticsstr.h
index b8a3492..4bd32ac 100644
--- a/src/synapticsstr.h
+++ b/src/synapticsstr.h
@@ -176,6 +176,7 @@ typedef struct _SynapticsParameters {
     int tap_time_2;             /* max. tapping time for double taps */
     int click_time;             /* The duration of a single click */
     Bool clickpad;              /* Device is a has integrated buttons */
+    Bool has_secondary_buttons; /* Device has a top soft-button area */
     int clickpad_ignore_motion_time; /* Ignore motion for X ms after a click */
     int emulate_mid_button_time;        /* Max time between left and right button presses to
                                            emulate a middle button press. */

commit 41afac2abf12dd74a171f726b57014f7fb266957
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Tue Apr 29 12:13:10 2014 +1000

    man: add some missing quotes
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/man/synaptics.man b/man/synaptics.man
index 081ce12..2b8d1d9 100644
--- a/man/synaptics.man
+++ b/man/synaptics.man
@@ -722,7 +722,7 @@ support at runime, the user must also set the middle mouse button timeout to
 driver.
 .LP
 ClickPads provide software emulated buttons through 
-.B Option SoftButtonAreas.
+.B Option \*qSoftButtonAreas\*q.
 These buttons enable areas on the touchpad to perform as right or middle
 mouse button. When the user performs a click within a defined soft button
 area, a right or middle click is performed.

commit a6f0f4c9a5bcb0e25343dd4c59d4cc47cc5e8006
Author: Hans de Goede <hdegoede@redhat.com>
Date:   Fri Apr 11 20:41:36 2014 +0200

    Always count tripletap + click as 3 fingerclick on pads with < 3 touches
    
    When trying to do a 3 fingerclick on a touchpad which only tracks 2 touches,
    this may register as a 3 or 2 fingerclick depending on the order in which
    the touchpad detects the fingers. If the 2 outer fingers of the 3 get seen
    first, then the 2 touches will be too far apart for the heuristic to see
    them as being close together, and the click gets counted as a 2 finger click.
    
    A user will likely never do a 2 finger click with a 3th finger resting
    somewhere else on the pad, where-as the above misdetection of the clicks is
    a real issue, so simply always count a click with trippletap set as a
    3 finger click on pads which track less then 3 touches.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1086218
    
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/src/synaptics.c b/src/synaptics.c
index f4c1d4a..118d1c6 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -2673,26 +2673,11 @@ clickpad_guess_clickfingers(SynapticsPrivate * priv,
     }
 
     /* Some trackpads touchpad only track two touchpoints but announce
-       BTN_TOOL_TRIPLETAP (which sets hw->numFingers to 3).
-       This can affect clickfingers, in the following ways:
-       * one finger down: normal click
-       * two fingers down, close together: 2 finger click
-       * two fingers down, apart: normal click
-       * three fingers down, close together: 3 finger click
-       * three fingers down, with two grouped next to each other: should be
-       * 2-finger click but we can't detect this.
-       * so: if two detected fingers are close together and HW says three
-       * fingers, make it three fingers.
-       * if two detected fingers are apart and HW says three fingers, make
-       * it a two-finger click, guessing that the third finger is somewhere
-       * close to another finger.
-       */
-    if (hw->numFingers >= 3 && nfingers < hw->numFingers) {
-        if (!nfingers) /* touchpoints too far apart */
-            nfingers = 2;
-        else
-            nfingers++;
-    }
+     * BTN_TOOL_TRIPLETAP (which sets hw->numFingers to 3), when this happens
+     * the user likely intents to do a 3 finger click, so handle it as such.
+     */
+    if (hw->numFingers >= 3 && hw->num_mt_mask < 3)
+        nfingers = 3;
 
     return nfingers;
 }

commit f183c1c38778b659b4c75a0e2c532dd5a9f8d437
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Wed Apr 9 10:41:29 2014 +1000

    conf: add more PnPIDs and DMI matches for Lenovos
    
    And expand DMI strings to more precise matches
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>

diff --git a/conf/11-x11-synaptics.fdi b/conf/11-x11-synaptics.fdi
index a898875..8145912 100644
--- a/conf/11-x11-synaptics.fdi
+++ b/conf/11-x11-synaptics.fdi
@@ -37,7 +37,8 @@
     </match>
 
     <match
-        key="/org/freedesktop/Hal/devices/computer:system.hardware.version" contains_outof="T440;X240;T540;Helix;S1Yoga">
+        key="/org/freedesktop/Hal/devices/computer:system.hardware.version"
+        contains_outof="ThinkPad T440;ThinkPad X240;ThinkPad T540;ThinkPad Helix;ThinkPad S1 Yoga;ThinkPad L440;ThinkPad X1 Carbon 2nd;ThinkPad T431;ThinkPad L540">
         <match key="input.product" contains="Synaptics">
             <merge key="input.x11_options.ClickPad" type="string">on</merge>
             <merge key="input.x11_options.SecondarySoftButtonAreas" type="string">58% 0 0 8% 42% 58% 0 8%</merge>
diff --git a/conf/50-synaptics.conf b/conf/50-synaptics.conf
index d808e6f..161c1dd 100644
--- a/conf/50-synaptics.conf
+++ b/conf/50-synaptics.conf
@@ -50,13 +50,14 @@ EndSection
 # the top softbutton area enabled by default.
 # Affected devices and their PNPIDs
 #       LEN0033:      Helix
-#       LEN0034:      T540
+#       LEN0034:      T431, T540, X1 Carbon
 #       LEN0035:      X240
 #       LEN0036:      T440
 #       LEN0042:      Yoga
+#       LEN2004:      L440, L540
 Section "InputClass"
         Identifier "Lenovo TrackPoint top software buttons"
         MatchDriver "synaptics"
-        MatchPnPID  "LEN0033*|LEN0034*|LEN0035*|LEN0036*|LEN0042*"
+        MatchPnPID  "LEN0033*|LEN0034*|LEN0035*|LEN0036*|LEN0042*|LEN2004*"
         Option "SecondarySoftButtonAreas" "58% 0 0 8% 42% 58% 0 8%"
 EndSection

commit 62ef210d11714703345dc8d35915ff53c37aee01
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Mon Apr 7 16:16:13 2014 +1000

    Comment the touch states
    
    Everytime I look at this I get confused about OPEN_EMPTY vs EMPTY. Let's fix
    that.
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>

diff --git a/src/synproto.h b/src/synproto.h
index d81ee42..c52838c 100644
--- a/src/synproto.h
+++ b/src/synproto.h
@@ -44,11 +44,11 @@ struct _SynapticsPrivateRec;
 typedef struct _SynapticsPrivateRec SynapticsPrivate;
 
 enum SynapticsSlotState {
-    SLOTSTATE_EMPTY = 0,
-    SLOTSTATE_OPEN,
-    SLOTSTATE_CLOSE,
-    SLOTSTATE_OPEN_EMPTY,
-    SLOTSTATE_UPDATE,
+    SLOTSTATE_EMPTY = 0,        /* no slot in this cycle */
+    SLOTSTATE_OPEN,             /* tracking ID received */
+    SLOTSTATE_CLOSE,            /* tracking ID -1 received */
+    SLOTSTATE_OPEN_EMPTY,       /* previously had tracking id, no events in this read cycle */
+    SLOTSTATE_UPDATE,           /* had tracking id, other events in this cycle */
 };
 
 /* used to mark emulated hw button state */

commit bfceb1bc580656aceb14e4b0f880bfcb3e4bc368
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Fri Apr 4 15:51:22 2014 +1000

    eventcomm: Hook up the libevdev log handler
    
    This is a bit problematic: libevdev only has one global log handler.
    So if we have another driver use libevdev, we'll either overwrite that handler
    or get overwritten, whichever comes first. So we need to re-set the handler
    every time we get an event to make sure we log through our handler.
    Likewise, if we ever drop the device, we need to unset the log handler back to
    NULL because we may unload the module and our handler may disappear.
    
    Use the lowest logging priority, let the server filter based on the verbosity
    level instead.
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>

diff --git a/src/eventcomm.c b/src/eventcomm.c
index 0cbbbd0..5871374 100644
--- a/src/eventcomm.c
+++ b/src/eventcomm.c
@@ -87,12 +87,46 @@ struct eventcomm_proto_data {
     enum libevdev_read_flag read_flag;
 };
 
+static void
+libevdev_log_func(enum libevdev_log_priority priority,
+                  void *data,
+                  const char *file, int line, const char *func,
+                  const char *format, va_list args)
+_X_ATTRIBUTE_PRINTF(6, 0);
+
+static void
+libevdev_log_func(enum libevdev_log_priority priority,
+                  void *data,
+                  const char *file, int line, const char *func,
+                  const char *format, va_list args)
+{
+    int verbosity;
+
+    switch(priority) {
+        case LIBEVDEV_LOG_ERROR: verbosity = 0; break;
+        case LIBEVDEV_LOG_INFO: verbosity = 4; break;
+        case LIBEVDEV_LOG_DEBUG: verbosity = 10; break;
+    }
+
+    LogVMessageVerbSigSafe(X_NOTICE, verbosity, format, args);
+}
+
+static void
+set_libevdev_log_handler(void)
+{
+                              /* be quiet, gcc *handwave* */
+    libevdev_set_log_function((libevdev_log_func_t)libevdev_log_func, NULL);
+    libevdev_set_log_priority(LIBEVDEV_LOG_DEBUG);
+}
+
 struct eventcomm_proto_data *
 EventProtoDataAlloc(int fd)
 {
     struct eventcomm_proto_data *proto_data;
     int rc;
 
+    set_libevdev_log_handler();
+
     proto_data = calloc(1, sizeof(struct eventcomm_proto_data));
     if (!proto_data)
         return NULL;
@@ -181,6 +215,8 @@ EventDeviceOnHook(InputInfoPtr pInfo, SynapticsParameters * para)
     struct eventcomm_proto_data *proto_data =
         (struct eventcomm_proto_data *) priv->proto_data;
 
+    set_libevdev_log_handler();
+
     if (libevdev_get_fd(proto_data->evdev) != -1) {
         struct input_event ev;
 
@@ -224,6 +260,8 @@ EventDeviceOffHook(InputInfoPtr pInfo)
 
     UninitializeTouch(pInfo);
     libevdev_grab(proto_data->evdev, LIBEVDEV_UNGRAB);
+    libevdev_set_log_function(NULL, NULL);
+    libevdev_set_log_priority(LIBEVDEV_LOG_INFO); /* reset to default */
 
     return Success;
 }
@@ -625,6 +663,8 @@ EventReadHwState(InputInfoPtr pInfo,
     struct eventcomm_proto_data *proto_data = priv->proto_data;
     Bool sync_cumulative = FALSE;
 
+    set_libevdev_log_handler();
+
     SynapticsResetTouchHwState(hw, FALSE);
 
     /* Reset cumulative values if buttons were not previously pressed,

commit 6ad856790630393bbd41b0bd7746ed9b0629a7c6
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Thu Apr 3 16:41:15 2014 +1000

    eventcomm: read one more event after finishing a sync
    
    Once the sync finishes, we get -EAGAIN. This only indicates the sync is done,
    but some events may still be waiting in the pipe for us to read. We must read
    those now, otherwise select may not trigger on further data.
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>

diff --git a/src/eventcomm.c b/src/eventcomm.c
index 5030150..0cbbbd0 100644
--- a/src/eventcomm.c
+++ b/src/eventcomm.c
@@ -491,8 +491,10 @@ SynapticsReadEvent(InputInfoPtr pInfo, struct input_event *ev)
         if (rc != -EAGAIN) {
             LogMessageVerbSigSafe(X_ERROR, 0, "%s: Read error %d\n", pInfo->name,
                     errno);
-        } else if (proto_data->read_flag == LIBEVDEV_READ_FLAG_SYNC)
+        } else if (proto_data->read_flag == LIBEVDEV_READ_FLAG_SYNC) {
             proto_data->read_flag = LIBEVDEV_READ_FLAG_NORMAL;
+            return SynapticsReadEvent(pInfo, ev);
+        }
 
         return FALSE;
     }

commit bec41416dbbee73eef9eee122d0acacc148e329d
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Thu Apr 3 15:42:45 2014 +1000

    eventcomm: drop superflous helper function
    
    last_mt_vals_slot is only used in one location and there we can just use
    cur_slot
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>

diff --git a/src/eventcomm.c b/src/eventcomm.c
index 858efeb..5030150 100644
--- a/src/eventcomm.c
+++ b/src/eventcomm.c
@@ -110,16 +110,6 @@ EventProtoDataAlloc(int fd)
     return proto_data;
 }
 
-static int
-last_mt_vals_slot(const SynapticsPrivate * priv)
-{
-    struct eventcomm_proto_data *proto_data =
-        (struct eventcomm_proto_data *) priv->proto_data;
-    int value = proto_data->cur_slot;
-
-    return value < priv->num_slots ? value : -1;
-}
-
 static void
 UninitializeTouch(InputInfoPtr pInfo)
 {
@@ -549,7 +539,7 @@ EventProcessTouchEvent(InputInfoPtr pInfo, struct SynapticsHwState *hw,
         proto_data->cur_slot = ev->value;
     }
     else {
-        int slot_index = last_mt_vals_slot(priv);
+        int slot_index = proto_data->cur_slot;
 
         if (slot_index < 0)
             return;

commit f1948e08ee9894864254a18098e4f4fceb6e322f
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Wed Mar 19 15:08:15 2014 +1000

    Disable GrabEventDevice by default
    
    This was required when we started supporting hotplugging to avoid duplicate
    events. These days the drawback of not being able to record events in the case
    of a bug is significant.
    
    Check the configuration source on init. If the device was hotplugged through a
    a server config backend, disable the grab. If the device was statically
    configured through an xorg.conf then leave the default grab enabled to avoid
    a duplicate device.
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>

diff --git a/src/synaptics.c b/src/synaptics.c
index 07fd450..f4c1d4a 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -576,6 +576,8 @@ set_default_parameters(InputInfoPtr pInfo)
     int width, height, diag, range;
     int horizHyst, vertHyst;
     int middle_button_timeout;
+    int grab_event_device = 0;
+    const char *source;
 
     /* The synaptics specs specify typical edge widths of 4% on x, and 5.4% on
      * y (page 7) [Synaptics TouchPad Interfacing Guide, 510-000080 - A
@@ -747,7 +749,16 @@ set_default_parameters(InputInfoPtr pInfo)
         xf86SetRealOption(opts, "PressureMotionMinFactor", 1.0);
     pars->press_motion_max_factor =
         xf86SetRealOption(opts, "PressureMotionMaxFactor", 1.0);
-    pars->grab_event_device = xf86SetBoolOption(opts, "GrabEventDevice", TRUE);
+
+    /* Only grab the device by default if it's not coming from a config
+       backend. This way we avoid the device being added twice and sending
+       duplicate events.
+      */
+    source = xf86CheckStrOption(opts, "_source", NULL);
+    if (source == NULL || strncmp(source, "server/", 7) != 0)
+        grab_event_device = TRUE;
+    pars->grab_event_device = xf86SetBoolOption(opts, "GrabEventDevice", grab_event_device);
+
     pars->tap_and_drag_gesture =
         xf86SetBoolOption(opts, "TapAndDragGesture", TRUE);
     pars->resolution_horiz =

commit fd709900445e3cb9f31ce7e780bfa98ecb6dab9b
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Tue Mar 18 07:28:44 2014 +1000

    synaptics 1.7.99.1
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/configure.ac b/configure.ac
index 865d4b4..be6b7ad 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
 # Initialize Autoconf
 AC_PREREQ([2.60])
 AC_INIT([xf86-input-synaptics],
-        [1.7.99],
+        [1.7.99.1],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
         [xf86-input-synaptics])
 AC_CONFIG_SRCDIR([Makefile.am])

commit dc5474964d4ec73b5c324961026e1037bb344946
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Mon Mar 17 14:55:37 2014 +1000

    If the touchpad is in TOUCHPAD_OFF mode, allow physical clicks
    
    Enabling clicks in off mode also allows for the new Lenovo *40 series to use
    the top software buttons while the touchpad is disabled. This benefits those
    that usually disable touchpads altogether but still need the buttons for the
    trackstick.
    
    This changes existing behaviour, but TouchpadOff was always intended to stop
    erroneous events while typing. Physical button presses are hard to trigger
    accidentally. On the touchpads that TouchpadOff concept was originally
    designed for the buttons are nowhere near the keyboard and are physically
    separated from the touchpad anyway. On Clickpads, triggering a physical
    click requires more force than accidentally touching the surface.
    
    https://bugs.freedesktop.org/show_bug.cgi?id=76156
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Reviewed-by: Hans de Goede <hdegoede@redhat.com>

diff --git a/man/synaptics.man b/man/synaptics.man
index 97f0114..081ce12 100644
--- a/man/synaptics.man
+++ b/man/synaptics.man
@@ -261,9 +261,14 @@ Valid values are:
 .TS
 l l.
 0	Touchpad is enabled
-1	Touchpad is switched off
+1	Touchpad is switched off (physical clicks still work)
 2	Only tapping and scrolling is switched off
 .TE
+When the touchpad is switched off, button events caused by a physical
+button press are still interpreted. On a ClickPad, this includes
+software-emulated middle and right buttons as defined by
+the SoftButtonAreas setting.
+.TP
 Property: "Synaptics Off"
 .TP
 .BI "Option \*qLockedDrags\*q \*q" boolean \*q
diff --git a/src/synaptics.c b/src/synaptics.c
index aeb1c57..07fd450 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -1934,7 +1934,8 @@ HandleTapProcessing(SynapticsPrivate * priv, struct SynapticsHwState *hw,
     enum EdgeType edge;
     int delay = 1000000000;
 
-    if (priv->finger_state == FS_BLOCKED)
+    if (para->touchpad_off == TOUCHPAD_OFF ||
+        priv->finger_state == FS_BLOCKED)
         return delay;
 
     touch = finger >= FS_TOUCHED && priv->finger_state == FS_UNTOUCHED;
@@ -2349,7 +2350,9 @@ HandleScrolling(SynapticsPrivate * priv, struct SynapticsHwState *hw,
     SynapticsParameters *para = &priv->synpara;
     int delay = 1000000000;
 
-    if ((priv->synpara.touchpad_off == TOUCHPAD_TAP_OFF) || (priv->finger_state == FS_BLOCKED)) {
+    if (priv->synpara.touchpad_off == TOUCHPAD_TAP_OFF ||
+        priv->synpara.touchpad_off == TOUCHPAD_OFF ||
+        priv->finger_state == FS_BLOCKED) {
         stop_coasting(priv);
         priv->circ_scroll_on = FALSE;
         priv->vert_scroll_edge_on = FALSE;
@@ -3080,12 +3083,6 @@ HandleState(InputInfoPtr pInfo, struct SynapticsHwState *hw, CARD32 now,
     Bool using_cumulative_coords = FALSE;
     Bool ignore_motion;
 
-    /* If touchpad is switched off, we skip the whole thing and return delay */
-    if (para->touchpad_off == TOUCHPAD_OFF) {
-        UpdateTouchState(pInfo, hw);
-        return delay;
-    }
-
     /* We need both and x/y, the driver can't handle just one of the two
      * yet. But since it's possible to hit a phys button on non-clickpads
      * without ever getting motion data first, we must continue with 0/0 for
@@ -3124,8 +3121,8 @@ HandleState(InputInfoPtr pInfo, struct SynapticsHwState *hw, CARD32 now,
              current_button_area(para, hw->x, hw->y) == NO_BUTTON_AREA)
         priv->last_button_area = NO_BUTTON_AREA;
 
-    ignore_motion =
-        !using_cumulative_coords && priv->last_button_area != NO_BUTTON_AREA;
+    ignore_motion = para->touchpad_off == TOUCHPAD_OFF ||
+        (!using_cumulative_coords && priv->last_button_area != NO_BUTTON_AREA);
 
     /* these two just update hw->left, right, etc. */
     update_hw_button_state(pInfo, hw, now, &delay);

commit 4122db68f61c695eae3a65aec18db08b29898b6a
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Thu Mar 13 08:26:08 2014 +1000

    conf: automatically enable the top softbutton area for the new Lenovos
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/conf/11-x11-synaptics.fdi b/conf/11-x11-synaptics.fdi
index ba79849..a898875 100644
--- a/conf/11-x11-synaptics.fdi
+++ b/conf/11-x11-synaptics.fdi
@@ -35,5 +35,13 @@
             <merge key="input.x11_options.SoftButtonAreas" type="string">0 0 0 0 0 0 0 0</merge>
         </match>
     </match>
+
+    <match
+        key="/org/freedesktop/Hal/devices/computer:system.hardware.version" contains_outof="T440;X240;T540;Helix;S1Yoga">
+        <match key="input.product" contains="Synaptics">
+            <merge key="input.x11_options.ClickPad" type="string">on</merge>
+            <merge key="input.x11_options.SecondarySoftButtonAreas" type="string">58% 0 0 8% 42% 58% 0 8%</merge>
+        </match>
+    </match>
   </device>
 </deviceinfo>
diff --git a/conf/50-synaptics.conf b/conf/50-synaptics.conf
index dd16ca2..d808e6f 100644
--- a/conf/50-synaptics.conf
+++ b/conf/50-synaptics.conf
@@ -45,3 +45,18 @@ Section "InputClass"
         MatchDriver "synaptics"
         Option "SoftButtonAreas" "0 0 0 0 0 0 0 0"
 EndSection
+
+# The Lenovo *40 series has no physical button for the TrackPoint and needs
+# the top softbutton area enabled by default.
+# Affected devices and their PNPIDs
+#       LEN0033:      Helix
+#       LEN0034:      T540
+#       LEN0035:      X240
+#       LEN0036:      T440
+#       LEN0042:      Yoga
+Section "InputClass"
+        Identifier "Lenovo TrackPoint top software buttons"
+        MatchDriver "synaptics"
+        MatchPnPID  "LEN0033*|LEN0034*|LEN0035*|LEN0036*|LEN0042*"
+        Option "SecondarySoftButtonAreas" "58% 0 0 8% 42% 58% 0 8%"
+EndSection

commit 18dae625eada20c4486542f9bb037fa2782d75bd
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Sun Aug 5 14:32:08 2012 +1000

    conf: apply ClickPad softbuttons option through fdi file too (fixed version)
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/conf/11-x11-synaptics.fdi b/conf/11-x11-synaptics.fdi
index d487f09..ba79849 100644
--- a/conf/11-x11-synaptics.fdi
+++ b/conf/11-x11-synaptics.fdi
@@ -30,6 +30,10 @@
 
 	For other possible options, check CONFIGURATION DETAILS in synaptics man page
         -->
+        <merge key="input.x11_options.SoftButtonAreas" type="string">50% 0 82% 0 0 0 0 0</merge>
+        <match key="info.product" contains="Apple|bcm5974">
+            <merge key="input.x11_options.SoftButtonAreas" type="string">0 0 0 0 0 0 0 0</merge>
+        </match>
     </match>
   </device>


Reply to: