Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Synaptics Palm Detection patch
diff -aur xf86-input-synaptics-1.8.0/src/synaptics.c xf86-input-synaptics-1.8.0.new/src/synaptics.c
--- xf86-input-synaptics-1.8.0/src/synaptics.c 2014-05-12 21:17:46.000000000 -0400
+++ xf86-input-synaptics-1.8.0.new/src/synaptics.c 2014-05-30 14:49:39.123104990 -0400
@@ -1793,28 +1793,19 @@
/* palm detection */
- if ((hw->z > para->palm_min_z) && (hw->fingerWidth > para->palm_min_width))
+ if ((hw->z > para->palm_min_z))
return FS_BLOCKED;
- if (hw->x == 0 || priv->finger_state == FS_UNTOUCHED)
- priv->avg_width = 0;
- else
- priv->avg_width += (hw->fingerWidth - priv->avg_width + 1) / 2;
-
if (finger != FS_UNTOUCHED && priv->finger_state == FS_UNTOUCHED) {
- int safe_width = MAX(hw->fingerWidth, priv->avg_width);
-
if (hw->numFingers > 1 || /* more than one finger -> not a palm */
- ((safe_width < 6) && (priv->prev_z < para->finger_high)) || /* thin finger, distinct touch -> not a palm */
- ((safe_width < 7) && (priv->prev_z < para->finger_high / 2))) { /* thin finger, distinct touch -> not a palm */
+ (priv->prev_z < para->finger_high) || /* thin finger, distinct touch -> not a palm */
+ (priv->prev_z < para->finger_high / 2)) { /* thin finger, distinct touch -> not a palm */
/* leave finger value as is */
}
else if (hw->z > priv->prev_z + 1) /* z not stable, may be a palm */
finger = FS_UNTOUCHED;
else if (hw->z < priv->prev_z - 5) /* z not stable, may be a palm */
finger = FS_UNTOUCHED;
- else if (hw->fingerWidth > para->palm_min_width) /* finger width too large -> probably palm */
- finger = FS_UNTOUCHED;
}
priv->prev_z = hw->z;
# $Id: PKGBUILD 213056 2014-05-18 13:44:18Z andyrtr $
# Maintainer: Jan de Groot <jgc@archlinux.org>
# Contributor: Tobias Powalowski <tpowa@archlinux.org>
# Contributor: Thomas Bächler <thomas@archlinux.org>
# Contributor: Alexander Baldeck <alexander@archlinux.org>
pkgname=xf86-input-synaptics
pkgver=1.8.0
pkgrel=2
pkgdesc="Synaptics driver for notebook touchpads"
arch=('i686' 'x86_64')
license=('custom')
url="http://xorg.freedesktop.org/"
depends=('libxtst' 'mtdev' 'libevdev')
makedepends=('xorg-server-devel' 'X-ABI-XINPUT_VERSION=20' 'libxi' 'libx11' 'resourceproto' 'scrnsaverproto')
conflicts=('xorg-server<1.15.0' 'X-ABI-XINPUT_VERSION<20' 'X-ABI-XINPUT_VERSION>=21')
replaces=('synaptics')
provides=('synaptics')
conflicts=('synaptics')
groups=('xorg-drivers' 'xorg')
backup=('etc/X11/xorg.conf.d/50-synaptics.conf')
source=(http://xorg.freedesktop.org/releases/individual/driver/${pkgname}-${pkgver}.tar.bz2
add_tapbuttons.diff
debug_palm.diff)
sha256sums=('9bf27632aaa6c5e62621ca9c2ca00f9b309c85b039ee33cd592b189fc872c37a'
'5298d3e871db3768b34cf8516d3f53f9291202e2ea5de3300256e1cd9119a1ec'
'bc7ea1967a31c4fe5ebdfec7154eeba88c2fac93915f15e37094e4e20bf5fac7')
build() {
cd ${pkgname}-${pkgver}
# * upstream disabled tapping by default if a physical left button is present - see FS#33282
# * enable MatchDevicePath directive by default - FS#33291
patch -Np1 -i ${srcdir}/add_tapbuttons.diff
# palm detection debugging
patch -p1 -i ${srcdir}/debug_palm.diff
./configure --prefix=/usr
make
}
package() {
cd ${pkgname}-${pkgver}
make DESTDIR="${pkgdir}" install
install -m755 -d "${pkgdir}/etc/X11/xorg.conf.d"
install -m644 conf/50-synaptics.conf "${pkgdir}/etc/X11/xorg.conf.d/"
install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
install -m644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/"
rm -rf "${pkgdir}/usr/share/X11"
}
@smedegaard

This comment has been minimized.

Copy link

commented Nov 11, 2014

Hi. how do I apply this patch?

@silverhammermba

This comment has been minimized.

Copy link
Owner Author

commented Dec 17, 2014

Check out xf86-input-synaptics from the Arch Build System, save the patchfile to the directory and overwrite the PKGBUILD with this one before building.

@taralbass

This comment has been minimized.

Copy link

commented Jun 17, 2015

Thanks for this patch! This issue was driving me nuts and basically made my brand new laptop unusable. You have made it enjoyable to use again!

@aabbas90

This comment has been minimized.

Copy link

commented Apr 12, 2018

Question from a noob, how do I apply this patch on Ubuntu? I cannot find how to build the PKGBUILD. Thanks!
(Apologies for commenting on an old thread, but being dissatisfied with libinput, I wanted to give this one a try.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.