Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save pascalopitz/a26f4bd3ea89eea3fdc1 to your computer and use it in GitHub Desktop.
Save pascalopitz/a26f4bd3ea89eea3fdc1 to your computer and use it in GitHub Desktop.
XPS 13 Stuff
diff --git a/src/synaptics.c b/src/synaptics.c
index 550b31c..1af7879 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -1796,7 +1796,7 @@ SynapticsDetectFinger(SynapticsPrivate * priv, struct SynapticsHwState *hw)
/* 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 (priv->has_mt_palm_detect)
@@ -1808,19 +1808,16 @@ SynapticsDetectFinger(SynapticsPrivate * priv, struct SynapticsHwState *hw)
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 */
- /* leave finger value as is */
+ (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;
https://github.com/defunkt/gist
pascal@pascal-XPS13-9333:~/Development/synaptics-patch-9333/xf86-input-synaptics-1.8.3$ ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking how to print strings... printf
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert x86_64-unknown-linux-gnu file names to x86_64-unknown-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for mt... mt
checking if mt is a manifest tool... no
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
checking for gcc option to accept ISO C99... none needed
checking whether __clang__ is declared... no
checking whether __INTEL_COMPILER is declared... no
checking whether __SUNPRO_C is declared... no
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking if gcc supports -Werror=unknown-warning-option... no
checking if gcc supports -Werror=unused-command-line-argument... no
checking if gcc supports -Wall... yes
checking if gcc supports -Wpointer-arith... yes
checking if gcc supports -Wmissing-declarations... yes
checking if gcc supports -Wformat=2... yes
checking if gcc supports -Wstrict-prototypes... yes
checking if gcc supports -Wmissing-prototypes... yes
checking if gcc supports -Wnested-externs... yes
checking if gcc supports -Wbad-function-cast... yes
checking if gcc supports -Wold-style-definition... yes
checking if gcc supports -Wdeclaration-after-statement... yes
checking if gcc supports -Wunused... yes
checking if gcc supports -Wuninitialized... yes
checking if gcc supports -Wshadow... yes
checking if gcc supports -Wmissing-noreturn... yes
checking if gcc supports -Wmissing-format-attribute... yes
checking if gcc supports -Wredundant-decls... yes
checking if gcc supports -Wlogical-op... yes
checking if gcc supports -Werror=implicit... yes
checking if gcc supports -Werror=nonnull... yes
checking if gcc supports -Werror=init-self... yes
checking if gcc supports -Werror=main... yes
checking if gcc supports -Werror=missing-braces... yes
checking if gcc supports -Werror=sequence-point... yes
checking if gcc supports -Werror=return-type... yes
checking if gcc supports -Werror=trigraphs... yes
checking if gcc supports -Werror=array-bounds... yes
checking if gcc supports -Werror=write-strings... yes
checking if gcc supports -Werror=address... yes
checking if gcc supports -Werror=int-to-pointer-cast... yes
checking if gcc supports -Werror=pointer-to-int-cast... yes
checking if gcc supports -pedantic... yes
checking if gcc supports -Werror... yes
checking if gcc supports -Werror=attributes... yes
checking whether make supports nested variables... (cached) yes
checking whether to build unit test cases... auto
checking for rint in -lm... yes
checking if RANDR is defined... yes
checking for XORG... yes
checking which optional backends will be build... ps2comm alpscomm eventcomm
checking for LIBEVDEV... yes
checking for XI... yes
checking for XTST... yes
checking for X11/extensions/record.h... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating man/Makefile
config.status: creating tools/Makefile
config.status: creating conf/Makefile
config.status: creating include/Makefile
config.status: creating xorg-synaptics.pc
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands
pascal@pascal-XPS13-9333:~/Development/synaptics-patch-9333/xf86-input-synaptics-1.8.3$ make
make all-recursive
make[1]: Entering directory '/home/pascal/Development/synaptics-patch-9333/xf86-input-synaptics-1.8.3'
Making all in include
make[2]: Entering directory '/home/pascal/Development/synaptics-patch-9333/xf86-input-synaptics-1.8.3/include'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/home/pascal/Development/synaptics-patch-9333/xf86-input-synaptics-1.8.3/include'
Making all in src
make[2]: Entering directory '/home/pascal/Development/synaptics-patch-9333/xf86-input-synaptics-1.8.3/src'
CC synaptics.lo
CC synproto.lo
CC properties.lo
CC alpscomm.lo
CC ps2comm.lo
CC eventcomm.lo
CCLD synaptics_drv.la
make[2]: Leaving directory '/home/pascal/Development/synaptics-patch-9333/xf86-input-synaptics-1.8.3/src'
Making all in man
make[2]: Entering directory '/home/pascal/Development/synaptics-patch-9333/xf86-input-synaptics-1.8.3/man'
GEN synaptics.4
GEN synclient.1
GEN syndaemon.1
make[2]: Leaving directory '/home/pascal/Development/synaptics-patch-9333/xf86-input-synaptics-1.8.3/man'
Making all in tools
make[2]: Entering directory '/home/pascal/Development/synaptics-patch-9333/xf86-input-synaptics-1.8.3/tools'
CC synclient.o
CCLD synclient
CC syndaemon-syndaemon.o
syndaemon.c: In function ‘main’:
syndaemon.c:614:9: warning: ignoring return value of ‘chdir’, declared with attribute warn_unused_result [-Wunused-result]
chdir("/"); /* In case the file system gets unmounted */
^
CCLD syndaemon
make[2]: Leaving directory '/home/pascal/Development/synaptics-patch-9333/xf86-input-synaptics-1.8.3/tools'
Making all in conf
make[2]: Entering directory '/home/pascal/Development/synaptics-patch-9333/xf86-input-synaptics-1.8.3/conf'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/home/pascal/Development/synaptics-patch-9333/xf86-input-synaptics-1.8.3/conf'
make[2]: Entering directory '/home/pascal/Development/synaptics-patch-9333/xf86-input-synaptics-1.8.3'
make[2]: Leaving directory '/home/pascal/Development/synaptics-patch-9333/xf86-input-synaptics-1.8.3'
make[1]: Leaving directory '/home/pascal/Development/synaptics-patch-9333/xf86-input-synaptics-1.8.3'
pascal@pascal-XPS13-9333:~/Development/synaptics-patch-9333/xf86-input-synaptics-1.8.3$ sudo make install
Making install in include
make[1]: Entering directory '/home/pascal/Development/synaptics-patch-9333/xf86-input-synaptics-1.8.3/include'
make[2]: Entering directory '/home/pascal/Development/synaptics-patch-9333/xf86-input-synaptics-1.8.3/include'
make[2]: Nothing to be done for 'install-exec-am'.
/bin/mkdir -p '/usr/include/xorg'
/usr/bin/install -c -m 644 synaptics-properties.h '/usr/include/xorg'
make[2]: Leaving directory '/home/pascal/Development/synaptics-patch-9333/xf86-input-synaptics-1.8.3/include'
make[1]: Leaving directory '/home/pascal/Development/synaptics-patch-9333/xf86-input-synaptics-1.8.3/include'
Making install in src
make[1]: Entering directory '/home/pascal/Development/synaptics-patch-9333/xf86-input-synaptics-1.8.3/src'
make[2]: Entering directory '/home/pascal/Development/synaptics-patch-9333/xf86-input-synaptics-1.8.3/src'
make[2]: Nothing to be done for 'install-exec-am'.
/bin/mkdir -p '/usr/local/lib/xorg/modules/input'
/bin/bash ../libtool --mode=install /usr/bin/install -c synaptics_drv.la '/usr/local/lib/xorg/modules/input'
libtool: install: /usr/bin/install -c .libs/synaptics_drv.so /usr/local/lib/xorg/modules/input/synaptics_drv.so
libtool: install: /usr/bin/install -c .libs/synaptics_drv.lai /usr/local/lib/xorg/modules/input/synaptics_drv.la
libtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/sbin" ldconfig -n /usr/local/lib/xorg/modules/input
----------------------------------------------------------------------
Libraries have been installed in:
/usr/local/lib/xorg/modules/input
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,-rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf'
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
make[2]: Leaving directory '/home/pascal/Development/synaptics-patch-9333/xf86-input-synaptics-1.8.3/src'
make[1]: Leaving directory '/home/pascal/Development/synaptics-patch-9333/xf86-input-synaptics-1.8.3/src'
Making install in man
make[1]: Entering directory '/home/pascal/Development/synaptics-patch-9333/xf86-input-synaptics-1.8.3/man'
make[2]: Entering directory '/home/pascal/Development/synaptics-patch-9333/xf86-input-synaptics-1.8.3/man'
make[2]: Nothing to be done for 'install-exec-am'.
/bin/mkdir -p '/usr/local/share/man/man4'
/usr/bin/install -c -m 644 synaptics.4 '/usr/local/share/man/man4'
/bin/mkdir -p '/usr/local/share/man/man1'
/usr/bin/install -c -m 644 synclient.1 '/usr/local/share/man/man1'
/bin/mkdir -p '/usr/local/share/man/man1'
/usr/bin/install -c -m 644 syndaemon.1 '/usr/local/share/man/man1'
make[2]: Leaving directory '/home/pascal/Development/synaptics-patch-9333/xf86-input-synaptics-1.8.3/man'
make[1]: Leaving directory '/home/pascal/Development/synaptics-patch-9333/xf86-input-synaptics-1.8.3/man'
Making install in tools
make[1]: Entering directory '/home/pascal/Development/synaptics-patch-9333/xf86-input-synaptics-1.8.3/tools'
make[2]: Entering directory '/home/pascal/Development/synaptics-patch-9333/xf86-input-synaptics-1.8.3/tools'
/bin/mkdir -p '/usr/local/bin'
/bin/bash ../libtool --mode=install /usr/bin/install -c synclient syndaemon '/usr/local/bin'
libtool: install: /usr/bin/install -c synclient /usr/local/bin/synclient
libtool: install: /usr/bin/install -c syndaemon /usr/local/bin/syndaemon
make[2]: Nothing to be done for 'install-data-am'.
make[2]: Leaving directory '/home/pascal/Development/synaptics-patch-9333/xf86-input-synaptics-1.8.3/tools'
make[1]: Leaving directory '/home/pascal/Development/synaptics-patch-9333/xf86-input-synaptics-1.8.3/tools'
Making install in conf
make[1]: Entering directory '/home/pascal/Development/synaptics-patch-9333/xf86-input-synaptics-1.8.3/conf'
make[2]: Entering directory '/home/pascal/Development/synaptics-patch-9333/xf86-input-synaptics-1.8.3/conf'
make[2]: Nothing to be done for 'install-exec-am'.
/bin/mkdir -p '/usr/share/X11/xorg.conf.d'
/usr/bin/install -c -m 644 50-synaptics.conf '/usr/share/X11/xorg.conf.d'
make[2]: Leaving directory '/home/pascal/Development/synaptics-patch-9333/xf86-input-synaptics-1.8.3/conf'
make[1]: Leaving directory '/home/pascal/Development/synaptics-patch-9333/xf86-input-synaptics-1.8.3/conf'
make[1]: Entering directory '/home/pascal/Development/synaptics-patch-9333/xf86-input-synaptics-1.8.3'
make[2]: Entering directory '/home/pascal/Development/synaptics-patch-9333/xf86-input-synaptics-1.8.3'
make[2]: Nothing to be done for 'install-exec-am'.
/bin/mkdir -p '/usr/local/lib/pkgconfig'
/usr/bin/install -c -m 644 xorg-synaptics.pc '/usr/local/lib/pkgconfig'
make[2]: Leaving directory '/home/pascal/Development/synaptics-patch-9333/xf86-input-synaptics-1.8.3'
make[1]: Leaving directory '/home/pascal/Development/synaptics-patch-9333/xf86-input-synaptics-1.8.3'
@pascalopitz
Copy link
Author

af7d8a1 (tag: xf86-input-synaptics-1.8.3, origin/synaptics-1.8-branch) synaptics 1.8.3

@pascalopitz
Copy link
Author

To be used with 15.10, follow instructions https://xps13-9333.appspot.com/#touchpad

@pascalopitz
Copy link
Author

Finger width and palm detection

If you are not using kernel v3.16 or newer, the information about finger widths necessary for the palm detection are not sent, so you need to patch the xorg driver not to rely on them for the palm detection.
The new driver send information about finger widths, but you need an updated version of the xorg driver.

For kernel older than 3.16, I wrote this patch that makes the driver rely only on the pressure for the palm detection. I didn't fix the code in a proper way handling our case as a special one, I simply got rid of the code which breaks the functionality on this laptop.

Follow one of the following guides to patch the xorg driver.

Build and patch upstream driver

Building the upstream driver is quite simple (see below to build the driver provided by your distro).

Uninstall the current driver (reinstall it in case of problems). In this way your patched driver won't be removed during updates. Note: the following command remove also xserver-xorg-input-all:

  • aptitude purge xserver-xorg-input-synaptics

Install the needed dependecies (add the needed deb-src if not available):

  • aptitude build-dep xserver-xorg-input-synaptics

If you want to install the upstream driver, download the sources with the following command (see below otherwise):

  • git clone git://anongit.freedesktop.org/xorg/driver/xf86-input-synaptics
  • cd xf86-input-synaptics

Apply the following patch:

Build and install the driver:

  • ./autogen.sh --prefix=/usr
  • make
  • make install

Create /etc/X11/xorg.conf.d/20-synaptics.conf (adjust the values) and restart X:

Find the optimal value for PalmMinZ using synclient and update 20-synaptics.conf accordingly:

  • synclient PalmMinZ=VALUE

In case of problems with this self-built driver, reinstall the original driver with:

  • aptitude install xserver-xorg-input-synaptics

@pascalopitz
Copy link
Author

@pascalopitz
Copy link
Author

https://launchpad.net/ubuntu/+source/xserver-xorg-input-synaptics-hwe-16.04

  • Downloaded src, installed build deps, ./configure, make, make install

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment