conf/11-x11-synaptics.fdi | 12 ++ conf/50-synaptics.conf | 15 +++ configure.ac | 5 - debian/changelog | 4 include/synaptics-properties.h | 3 man/synaptics.man | 11 +- man/syndaemon.man | 8 - src/Makefile.am | 1 src/eventcomm.c | 192 +++++++++++++++++------------------------ src/properties.c | 50 ++++++++-- src/synaptics.c | 132 ++++++++++++---------------- src/synapticsstr.h | 21 +++- src/synproto.h | 4 tools/synclient.c | 2 tools/syndaemon.c | 33 +------ 15 files changed, 251 insertions(+), 242 deletions(-)
New commits: commit c5b8f352ab704b172a96b18e89c3773635c3620a Author: Timo Aaltonen <tjaal...@ubuntu.com> Date: Wed Mar 19 20:27:17 2014 +0200 update the changelog diff --git a/debian/changelog b/debian/changelog index 3584fd7..8175941 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,6 @@ -xserver-xorg-input-synaptics (1.7.99-1) UNRELEASED; urgency=medium +xserver-xorg-input-synaptics (1.7.99.1-1) UNRELEASED; urgency=medium - * New upstream release + git snapshot. + * New upstream release. * Drop libxtst-dev conflicts, add libevdev-dev. -- Maarten Lankhorst <maarten.lankho...@ubuntu.com> Thu, 27 Feb 2014 17:27:33 +0100 commit fd709900445e3cb9f31ce7e780bfa98ecb6dab9b Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Tue Mar 18 07:28:44 2014 +1000 synaptics 1.7.99.1 Signed-off-by: Peter Hutterer <peter.hutte...@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.hutte...@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.hutte...@who-t.net> Reviewed-by: Hans de Goede <hdego...@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.hutte...@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.hutte...@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.hutte...@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.hutte...@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> </deviceinfo> commit f2cb48e6eee47fa621edaaf2f75b495b12f6eb55 Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Thu Mar 13 10:14:40 2014 +1000 Revert "conf: apply ClickPad softbuttons option through fdi file too" Bad fdi file, type="string" is missing and it wouldn't merge properly. This reverts commit a35b2d629d85d7a8c82621a5098a17e5ffb341dc. diff --git a/conf/11-x11-synaptics.fdi b/conf/11-x11-synaptics.fdi index fa54f33..d487f09 100644 --- a/conf/11-x11-synaptics.fdi +++ b/conf/11-x11-synaptics.fdi @@ -30,10 +30,6 @@ For other possible options, check CONFIGURATION DETAILS in synaptics man page --> - <merge key="input.x11_options.SoftButtonAreas">50% 0 82% 0 0 0 0 0</merge> - <match key="info.product" contains="Apple|bcm5974"> - <merge key="input.x11_options.SoftButtonAreas">0 0 0 0 0 0 0 0</merge> - </match> </match> </device> </deviceinfo> commit a35b2d629d85d7a8c82621a5098a17e5ffb341dc Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Sun Aug 5 14:32:08 2012 +1000 conf: apply ClickPad softbuttons option through fdi file too Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> diff --git a/conf/11-x11-synaptics.fdi b/conf/11-x11-synaptics.fdi index d487f09..fa54f33 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">50% 0 82% 0 0 0 0 0</merge> + <match key="info.product" contains="Apple|bcm5974"> + <merge key="input.x11_options.SoftButtonAreas">0 0 0 0 0 0 0 0</merge> + </match> </match> </device> </deviceinfo> commit 17bbcad28000bbd896a33047c0720ada89e05f5d Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Wed Mar 12 14:11:29 2014 +1000 Revert "Add another third state to TouchpadOff for disabling all but button clicks" This third state is not needed, the behaviour of the touchpad driver is now good enough to not need an external syndaemon instance to toggle this third state. This reverts commit eea73358760c7ff9c9dac061f265753637c6f25c. Conflicts: man/synaptics.man src/synaptics.c Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> diff --git a/man/synaptics.man b/man/synaptics.man index 499fbe8..97f0114 100644 --- a/man/synaptics.man +++ b/man/synaptics.man @@ -263,7 +263,6 @@ l l. 0 Touchpad is enabled 1 Touchpad is switched off 2 Only tapping and scrolling is switched off -3 Only physical clicks are possible .TE Property: "Synaptics Off" .TP diff --git a/man/syndaemon.man b/man/syndaemon.man index 30ea20b..87691d8 100644 --- a/man/syndaemon.man +++ b/man/syndaemon.man @@ -45,11 +45,9 @@ A pid file will only be created if the program is started in daemon mode. .LP .TP -\fB\-t\fP [off|tapping|click-only] - Disable state. "off" for disabling the touchpad entirely, "tapping" for - disabling tapping and scrolling only, "click-only" for disabling - everything but physical clicks. The default if this option is missing is - "off". If this option is given without a mode it defaults to "tapping". +\fB\-t\fP +Only disable tapping and scrolling, not mouse movements, in response +to keyboard activity. .LP .TP \fB\-k\fP diff --git a/src/properties.c b/src/properties.c index 525649c..4c75797 100644 --- a/src/properties.c +++ b/src/properties.c @@ -600,7 +600,7 @@ SetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop, off = *(CARD8 *) prop->data; - if (off > 3) + if (off > 2) return BadValue; para->touchpad_off = off; diff --git a/src/synaptics.c b/src/synaptics.c index 640fa6f..aeb1c57 100644 --- a/src/synaptics.c +++ b/src/synaptics.c @@ -1810,8 +1810,7 @@ SelectTapButton(SynapticsPrivate * priv, enum EdgeType edge) { enum TapEvent tap; - if (priv->synpara.touchpad_off == TOUCHPAD_TAP_OFF || - priv->synpara.touchpad_off == TOUCHPAD_CLICK_ONLY) { + if (priv->synpara.touchpad_off == TOUCHPAD_TAP_OFF) { priv->tap_button = 0; return; } @@ -2350,9 +2349,7 @@ HandleScrolling(SynapticsPrivate * priv, struct SynapticsHwState *hw, SynapticsParameters *para = &priv->synpara; int delay = 1000000000; - if ((priv->synpara.touchpad_off == TOUCHPAD_TAP_OFF) || - (priv->synpara.touchpad_off == TOUCHPAD_CLICK_ONLY) || - (priv->finger_state == FS_BLOCKED)) { + if ((priv->synpara.touchpad_off == TOUCHPAD_TAP_OFF) || (priv->finger_state == FS_BLOCKED)) { stop_coasting(priv); priv->circ_scroll_on = FALSE; priv->vert_scroll_edge_on = FALSE; @@ -2964,9 +2961,6 @@ HandleTouches(InputInfoPtr pInfo, struct SynapticsHwState *hw) Bool restart_touches = FALSE; int i; - if (para->touchpad_off == TOUCHPAD_CLICK_ONLY) - goto out; - if (para->click_action[F3_CLICK1] || para->tap_action[F3_TAP]) min_touches = 4; else if (para->click_action[F2_CLICK1] || para->tap_action[F2_TAP] || @@ -3213,8 +3207,7 @@ HandleState(InputInfoPtr pInfo, struct SynapticsHwState *hw, CARD32 now, } /* Post events */ - if (finger >= FS_TOUCHED && (dx || dy) && !ignore_motion && - (para->touchpad_off != TOUCHPAD_CLICK_ONLY)) + if (finger >= FS_TOUCHED && (dx || dy) && !ignore_motion) xf86PostMotionEvent(pInfo->dev, 0, 0, 2, dx, dy); if (priv->mid_emu_state == MBE_LEFT_CLICK) { diff --git a/src/synapticsstr.h b/src/synapticsstr.h index bf77e57..b8a3492 100644 --- a/src/synapticsstr.h +++ b/src/synapticsstr.h @@ -63,7 +63,6 @@ enum OffState { TOUCHPAD_ON = 0, TOUCHPAD_OFF = 1, TOUCHPAD_TAP_OFF = 2, - TOUCHPAD_CLICK_ONLY = 3 }; enum TapEvent { @@ -201,7 +200,6 @@ typedef struct _SynapticsParameters { * 0 : Not off * 1 : Off * 2 : Only tapping and scrolling off - * 3 : All but physical clicks off */ Bool locked_drags; /* Enable locked drags */ int locked_drag_time; /* timeout for locked drags */ diff --git a/tools/synclient.c b/tools/synclient.c index 98285ac..ac31a66 100644 --- a/tools/synclient.c +++ b/tools/synclient.c @@ -105,7 +105,7 @@ static struct Parameter params[] = { {"UpDownScrollRepeat", PT_BOOL, 0, 1, SYNAPTICS_PROP_BUTTONSCROLLING_REPEAT, 8, 0}, {"LeftRightScrollRepeat", PT_BOOL, 0, 1, SYNAPTICS_PROP_BUTTONSCROLLING_REPEAT, 8, 1}, {"ScrollButtonRepeat", PT_INT, SBR_MIN , SBR_MAX, SYNAPTICS_PROP_BUTTONSCROLLING_TIME, 32, 0}, - {"TouchpadOff", PT_INT, 0, 3, SYNAPTICS_PROP_OFF, 8, 0}, + {"TouchpadOff", PT_INT, 0, 2, SYNAPTICS_PROP_OFF, 8, 0}, {"LockedDrags", PT_BOOL, 0, 1, SYNAPTICS_PROP_LOCKED_DRAGS, 8, 0}, {"LockedDragTimeout", PT_INT, 0, 30000, SYNAPTICS_PROP_LOCKED_DRAGS_TIMEOUT, 32, 0}, {"RTCornerButton", PT_INT, 0, SYN_MAX_BUTTONS, SYNAPTICS_PROP_TAP_ACTION, 8, 0}, diff --git a/tools/syndaemon.c b/tools/syndaemon.c index b181d16..29e75f5 100644 --- a/tools/syndaemon.c +++ b/tools/syndaemon.c @@ -50,8 +50,7 @@ enum TouchpadState { TouchpadOn = 0, TouchpadOff = 1, - TappingOff = 2, - ClickOnly = 3 + TappingOff = 2 }; static Bool pad_disabled @@ -74,7 +73,7 @@ static void usage(void) { fprintf(stderr, - "Usage: syndaemon [-i idle-time] [-m poll-delay] [-d] [-t [off|tapping|click-only]] [-k]\n"); + "Usage: syndaemon [-i idle-time] [-m poll-delay] [-d] [-t] [-k]\n"); fprintf(stderr, " -i How many seconds to wait after the last key press before\n"); fprintf(stderr, " enabling the touchpad. (default is 2.0s)\n"); @@ -83,10 +82,7 @@ usage(void) fprintf(stderr, " -d Start as a daemon, i.e. in the background.\n"); fprintf(stderr, " -p Create a pid file with the specified name.\n"); fprintf(stderr, - " -t Disable state.\n" - " 'off' for disabling the touchpad entirely, \n" - " 'tapping' for disabling tapping and scrolling only,\n" - " 'click-only' for disabling everything but physical clicks.\n"); + " -t Only disable tapping and scrolling, not mouse movements.\n"); fprintf(stderr, " -k Ignore modifier keys when monitoring keyboard activity.\n"); fprintf(stderr, " -K Like -k but also ignore Modifier+Key combos.\n"); @@ -551,7 +547,7 @@ main(int argc, char *argv[]) int use_xrecord = 0; /* Parse command line parameters */ - while ((c = getopt(argc, argv, ":i:m:dp:kKR?v")) != EOF) { + while ((c = getopt(argc, argv, "i:m:dtp:kKR?v")) != EOF) { switch (c) { case 'i': idle_time = atof(optarg); @@ -562,6 +558,9 @@ main(int argc, char *argv[]) case 'd': background = 1; break; + case 't': + disable_state = TappingOff; + break; case 'p': pid_file = optarg; break; @@ -579,24 +578,6 @@ main(int argc, char *argv[]) verbose = 1; break; case '?': - if (optopt != 't') - usage(); - else { - if (optind < argc) { - if (argv[optind][0] == '-') - disable_state = TappingOff; - else if (strcmp(argv[optind], "off") == 0) - disable_state = TouchpadOff; - else if (strcmp(argv[optind], "tapping") == 0) - disable_state = TappingOff; - else if (strcmp(argv[optind], "click-only") == 0) - disable_state = ClickOnly; - else - usage(); - } else - disable_state = TappingOff; - } - break; default: usage(); break; commit b40a5255fe73f7f95c8ff7145dd91605f3430119 Author: Stephen Chandler Paul <thatsly...@gmail.com> Date: Mon Mar 10 18:33:20 2014 -0400 Don't allow any type of movement starting in the top softbutton area Clicking in the top soft button area causes the trackpad to begin registering motion, even if the finger never leaves the top soft button area. We don't want this kind of behavior for the top soft button area, since it makes clicking and dragging items much more difficult when using a pointing stick. Signed-off-by: Stephen Chandler Paul <thatsly...@gmail.com> Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> diff --git a/src/synaptics.c b/src/synaptics.c index 23175b1..640fa6f 100644 --- a/src/synaptics.c +++ b/src/synaptics.c @@ -3107,7 +3107,8 @@ HandleState(InputInfoPtr pInfo, struct SynapticsHwState *hw, CARD32 now, /* If a physical button is pressed on a clickpad, use cumulative relative * touch movements for motion */ - if (para->clickpad && (hw->left || hw->right || hw->middle)) { + if (para->clickpad && (priv->lastButtons & 7) && + priv->last_button_area != TOP_BUTTON_AREA) { hw->x = hw->cumulative_dx; hw->y = hw->cumulative_dy; using_cumulative_coords = TRUE; commit 9a419ba01c53a38b4b601f4415801fca29a2b4e2 Author: Stephen Chandler Paul <thatsly...@gmail.com> Date: Mon Mar 10 18:25:20 2014 -0400 Replace is_inside_anybutton_area with current_button_area Signed-off-by: Stephen Chandler Paul <thatsly...@gmail.com> Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> diff --git a/src/synaptics.c b/src/synaptics.c index 3ae67f9..23175b1 100644 --- a/src/synaptics.c +++ b/src/synaptics.c @@ -1022,7 +1022,7 @@ SynapticsReset(SynapticsPrivate * priv) priv->finger_state = FS_UNTOUCHED; priv->last_motion_millis = 0; priv->clickpad_click_millis = 0; - priv->inside_button_area = FALSE; + priv->last_button_area = NO_BUTTON_AREA; priv->tap_state = TS_START; priv->tap_button = 0; priv->tap_button_state = TBS_BUTTON_UP; @@ -1564,12 +1564,15 @@ is_inside_top_or_bottom_button_area(SynapticsParameters * para, int offset, return inside_area; } -static Bool -is_inside_anybutton_area(SynapticsParameters * para, int x, int y) +static enum SoftButtonAreas +current_button_area(SynapticsParameters * para, int x, int y) { - return - is_inside_top_or_bottom_button_area(para, BOTTOM_BUTTON_AREA, x, y) || - is_inside_top_or_bottom_button_area(para, TOP_BUTTON_AREA, x, y); + if (is_inside_top_or_bottom_button_area(para, BOTTOM_BUTTON_AREA, x, y)) + return BOTTOM_BUTTON_AREA; + else if (is_inside_top_or_bottom_button_area(para, TOP_BUTTON_AREA, x, y)) + return TOP_BUTTON_AREA; + else + return NO_BUTTON_AREA; } static CARD32 @@ -3119,13 +3122,15 @@ HandleState(InputInfoPtr pInfo, struct SynapticsHwState *hw, CARD32 now, /* Ignore motion *starting* inside softbuttonareas */ if (priv->finger_state < FS_TOUCHED) - priv->inside_button_area = is_inside_anybutton_area(para, hw->x, hw->y); - /* If we already have a finger down, clear inside_button_area if it goes + priv->last_button_area = current_button_area(para, hw->x, hw->y); + /* If we already have a finger down, clear last_button_area if it goes outside of the softbuttonareas */ - else if (priv->inside_button_area && !is_inside_anybutton_area(para, hw->x, hw->y)) - priv->inside_button_area = FALSE; + else if (priv->last_button_area != NO_BUTTON_AREA && + current_button_area(para, hw->x, hw->y) == NO_BUTTON_AREA) + priv->last_button_area = NO_BUTTON_AREA; - ignore_motion = !using_cumulative_coords && priv->inside_button_area; + ignore_motion = + !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); diff --git a/src/synapticsstr.h b/src/synapticsstr.h index 955c0f2..bf77e57 100644 --- a/src/synapticsstr.h +++ b/src/synapticsstr.h @@ -151,6 +151,7 @@ enum TouchpadModel { }; enum SoftButtonAreas { + NO_BUTTON_AREA = -1, BOTTOM_BUTTON_AREA = 0, BOTTOM_RIGHT_BUTTON_AREA = 0, BOTTOM_MIDDLE_BUTTON_AREA = 1, @@ -266,7 +267,7 @@ struct _SynapticsPrivateRec { Bool prev_up; /* Previous up button value, for double click emulation */ enum FingerState finger_state; /* previous finger state */ CARD32 last_motion_millis; /* time of the last motion */ - Bool inside_button_area; /* Inside button area (ignore motion) */ + enum SoftButtonAreas last_button_area; /* Last button area we were in */ int clickpad_click_millis; /* Time of last clickpad click */ enum TapState tap_state; /* State of tap processing */ commit 2e5c0cf4395a0cf7b024495deab75f4ebe949e9a Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Mon Mar 10 16:43:54 2014 +1000 eventcomm: drop mtdev All kernel touchpad devices now support slots, there isn't really a need to support protocol A devices in synaptics. If such devices exist, we just treat them as non-multitouch devices. Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> Reviewed-by: Hans de Goede <hdego...@redhat.com> Reviewed-by: Benjamin Tissoires <benjamin.tissoi...@gmail.com> diff --git a/configure.ac b/configure.ac index 77edbb2..865d4b4 100644 --- a/configure.ac +++ b/configure.ac @@ -116,9 +116,6 @@ case "${host}" in esac if test "x$BUILD_EVENTCOMM" = xyes; then AC_DEFINE(BUILD_EVENTCOMM, 1, [Optional backend eventcomm enabled]) - - # Obtain compiler/linker options for mtdev - PKG_CHECK_MODULES(MTDEV, mtdev) PKG_CHECK_MODULES(LIBEVDEV, [libevdev >= 0.4]) fi if test "x$BUILD_PSMCOMM" = xyes; then diff --git a/src/Makefile.am b/src/Makefile.am index 69ef453..726c2de 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -48,7 +48,6 @@ if BUILD_EVENTCOMM synaptics_drv_la_SOURCES += \ eventcomm.c eventcomm.h synaptics_drv_la_LIBADD = \ - $(MTDEV_LIBS) \ $(LIBEVDEV_LIBS) AM_CPPFLAGS += $(LIBEVDEV_CFLAGS) endif diff --git a/src/eventcomm.c b/src/eventcomm.c index e76423f..858efeb 100644 --- a/src/eventcomm.c +++ b/src/eventcomm.c @@ -42,7 +42,6 @@ #include "synproto.h" #include "synapticsstr.h" #include <xf86.h> -#include <mtdev-plumbing.h> #include <libevdev/libevdev.h> #ifndef INPUT_PROP_BUTTONPAD @@ -79,7 +78,6 @@ struct eventcomm_proto_data { BOOL need_grab; int st_to_mt_offset[2]; double st_to_mt_scale[2]; - struct mtdev *mtdev; int axis_map[ABS_MT_CNT]; int cur_slot; ValuatorMask **last_mt_vals; @@ -141,8 +139,6 @@ UninitializeTouch(InputInfoPtr pInfo) proto_data->last_mt_vals = NULL; } - mtdev_close_delete(proto_data->mtdev); - proto_data->mtdev = NULL; proto_data->num_touches = 0; } @@ -157,14 +153,7 @@ InitializeTouch(InputInfoPtr pInfo) if (!priv->has_touch) return; - proto_data->mtdev = mtdev_new_open(pInfo->fd); - if (!proto_data->mtdev) { - xf86IDrvMsg(pInfo, X_WARNING, - "failed to create mtdev instance, ignoring touch events\n"); - return; - } - - proto_data->cur_slot = proto_data->mtdev->caps.slot.value; + proto_data->cur_slot = libevdev_get_current_slot(proto_data->evdev); proto_data->num_touches = 0; proto_data->last_mt_vals = calloc(priv->num_slots, sizeof(ValuatorMask *)); @@ -505,58 +494,33 @@ SynapticsReadEvent(InputInfoPtr pInfo, struct input_event *ev) SynapticsPrivate *priv = (SynapticsPrivate *) pInfo->private; struct eventcomm_proto_data *proto_data = priv->proto_data; int rc; - int have_events = TRUE; static struct timeval last_event_time; - /* empty mtdev queue first */ - if (proto_data->mtdev && !mtdev_empty(proto_data->mtdev)) { - mtdev_get_event(proto_data->mtdev, ev); - return TRUE; - } - - do { - rc = libevdev_next_event(proto_data->evdev, proto_data->read_flag, ev); - if (rc < 0) { - 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) - proto_data->read_flag = LIBEVDEV_READ_FLAG_NORMAL; - have_events = FALSE; - } else { - have_events = TRUE; - - /* SYN_DROPPED received in normal mode. Create a normal EV_SYN - so we process what's in the queue atm, then ensure we sync - next time */ - if (rc == LIBEVDEV_READ_STATUS_SYNC && - proto_data->read_flag == LIBEVDEV_READ_FLAG_NORMAL) { - proto_data->read_flag = LIBEVDEV_READ_FLAG_SYNC; - ev->type = EV_SYN; - ev->code = SYN_REPORT; - ev->value = 0; - ev->time = last_event_time; - } else if (ev->type == EV_SYN) - last_event_time = ev->time; - - /* feed mtdev. nomnomnomnom */ - if (proto_data->mtdev) - mtdev_put_event(proto_data->mtdev, ev); - } - } while (have_events && proto_data->mtdev && mtdev_empty(proto_data->mtdev)); + rc = libevdev_next_event(proto_data->evdev, proto_data->read_flag, ev); + if (rc < 0) { + 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) + proto_data->read_flag = LIBEVDEV_READ_FLAG_NORMAL; - /* loop exits if: - - we don't have mtdev, ev is valid, rc is TRUE, let's return it - - we have mtdev and it has events for us, get those - - we don't have a new event and mtdev doesn't have events either. - */ - if (have_events && proto_data->mtdev) { - have_events = !mtdev_empty(proto_data->mtdev); - if (have_events) - mtdev_get_event(proto_data->mtdev, ev); + return FALSE; } - return have_events; + /* SYN_DROPPED received in normal mode. Create a normal EV_SYN + so we process what's in the queue atm, then ensure we sync + next time */ + if (rc == LIBEVDEV_READ_STATUS_SYNC && + proto_data->read_flag == LIBEVDEV_READ_FLAG_NORMAL) { + proto_data->read_flag = LIBEVDEV_READ_FLAG_SYNC; + ev->type = EV_SYN; + ev->code = SYN_REPORT; + ev->value = 0; + ev->time = last_event_time; + } else if (ev->type == EV_SYN) + last_event_time = ev->time; + + return TRUE; } static Bool @@ -809,20 +773,22 @@ event_query_touch(InputInfoPtr pInfo) #endif - for (axis = ABS_MT_SLOT + 1; axis <= ABS_MT_MAX; axis++) { - if (!libevdev_has_event_code(dev, EV_ABS, axis)) - continue; + if (libevdev_has_event_code(dev, EV_ABS, ABS_MT_SLOT)) { + for (axis = ABS_MT_SLOT + 1; axis <= ABS_MT_MAX; axis++) { + if (!libevdev_has_event_code(dev, EV_ABS, axis)) + continue; - priv->has_touch = TRUE; + priv->has_touch = TRUE; - /* X and Y axis info is handled by synaptics already and we don't - expose the tracking ID */ - if (axis == ABS_MT_POSITION_X || - axis == ABS_MT_POSITION_Y || - axis == ABS_MT_TRACKING_ID) - continue; + /* X and Y axis info is handled by synaptics already and we don't + expose the tracking ID */ + if (axis == ABS_MT_POSITION_X || + axis == ABS_MT_POSITION_Y || + axis == ABS_MT_TRACKING_ID) + continue; - priv->num_mt_axes++; + priv->num_mt_axes++; + } } if (priv->has_touch) { @@ -842,11 +808,7 @@ event_query_touch(InputInfoPtr pInfo) AXIS_LABEL_PROP_ABS_MT_PRESSURE, }; - if (libevdev_has_event_code(dev, EV_ABS, ABS_MT_SLOT)) - priv->max_touches = libevdev_get_num_slots(dev); - else - priv->max_touches = SYNAPTICS_MAX_TOUCHES; - + priv->max_touches = libevdev_get_num_slots(dev); priv->touch_axes = malloc(priv->num_mt_axes * sizeof(SynapticsTouchAxisRec)); if (!priv->touch_axes) { commit c90a76ab0e752be0be4d9d835289df05d783f979 Author: Peter Hutterer <peter.hutte...@who-t.net> Date: Mon Mar 10 16:35:45 2014 +1000 eventcomm: drop some use of mtdev When checking the device don't open a new mtdev instance, use the existing libevdev struct. Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> Reviewed-by: Hans de Goede <hdego...@redhat.com> Reviewed-by: Benjamin Tissoires <benjamin.tissoi...@gmail.com> diff --git a/src/eventcomm.c b/src/eventcomm.c index ff3d84d..e76423f 100644 --- a/src/eventcomm.c +++ b/src/eventcomm.c @@ -51,6 +51,9 @@ #ifndef INPUT_PROP_SEMI_MT #define INPUT_PROP_SEMI_MT 0x03 #endif +#ifndef ABS_MT_TOOL_Y +#define ABS_MT_TOOL_Y 0x3d +#endif #define SYSCALL(call) while (((call) == -1) && (errno == EINTR)) @@ -60,6 +63,10 @@ #define LONG(x) ((x) / LONG_BITS) #define TEST_BIT(bit, array) ((array[LONG(bit)] >> OFF(bit)) & 1) +#define ABS_MT_MIN ABS_MT_SLOT +#define ABS_MT_MAX ABS_MT_TOOL_Y +#define ABS_MT_CNT (ABS_MT_MAX - ABS_MT_MIN + 1) + /** * Protocol-specific data. */ @@ -73,7 +80,7 @@ struct eventcomm_proto_data { int st_to_mt_offset[2]; double st_to_mt_scale[2]; struct mtdev *mtdev; - int axis_map[MT_ABS_SIZE]; + int axis_map[ABS_MT_CNT]; int cur_slot; ValuatorMask **last_mt_vals; int num_touches; @@ -782,47 +789,40 @@ event_query_touch(InputInfoPtr pInfo) SynapticsPrivate *priv = (SynapticsPrivate *) pInfo->private; SynapticsParameters *para = &priv->synpara; struct eventcomm_proto_data *proto_data = priv->proto_data; - struct mtdev *mtdev; - int i; + struct libevdev *dev = proto_data->evdev; + int axis; priv->max_touches = 0; priv->num_mt_axes = 0; #ifdef EVIOCGPROP - if (libevdev_has_property(proto_data->evdev, INPUT_PROP_SEMI_MT)) { + if (libevdev_has_property(dev, INPUT_PROP_SEMI_MT)) { xf86IDrvMsg(pInfo, X_INFO, "ignoring touch events for semi-multitouch device\n"); priv->has_semi_mt = TRUE; } - if (libevdev_has_property(proto_data->evdev, INPUT_PROP_BUTTONPAD)) { + if (libevdev_has_property(dev, INPUT_PROP_BUTTONPAD)) { xf86IDrvMsg(pInfo, X_INFO, "found clickpad property\n"); para->clickpad = TRUE; } #endif - mtdev = mtdev_new_open(pInfo->fd); - if (!mtdev) { - xf86IDrvMsg(pInfo, X_WARNING, - "failed to open mtdev when querying touch capabilities\n"); - return; - } - for (i = 0; i < MT_ABS_SIZE; i++) { - if (mtdev->caps.has_abs[i]) { - switch (i) { - /* X and Y axis info is handed by synaptics already */ - case ABS_MT_POSITION_X - ABS_MT_TOUCH_MAJOR: - case ABS_MT_POSITION_Y - ABS_MT_TOUCH_MAJOR: - /* Skip tracking ID info */ - case ABS_MT_TRACKING_ID - ABS_MT_TOUCH_MAJOR: - break; - default: - priv->num_mt_axes++; - break; - } - priv->has_touch = TRUE; - } + for (axis = ABS_MT_SLOT + 1; axis <= ABS_MT_MAX; axis++) { + if (!libevdev_has_event_code(dev, EV_ABS, axis)) + continue; + + priv->has_touch = TRUE; + + /* X and Y axis info is handled by synaptics already and we don't + expose the tracking ID */ + if (axis == ABS_MT_POSITION_X || + axis == ABS_MT_POSITION_Y || + axis == ABS_MT_TRACKING_ID) + continue; + + priv->num_mt_axes++; } if (priv->has_touch) { @@ -842,53 +842,53 @@ event_query_touch(InputInfoPtr pInfo) AXIS_LABEL_PROP_ABS_MT_PRESSURE, }; - if (mtdev->caps.slot.maximum > 0) - priv->max_touches = mtdev->caps.slot.maximum - - mtdev->caps.slot.minimum + 1; + if (libevdev_has_event_code(dev, EV_ABS, ABS_MT_SLOT)) + priv->max_touches = libevdev_get_num_slots(dev); + else + priv->max_touches = SYNAPTICS_MAX_TOUCHES; priv->touch_axes = malloc(priv->num_mt_axes * sizeof(SynapticsTouchAxisRec)); if (!priv->touch_axes) { priv->has_touch = FALSE; - goto out; + return; } axnum = 0; - for (i = 0; i < MT_ABS_SIZE; i++) { - if (mtdev->caps.has_abs[i]) { - switch (i) { - /* X and Y axis info is handed by synaptics already, we just - * need to map the evdev codes to the valuator numbers */ - case ABS_MT_POSITION_X - ABS_MT_TOUCH_MAJOR: - proto_data->axis_map[i] = 0; + for (axis = ABS_MT_SLOT + 1; axis <= ABS_MT_MAX; axis++) { + int axis_idx = axis - ABS_MT_TOUCH_MAJOR; + + if (!libevdev_has_event_code(dev, EV_ABS, axis)) + continue; + + switch (axis) { + /* X and Y axis info is handled by synaptics already, we just + * need to map the evdev codes to the valuator numbers */ + case ABS_MT_POSITION_X: + proto_data->axis_map[axis_idx] = 0; break; - case ABS_MT_POSITION_Y - ABS_MT_TOUCH_MAJOR: - proto_data->axis_map[i] = 1; + case ABS_MT_POSITION_Y: + proto_data->axis_map[axis_idx] = 1; break; /* Skip tracking ID info */ - case ABS_MT_TRACKING_ID - ABS_MT_TOUCH_MAJOR: + case ABS_MT_TRACKING_ID: break; default: - priv->touch_axes[axnum].label = labels[i]; - priv->touch_axes[axnum].min = mtdev->caps.abs[i].minimum; - priv->touch_axes[axnum].max = mtdev->caps.abs[i].maximum; + priv->touch_axes[axnum].label = labels[axis_idx]; + priv->touch_axes[axnum].min = libevdev_get_abs_minimum(dev, axis); + priv->touch_axes[axnum].max = libevdev_get_abs_maximum(dev, axis); /* Kernel provides units/mm, X wants units/m */ -- To UNSUBSCRIBE, email to debian-x-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/e1wqlfu-0004uv...@moszumanska.debian.org