Skip to content
Commits on Source (119)
This diff is collapsed.
#!/usr/bin/env python3
# vim: set expandtab shiftwidth=4:
# -*- Mode: python; coding: utf-8; indent-tabs-mode: nil -*- */
#
# This script tests a few things against the commit messages, search for
# `def test_` to see the actual tests run.
import git
import os
import pytest
if os.environ.get('CI'):
# Environment variables set by gitlab
CI_COMMIT_SHA = os.environ['CI_COMMIT_SHA']
# This is intentionally hardcoded to master. CI_MERGE_REQUEST_TARGET_BRANCH_NAME
# is only available when run with only: [merge_requests]
# but that generates a detached pipeline with only this job in it.
# Since merging into a non-master branch is not a thing in libinput
# anyway, we can hardcode this here.
CI_MERGE_REQUEST_TARGET_BRANCH_NAME = 'master'
CI_SERVER_HOST = os.environ['CI_SERVER_HOST']
UPSTREAM = 'upstream'
else:
# Local emulation mode when called directly
import argparse
parser = argparse.ArgumentParser(description='Commit message checker - local emulation mode')
parser.add_argument('--sha', help='The commit message to start at (default: HEAD}',
default='HEAD')
parser.add_argument('--branch', help='The branch name to merge to (default: master)',
default='master')
parser.add_argument('--remote', help='The remote name (default: origin)',
default='origin')
args = parser.parse_args()
CI_COMMIT_SHA = args.sha
CI_MERGE_REQUEST_TARGET_BRANCH_NAME = args.branch
CI_SERVER_HOST = None
UPSTREAM = 'origin'
print(f'Running in local testing mode.')
print(f'Merging {CI_COMMIT_SHA} into {CI_MERGE_REQUEST_TARGET_BRANCH_NAME}')
# We need to add the real libinput as remote, our origin here is the user's
# fork.
repo = git.Repo('.')
if UPSTREAM not in repo.remotes:
upstream = repo.create_remote('upstream', f'https://{CI_SERVER_HOST}/libinput/libinput.git')
upstream.fetch()
sha = CI_COMMIT_SHA
branch = CI_MERGE_REQUEST_TARGET_BRANCH_NAME
commits = list(repo.iter_commits(f'{UPSTREAM}/{branch}..{sha}'))
def error(commit, message, long_message=''):
info = ('After correcting the above issue(s), force-push to the same branch.\n'
'This will re-trigger the CI.\n\n'
'A list of requirements for commit messages is available at\n'
'https://gitlab.freedesktop.org/libinput/libinput/blob/master/CODING_STYLE.md')
msg = (f'\n'
f'Commit message check failed: {message}\n\n'
f' commit: {str(commit)}\n'
f' author: {commit.author.name} <{commit.author.email}>\n'
f'\n'
f' {commit.summary}\n'
f'\n'
f'\n'
f'{long_message}\n\n'
f'{info}\n\n')
return msg
@pytest.mark.parametrize('commit', commits)
class TestCommits:
def test_author_email(self, commit):
assert '@users.noreply.gitlab.freedesktop.org' not in commit.author.email, \
error(commit, 'git author email invalid',
('Please set your name and email with the commands\n',
' git config --global user.name Your Name\n'
' git config --global user.email your.email@provider.com\n'))
def test_signed_off_by(self, commit):
if not commit.message.startswith('Revert "'):
assert 'Signed-off-by:' in commit.message, \
error(commit, 'missing Signed-off-by tag',
'Please add the required "Signed-off-by: author information" line\n'
'to the commit message')
def test_fixup(self, commit):
assert not commit.message.startswith('fixup!'), \
error(commit, 'Remove fixup! tag',
'Leftover "fixup!" commit message detected, please squash')
assert not commit.message.startswith('squash!'), \
error(commit, 'Remove squash! tag',
'Leftover "squash!" commit message detected, please squash')
def test_line_length(self, commit):
lines = commit.message.split('\n')
first_line = lines[0]
assert len(first_line) < 85, \
error(commit, 'Commit message subject line too long')
try:
second_line = lines[1]
assert second_line == '', \
error(commit, 'Second line in commit message must be emtpy')
except IndexError:
pass
if __name__ == '__main__':
pytest.main([__file__])
# This file contains the configuration for the gitlab ci.
# See the .gitlab-ci/generate-gitlab-ci.py file for more info
#
# We're happy to rebuild all containers when one changes.
.default_tag: &default_tag '2020-07-22.0'
distributions:
- name: fedora
tag: *default_tag
versions:
- '30'
- '31'
- '32'
want_qemu: true
use_for_custom_build_tests: true
- name: ubuntu
tag: *default_tag
versions:
- '19.10'
- name: arch
tag: *default_tag
versions:
- 'rolling'
- name: alpine
tag: *default_tag
versions:
- 'latest'
build:
extra_variables:
- "MESON_ARGS: '-Ddocumentation=false' # alpine does not have python-recommonmark"
# We don't run the tests on alpine. The litest-selftest fails
# for any tcase_add_exit_test/tcase_add_test_raise_signal
# but someone more invested in musl will have to figure that out.
- "MESON_TEST_ARGS: '' # litest-selftest fails on musl"
- name: freebsd
tag: *default_tag
does_not_have_ci_templates: true
test_suites:
- name: touchpad
suites:
touchpad
- name: tap
suites:
tap
- name: tablet
suites:
tablet
- name: gestures-device
suites:
gestures
device
- name: others
suites:
context
config
misc
events
totem
udev
lid
log
timer
tablet-mode
quirks
trackball
pad
path
keyboard
switch
touch
trackpoint
- name: pointer
suites:
pointer
#!/usr/bin/env python3
# vim: set expandtab shiftwidth=4:
# This file generates the .gitlab-ci.yml file that defines the pipeline.
import jinja2
distributions = [
{'name': 'fedora', 'version': '30'},
{'name': 'fedora', 'version': '31'},
{'name': 'ubuntu', 'version': '19.10'},
{'name': 'ubuntu', 'version': '19.04'},
{'name': 'arch', 'version': 'rolling'},
{
'name': 'alpine', 'version': 'latest',
'build': {
'extra_variables': [
'MESON_ARGS: \'-Ddocumentation=false\' # alpine does not have python-recommonmark',
# We don't run the tests on alpine. The litest-selftest fails
# for any tcase_add_exit_test/tcase_add_test_raise_signal
# but someone more invested in musl will have to figure that out.
'MESON_TEST_ARGS: \'\' # litest-selftest fails on musl',
]
},
}
]
templates = sorted(set([x['name'] for x in distributions]))
# in reverse order of duration to get the slowest ones started first
test_suites = [
{'name': 'touchpad', 'suites': 'touchpad'},
{'name': 'tap', 'suites': 'tap'},
{'name': 'tablet', 'suites': 'tablet'},
{'name': 'gestures-device', 'suites': 'gestures device'},
{'name': 'others',
'suites': 'context config misc events totem udev lid log timer tablet-mode quirks trackball pad path keyboard switch touch trackpoint'},
{'name': 'pointer', 'suites': 'pointer'}
]
def generate_template():
env = jinja2.Environment(loader=jinja2.FileSystemLoader('./.gitlab-ci'),
trim_blocks=True, lstrip_blocks=True)
template = env.get_template('gitlab-ci.tmpl')
config = {'distributions': distributions,
'test_suites': test_suites,
'templates': templates}
with open('.gitlab-ci.yml', 'w') as fd:
template.stream(config).dump(fd)
if __name__ == '__main__':
generate_template()
# This specfile should not be used outside the CI
# Its main purpose is to sound alarm if files disappear or are added that
# weren't intended.
%global udevdir %(pkg-config --variable=udevdir udev)
%global pipelineid @PIPELINEID@
%global gitversion @GITVERSION@
Name: libinput
Version: @VERSION@
Release: %{pipelineid}git%{gitversion}%{?dist}
Summary: Input device library
License: MIT
URL: http://www.freedesktop.org/wiki/Software/libinput/
Source0: %{name}-%{version}.tar.xz
# No BuildRequires, we rely on the container setup to have
# all the requires installed
%description
libinput is a library that handles input devices for display servers and other
applications that need to directly deal with input devices.
It provides device detection, device handling, input device event processing
and abstraction so minimize the amount of custom input code the user of
libinput need to provide the common set of functionality that users expect.
%package devel
Summary: Development files for %{name}
Requires: %{name}%{?_isa} = %{version}-%{release}
%description devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.
%package utils
Summary: Utilities and tools for debugging %{name}
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: python3-pyudev python3-libevdev
%description utils
The %{name}-utils package contains tools to debug hardware and analyze
%{name}.
%package test
Summary: libinput integration test suite
Requires: %{name}%{?_isa} = %{version}-%{release}
%description test
The %{name}-test package contains the libinput test suite. It is not
intended to be run by users.
%prep
%autosetup -S git -n %{name}-%{version}
%build
%meson -Dtests=true \
-Dinstall-tests=true \
-Dudev-dir=%{udevdir}
%meson_build
%install
%meson_install
%post
%{?ldconfig}
%ldconfig_postun
%files
%doc COPYING
%{_libdir}/libinput.so.*
%{udevdir}/libinput-device-group
%{udevdir}/libinput-fuzz-extract
%{udevdir}/libinput-fuzz-to-zero
%{udevdir}/rules.d/80-libinput-device-groups.rules
%{udevdir}/rules.d/90-libinput-fuzz-override.rules
%{_bindir}/libinput
%dir %{_libexecdir}/libinput/
%{_libexecdir}/libinput/libinput-debug-events
%{_libexecdir}/libinput/libinput-list-devices
%{_mandir}/man1/libinput.1*
%{_datadir}/libinput/*.quirks
%dir %{_datadir}/zsh
%dir %{_datadir}/zsh/site-functions
%{_datadir}/zsh/site-functions/*
%{_mandir}/man1/libinput-list-devices.1*
%{_mandir}/man1/libinput-debug-events.1*
%files devel
%{_includedir}/libinput.h
%{_libdir}/libinput.so
%{_libdir}/pkgconfig/libinput.pc
%files utils
%{_libexecdir}/libinput/libinput-debug-gui
%{_libexecdir}/libinput/libinput-debug-tablet
%{_libexecdir}/libinput/libinput-measure
%{_libexecdir}/libinput/libinput-measure-fuzz
%{_libexecdir}/libinput/libinput-measure-touchpad-tap
%{_libexecdir}/libinput/libinput-measure-touchpad-pressure
%{_libexecdir}/libinput/libinput-measure-touch-size
%{_libexecdir}/libinput/libinput-measure-touchpad-size
%{_libexecdir}/libinput/libinput-quirks
%{_libexecdir}/libinput/libinput-record
%{_libexecdir}/libinput/libinput-replay
%{_libexecdir}/libinput/libinput-analyze
%{_libexecdir}/libinput/libinput-analyze-per-slot-delta
%{_mandir}/man1/libinput-debug-gui.1*
%{_mandir}/man1/libinput-debug-tablet.1*
%{_mandir}/man1/libinput-measure.1*
%{_mandir}/man1/libinput-measure-fuzz.1*
%{_mandir}/man1/libinput-measure-touchpad-tap.1*
%{_mandir}/man1/libinput-measure-touch-size.1*
%{_mandir}/man1/libinput-measure-touchpad-size.1*
%{_mandir}/man1/libinput-measure-touchpad-pressure.1*
%{_mandir}/man1/libinput-quirks.1*
%{_mandir}/man1/libinput-quirks-list.1*
%{_mandir}/man1/libinput-quirks-validate.1*
%{_mandir}/man1/libinput-record.1*
%{_mandir}/man1/libinput-replay.1*
%{_mandir}/man1/libinput-analyze.1*
%{_mandir}/man1/libinput-analyze-per-slot-delta.1*
%files test
%{_libexecdir}/libinput/libinput-test-suite
%{_mandir}/man1/libinput-test-suite.1*
%changelog
* Wed Jul 15 2020 Peter Hutterer <peter.hutterer@redhat.com>
- Add basic spec file for package build testing
......@@ -8,24 +8,28 @@ detailed instructions to report bugs
## Steps to reproduce
<!-- How one can reproduce the issue - this is very important -->
<!-- How to reproduce the issue on a developer machine - this is very important -->
## libinput version you encountered the bug on
## Required information
<!-- Note: if your libinput version is older than the current stable version,
please reproduce with a current version instead -->
## Hardware information:
- libinput version:
- hardware information:
- `libinput record` output: do not paste, **attach** the file
- `libinput debug-events --verbose` output: do not paste, **attach the file**
<!-- Model name/number and general hardware information if applicable -->
<!--
## Other log output:
Paste any other relevant logs - please use code blocks (```) to format
console output, logs, and code as it's very hard to read otherwise.)
- `libinput record` output: <!-- attach file here -->
- `libinput debug-events --verbose` output: <!-- attach file here -->
Do not paste logs longer than 10 lines, **attach** those instead.
<!-- Paste any other relevant logs - please use code blocks (```) to format
console output, logs, and code as it's very hard to read otherwise.) -->
If your libinput record is longer than 5-10s, we will not be able to process
it.
-->
/label ~bug ~"needs triage"
/label ~"bug" ~"needs triage"
......@@ -9,6 +9,7 @@
"debug-gui:Show a GUI to visualize libinput's events"
"debug-tablet:Show tablet axis and button values"
"measure:Measure various properties of devices"
"analyze:Analyze device data"
"record:Record the events from a device"
"replay:Replay the events from a device"
)
......@@ -162,6 +163,33 @@ __all_seats()
':device:_files -W /dev/input/ -P /dev/input/'
}
(( $+functions[_libinput_analyze] )) || _libinput_analyze()
{
local curcontext=$curcontext state line ret=1
local features
features=(
"per-slot-delta:analyze relative movement per touch per slot"
)
_arguments -C \
'--help[Print help and exit]' \
':feature:->feature' \
'*:: :->option-or-argument'
case $state in
(feature)
_describe -t features 'feature' features
;;
(option-or-argument)
curcontext=${curcontext%:*:*}:libinput-analyze-$words[1]:
if ! _call_function ret _libinput_analyze_$words[1]; then
_message "unknown feature: $words[1]"
fi
;;
esac
return ret
}
(( $+functions[_libinput_record] )) || _libinput_record()
{
_arguments \
......
......@@ -10,7 +10,6 @@ MAX_INITIALIZER_LINES = 0
WARNINGS = YES
QUIET = YES
INPUT = "@builddir@"
FILTER_PATTERNS = *.h *.dox
IMAGE_PATH = "@builddir@"
GENERATE_HTML = YES
HTML_OUTPUT = api
......
......@@ -33,59 +33,83 @@ Measuring and fixing touchpad ranges
To fix the touchpad you need to:
#. measure the physical size of your touchpad in mm
#. run touchpad-edge-detector
#. trim the udev match rule to something sensible
#. replace the resolution with the calculated resolution based on physical settings
#. run the ``libinput measure touchpad-size`` tool
#. verify the hwdb entry provided by this tool
#. test locally
#. send a patch to the systemd project
#. send a patch to the `systemd project <https://github.com/systemd/systemd>`_.
Detailed explanations are below.
`libevdev <http://freedesktop.org/wiki/Software/libevdev/>`_ provides a tool
called **touchpad-edge-detector** that allows measuring the touchpad's input
ranges. Run the tool as root against the device node of your touchpad device
and repeatedly move a finger around the whole outside area of the
touchpad. Then control+c the process and note the output.
An example output is below:
.. note:: ``libinput measure touchpad-size`` was introduced in libinput
1.16. For earlier versions, use `libevdev <http://freedesktop.org/wiki/Software/libevdev/>`_'s
``touchpad-edge-detector`` tool.
The ``libinput measure touchpad-size`` tool is an interactive tool. It must
be called with the physical dimensions of the touchpad in mm. In the example
below, we use 100mm wide and 55mm high. The tool will find the touchpad device
automatically.
::
$> sudo touchpad-edge-detector /dev/input/event4
Touchpad SynPS/2 Synaptics TouchPad on /dev/input/event4
Move one finger around the touchpad to detect the actual edges
Kernel says: x [1024..3112], y [2024..4832]
Touchpad sends: x [2445..4252], y [3464..4071]
$> sudo libinput measure touchpad-size 100x55
Using "Touchpad SynPS/2 Synaptics TouchPad": /dev/input/event4
Kernel specified touchpad size: 99.7x75.9mm
User specified touchpad size: 100.0x55.0mm
Kernel axis range: x [1024..5112], y [2024..4832]
Detected axis range: x [ 0.. 0], y [ 0.. 0]
Move one finger along all edges of the touchpad
until the detected axis range stops changing.
Touchpad size as listed by the kernel: 49x66mm
Calculate resolution as:
x axis: 2088/<width in mm>
y axis: 2808/<height in mm>
...
Suggested udev rule:
# <Laptop model description goes here>
evdev:name:SynPS/2 Synaptics TouchPad:dmi:bvnLENOVO:bvrGJET72WW(2.22):bd02/21/2014:svnLENOVO:pn20ARS25701:pvrThinkPadT440s:rvnLENOVO:rn20ARS25701:rvrSDK0E50512STD:cvnLENOVO:ct10:cvrNotAvailable:*
EVDEV_ABS_00=2445:4252:<x resolution>
EVDEV_ABS_01=3464:4071:<y resolution>
EVDEV_ABS_35=2445:4252:<x resolution>
EVDEV_ABS_36=3464:4071:<y resolution>
Move the finger around until the detected axis range matches the data sent
by the device. ``Ctrl+C`` terminates the tool and prints a
suggested hwdb entry. ::
...
Kernel axis range: x [1024..5112], y [2024..4832]
^C
Detected axis range: x [2072..4880], y [2159..4832]
Resolutions calculated based on user-specified size: x 28, y 49 units/mm
Suggested hwdb entry:
Note: the dmi modalias match is a guess based on your machine's modalias:
dmi:bvnLENOVO:bvrGJET72WW(2.22):bd02/21/2014:svnLENOVO:pn20ARS25701:pvrThinkPadT440s:rvnLENOVO:rn20ARS25701:rvrSDK0E50512STD:cvnLENOVO:ct10:cvrNotAvailable:
Please verify that this is the most sensible match and adjust if necessary.
-8<--------------------------
# Laptop model description (e.g. Lenovo X1 Carbon 5th)
evdev:name:SynPS/2 Synaptics TouchPad:dmi:*svnLENOVO:*pvrThinkPadT440s*
EVDEV_ABS_00=2072:4880:28
EVDEV_ABS_01=2159:4832:49
EVDEV_ABS_35=2072:4880:28
EVDEV_ABS_36=2159:4832:49
-8<--------------------------
Instructions on what to do with this snippet are in /usr/lib/udev/hwdb.d/60-evdev.hwdb
Note the discrepancy between the coordinate range the kernels advertises vs.
what the touchpad sends.
To fix the advertised ranges, the udev rule should be taken and trimmed
before being sent to the `systemd project <https://github.com/systemd/systemd>`_.
If there are discrepancies between the coordinate range the kernels
advertises and what what the touchpad sends, the hwdb entry should be added to the
``60-evdev.hwdb`` file provided by the `systemd project <https://github.com/systemd/systemd>`_.
An example commit can be found
`here <https://github.com/systemd/systemd/commit/26f667eac1c5e89b689aa0a1daef6a80f473e045>`_.
In most cases the match can and should be trimmed to the system vendor (svn)
and the product version (pvr), with everything else replaced by a wildcard
(*). In this case, a Lenovo T440s, a suitable match string would be:
The ``libinput measure touchpad-size`` tool attempts to provide the correct
dmi match but it does require user verification.
In most cases the dmi match can and should be trimmed to the system vendor (``svn``)
and the product version (``pvr``) or product name (``pn``), with everything else
replaced by a wildcard (``*``). In the above case, the match string is:
::
evdev:name:SynPS/2 Synaptics TouchPad:dmi:*svnLENOVO:*pvrThinkPadT440s*
As a general rule: for Lenovo devices use ``pvr`` and for all others use
``pn``.
.. note:: hwdb match strings only allow for alphanumeric ascii characters. Use a
wildcard (* or ?, whichever appropriate) for special characters.
......@@ -95,19 +119,19 @@ The actual axis overrides are in the form:
::
# axis number=min:max:resolution
EVDEV_ABS_00=2445:4252:42
EVDEV_ABS_00=2072:4880:28
or, if the range is correct but the resolution is wrong
::
# axis number=::resolution
EVDEV_ABS_00=::42
EVDEV_ABS_00=::28
Note the leading single space. The axis numbers are in hex and can be found
in *linux/input-event-codes.h*. For touchpads ABS_X, ABS_Y,
ABS_MT_POSITION_X and ABS_MT_POSITION_Y are required.
in ``linux/input-event-codes.h``. For touchpads ``ABS_X``, ``ABS_Y``,
``ABS_MT_POSITION_X`` and ``ABS_MT_POSITION_Y`` are required.
.. note:: The touchpad's ranges and/or resolution should only be fixed when
there is a significant discrepancy. A few units do not make a
......
......@@ -121,7 +121,7 @@ overwriting manually installed files.
- **Fedora 22** and later: ``sudo dnf reinstall libinput``
- **RHEL/CentOS/Fedora 21** and earlier: ``sudo yum reinstall libinput``
- **openSUSE**: ``sudo zypper install --force libinput10``
- **Arch**: ``sudo packman -S libinput``
- **Arch**: ``sudo pacman -S libinput``
.. _building_selinux:
......
......@@ -194,5 +194,6 @@ custom_target('sphinx',
input : [ sphinx_conf_py, git_version_page ] + src_sphinx + dst_404s,
output : [ sphinx_output_dir ],
command : [ sphinx, '-q', '-b', 'html',
'-d', join_paths(meson.current_build_dir(), 'doctrees'),
meson.current_build_dir(), sphinx_output_dir],
build_by_default : true)
......@@ -21,6 +21,8 @@ The most common tools used are:
see :ref:`here <libinput-record>`
- ``libinput measure``: measure properties on a kernel device,
see :ref:`here <libinput-measure>`
- ``libinput analyze``: analyse event recordings from a kernel device,
see :ref:`here <libinput-analyze>`
- ``libinput quirks``: show quirks assigned to a device, see
:ref:`here <libinput-quirks>`
......@@ -302,6 +304,19 @@ thing and one thing only and their usage is highly specific to the tool.
Please see the **libinput-measure(1)** man page for information about what
tools are available and the man page for each respective tool.
.. _libinput-analyze:
------------------------------------------------------------------------------
Analyzing device events with libinput analyze
------------------------------------------------------------------------------
The ``libinput analyze`` tool is a multiplexer for various sub-tools that
can analyze input events previously recorded from a device.
Please see the **libinput-analyze(1)** man page for information about what
tools are available and the man page for each respective too.
.. _libinput-quirks:
------------------------------------------------------------------------------
......
......@@ -14,10 +14,13 @@ position.
When libinput detects a cursor jump it prints a bug warning to the log with
the text **"Touch jump detected and discarded."** and a link to this page.
In most cases, this is a bug in the kernel driver and to libinput it appears
that the touch point moves from its previous position. The pointer jump can
usually be seen in the :ref:`libinput record <libinput-record>` output for the device:
.. note:: This warning is ratelimited and will stop appearing after a few
times, even if the touchpad jumps continue.
In most cases, this is a bug in the firmware (or kernel driver) and to
libinput it appears that the touch point moves from its previous position.
The pointer jump can usually be seen in the :ref:`libinput record
<libinput-record>` output for the device:
::
......@@ -50,9 +53,14 @@ usually be seen in the :ref:`libinput record <libinput-record>` output for the d
In this recording, the pointer jumps from its position 3752/2216 to
1640/4681 within a single frame. On this particular touchpad, this would
represent a physical move of almost 50mm. libinput detects some of these
jumps and discards the movement but otherwise continues as usual. However,
the bug should be fixed at the kernel level.
jumps and discards the movement but otherwise continues as usual.
If your only encounter with these jumps is the warning printed to the log,
libinput functions as intended.
When you encounter the warning in the log, please generate a recording of
your touchpad with :ref:`libinput record <libinput-record>` and file a bug.
See :ref:`reporting_bugs` for more details.
Note that it most cases, libinput cannot actually fix the issue. Filing a
bug is useful to figure out if there are other factors at play or whether
there are heuristics we can employ to reduce the impact.
......@@ -38,27 +38,43 @@ statistics, including whether a touch is/was considered logically down.
Example output of the tool is below: ::
$ sudo libinput measure touchpad-pressure
Ready for recording data.
Pressure range used: 8:10
Palm pressure range used: 65535
Place a single finger on the touchpad to measure pressure values.
Ctrl+C to exit
&nbsp;
Sequence 1190 pressure: min: 39 max: 48 avg: 43 median: 44 tags: down
Sequence 1191 pressure: min: 49 max: 65 avg: 62 median: 64 tags: down
Sequence 1192 pressure: min: 40 max: 78 avg: 64 median: 66 tags: down
Sequence 1193 pressure: min: 36 max: 83 avg: 70 median: 73 tags: down
Sequence 1194 pressure: min: 43 max: 76 avg: 72 median: 74 tags: down
Touchpad pressure: 47 min: 47 max: 86 tags: down
$ sudo libinput measure touchpad-pressure
Using Synaptics TM2668-002: /dev/input/event21
This is an interactive tool
Place a single finger on the touchpad to measure pressure values.
Check that:
- touches subjectively perceived as down are tagged as down
- touches with a thumb are tagged as thumb
- touches with a palm are tagged as palm
If the touch states do not match the interaction, re-run
with --touch-thresholds=down:up using observed pressure values.
See --help for more options.
Press Ctrl+C to exit
+-------------------------------------------------------------------------------+
| Thresh | 70 | 60 | 130 | 100 | |
+-------------------------------------------------------------------------------+
| Touch | down | up | palm | thumb | min | max | p | avg | median |
+-------------------------------------------------------------------------------+
| 178 | x | x | | | 75 | 75 | 0 | 75 | 75 |
| 179 | x | x | | | 35 | 88 | 0 | 77 | 81 |
| 180 | x | x | | x | 65 | 113 | 0 | 98 | 98 |
| 181 | x | x | | x | 50 | 101 | 0 | 86 | 90 |
| 182 | x | x | | | 40 | 80 | 0 | 66 | 70 |
| 183 | x | | | | 43 | 78 | 78 | |
...
The example output shows five completed touch sequences and one ongoing one.
For each, the respective minimum and maximum pressure values are printed as
well as some statistics. The ``tags`` show that sequence was considered
logically down at some point. This is an interactive tool and its output may
change frequently. Refer to the **libinput-measure-touchpad-pressure(1)** man
page for more details.
well as some statistics. The ``down`` column show that each sequence was
considered logically down at some point, two of the sequences were considered
thumbs. This is an interactive tool and its output may change frequently. Refer
to the **libinput-measure-touchpad-pressure(1)** man page for more details.
By default, this tool uses the :ref:`device-quirks` for the pressure range. To
narrow down on the best values for your device, specify the 'logically down'
......
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
/*
* Input event codes
*
......@@ -439,10 +439,12 @@
#define KEY_TITLE 0x171
#define KEY_SUBTITLE 0x172
#define KEY_ANGLE 0x173
#define KEY_ZOOM 0x174
#define KEY_FULL_SCREEN 0x174 /* AC View Toggle */
#define KEY_ZOOM KEY_FULL_SCREEN
#define KEY_MODE 0x175
#define KEY_KEYBOARD 0x176
#define KEY_SCREEN 0x177
#define KEY_ASPECT_RATIO 0x177 /* HUTRR37: Aspect */
#define KEY_SCREEN KEY_ASPECT_RATIO
#define KEY_PC 0x178 /* Media Select Computer */
#define KEY_TV 0x179 /* Media Select TV */
#define KEY_TV2 0x17a /* Media Select Cable */
......@@ -604,6 +606,7 @@
#define KEY_SCREENSAVER 0x245 /* AL Screen Saver */
#define KEY_VOICECOMMAND 0x246 /* Listening Voice Command */
#define KEY_ASSISTANT 0x247 /* AL Context-aware desktop assistant */
#define KEY_KBD_LAYOUT_NEXT 0x248 /* AC Next Keyboard Layout Select */
#define KEY_BRIGHTNESS_MIN 0x250 /* Set Brightness to Minimum */
#define KEY_BRIGHTNESS_MAX 0x251 /* Set Brightness to Maximum */
......@@ -646,6 +649,86 @@
*/
#define KEY_DATA 0x277
#define KEY_ONSCREEN_KEYBOARD 0x278
/* Electronic privacy screen control */
#define KEY_PRIVACY_SCREEN_TOGGLE 0x279
/* Select an area of screen to be copied */
#define KEY_SELECTIVE_SCREENSHOT 0x27a
/*
* Some keyboards have keys which do not have a defined meaning, these keys
* are intended to be programmed / bound to macros by the user. For most
* keyboards with these macro-keys the key-sequence to inject, or action to
* take, is all handled by software on the host side. So from the kernel's
* point of view these are just normal keys.
*
* The KEY_MACRO# codes below are intended for such keys, which may be labeled
* e.g. G1-G18, or S1 - S30. The KEY_MACRO# codes MUST NOT be used for keys
* where the marking on the key does indicate a defined meaning / purpose.
*
* The KEY_MACRO# codes MUST also NOT be used as fallback for when no existing
* KEY_FOO define matches the marking / purpose. In this case a new KEY_FOO
* define MUST be added.
*/
#define KEY_MACRO1 0x290
#define KEY_MACRO2 0x291
#define KEY_MACRO3 0x292
#define KEY_MACRO4 0x293
#define KEY_MACRO5 0x294
#define KEY_MACRO6 0x295
#define KEY_MACRO7 0x296
#define KEY_MACRO8 0x297
#define KEY_MACRO9 0x298
#define KEY_MACRO10 0x299
#define KEY_MACRO11 0x29a
#define KEY_MACRO12 0x29b
#define KEY_MACRO13 0x29c
#define KEY_MACRO14 0x29d
#define KEY_MACRO15 0x29e
#define KEY_MACRO16 0x29f
#define KEY_MACRO17 0x2a0
#define KEY_MACRO18 0x2a1
#define KEY_MACRO19 0x2a2
#define KEY_MACRO20 0x2a3
#define KEY_MACRO21 0x2a4
#define KEY_MACRO22 0x2a5
#define KEY_MACRO23 0x2a6
#define KEY_MACRO24 0x2a7
#define KEY_MACRO25 0x2a8
#define KEY_MACRO26 0x2a9
#define KEY_MACRO27 0x2aa
#define KEY_MACRO28 0x2ab
#define KEY_MACRO29 0x2ac
#define KEY_MACRO30 0x2ad
/*
* Some keyboards with the macro-keys described above have some extra keys
* for controlling the host-side software responsible for the macro handling:
* -A macro recording start/stop key. Note that not all keyboards which emit
* KEY_MACRO_RECORD_START will also emit KEY_MACRO_RECORD_STOP if
* KEY_MACRO_RECORD_STOP is not advertised, then KEY_MACRO_RECORD_START
* should be interpreted as a recording start/stop toggle;
* -Keys for switching between different macro (pre)sets, either a key for
* cycling through the configured presets or keys to directly select a preset.
*/
#define KEY_MACRO_RECORD_START 0x2b0
#define KEY_MACRO_RECORD_STOP 0x2b1
#define KEY_MACRO_PRESET_CYCLE 0x2b2
#define KEY_MACRO_PRESET1 0x2b3
#define KEY_MACRO_PRESET2 0x2b4
#define KEY_MACRO_PRESET3 0x2b5
/*
* Some keyboards have a buildin LCD panel where the contents are controlled
* by the host. Often these have a number of keys directly below the LCD
* intended for controlling a menu shown on the LCD. These keys often don't
* have any labeling so we just name them KEY_KBD_LCD_MENU#
*/
#define KEY_KBD_LCD_MENU1 0x2b8
#define KEY_KBD_LCD_MENU2 0x2b9
#define KEY_KBD_LCD_MENU3 0x2ba
#define KEY_KBD_LCD_MENU4 0x2bb
#define KEY_KBD_LCD_MENU5 0x2bc
#define BTN_TRIGGER_HAPPY 0x2c0
#define BTN_TRIGGER_HAPPY1 0x2c0
......@@ -805,7 +888,8 @@
#define SW_LINEIN_INSERT 0x0d /* set = inserted */
#define SW_MUTE_DEVICE 0x0e /* set = device disabled */
#define SW_PEN_INSERTED 0x0f /* set = pen inserted */
#define SW_MAX 0x0f
#define SW_MACHINE_COVER 0x10 /* set = cover closed */
#define SW_MAX 0x10
#define SW_CNT (SW_MAX+1)
/*
......
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
/*
* Input event codes
*
......@@ -439,10 +439,12 @@
#define KEY_TITLE 0x171
#define KEY_SUBTITLE 0x172
#define KEY_ANGLE 0x173
#define KEY_ZOOM 0x174
#define KEY_FULL_SCREEN 0x174 /* AC View Toggle */
#define KEY_ZOOM KEY_FULL_SCREEN
#define KEY_MODE 0x175
#define KEY_KEYBOARD 0x176
#define KEY_SCREEN 0x177
#define KEY_ASPECT_RATIO 0x177 /* HUTRR37: Aspect */
#define KEY_SCREEN KEY_ASPECT_RATIO
#define KEY_PC 0x178 /* Media Select Computer */
#define KEY_TV 0x179 /* Media Select TV */
#define KEY_TV2 0x17a /* Media Select Cable */
......@@ -604,6 +606,7 @@
#define KEY_SCREENSAVER 0x245 /* AL Screen Saver */
#define KEY_VOICECOMMAND 0x246 /* Listening Voice Command */
#define KEY_ASSISTANT 0x247 /* AL Context-aware desktop assistant */
#define KEY_KBD_LAYOUT_NEXT 0x248 /* AC Next Keyboard Layout Select */
#define KEY_BRIGHTNESS_MIN 0x250 /* Set Brightness to Minimum */
#define KEY_BRIGHTNESS_MAX 0x251 /* Set Brightness to Maximum */
......@@ -646,6 +649,86 @@
*/
#define KEY_DATA 0x277
#define KEY_ONSCREEN_KEYBOARD 0x278
/* Electronic privacy screen control */
#define KEY_PRIVACY_SCREEN_TOGGLE 0x279
/* Select an area of screen to be copied */
#define KEY_SELECTIVE_SCREENSHOT 0x27a
/*
* Some keyboards have keys which do not have a defined meaning, these keys
* are intended to be programmed / bound to macros by the user. For most
* keyboards with these macro-keys the key-sequence to inject, or action to
* take, is all handled by software on the host side. So from the kernel's
* point of view these are just normal keys.
*
* The KEY_MACRO# codes below are intended for such keys, which may be labeled
* e.g. G1-G18, or S1 - S30. The KEY_MACRO# codes MUST NOT be used for keys
* where the marking on the key does indicate a defined meaning / purpose.
*
* The KEY_MACRO# codes MUST also NOT be used as fallback for when no existing
* KEY_FOO define matches the marking / purpose. In this case a new KEY_FOO
* define MUST be added.
*/
#define KEY_MACRO1 0x290
#define KEY_MACRO2 0x291
#define KEY_MACRO3 0x292
#define KEY_MACRO4 0x293
#define KEY_MACRO5 0x294
#define KEY_MACRO6 0x295
#define KEY_MACRO7 0x296
#define KEY_MACRO8 0x297
#define KEY_MACRO9 0x298
#define KEY_MACRO10 0x299
#define KEY_MACRO11 0x29a
#define KEY_MACRO12 0x29b
#define KEY_MACRO13 0x29c
#define KEY_MACRO14 0x29d
#define KEY_MACRO15 0x29e
#define KEY_MACRO16 0x29f
#define KEY_MACRO17 0x2a0
#define KEY_MACRO18 0x2a1
#define KEY_MACRO19 0x2a2
#define KEY_MACRO20 0x2a3
#define KEY_MACRO21 0x2a4
#define KEY_MACRO22 0x2a5
#define KEY_MACRO23 0x2a6
#define KEY_MACRO24 0x2a7
#define KEY_MACRO25 0x2a8
#define KEY_MACRO26 0x2a9
#define KEY_MACRO27 0x2aa
#define KEY_MACRO28 0x2ab
#define KEY_MACRO29 0x2ac
#define KEY_MACRO30 0x2ad
/*
* Some keyboards with the macro-keys described above have some extra keys
* for controlling the host-side software responsible for the macro handling:
* -A macro recording start/stop key. Note that not all keyboards which emit
* KEY_MACRO_RECORD_START will also emit KEY_MACRO_RECORD_STOP if
* KEY_MACRO_RECORD_STOP is not advertised, then KEY_MACRO_RECORD_START
* should be interpreted as a recording start/stop toggle;
* -Keys for switching between different macro (pre)sets, either a key for
* cycling through the configured presets or keys to directly select a preset.
*/
#define KEY_MACRO_RECORD_START 0x2b0
#define KEY_MACRO_RECORD_STOP 0x2b1
#define KEY_MACRO_PRESET_CYCLE 0x2b2
#define KEY_MACRO_PRESET1 0x2b3
#define KEY_MACRO_PRESET2 0x2b4
#define KEY_MACRO_PRESET3 0x2b5
/*
* Some keyboards have a buildin LCD panel where the contents are controlled
* by the host. Often these have a number of keys directly below the LCD
* intended for controlling a menu shown on the LCD. These keys often don't
* have any labeling so we just name them KEY_KBD_LCD_MENU#
*/
#define KEY_KBD_LCD_MENU1 0x2b8
#define KEY_KBD_LCD_MENU2 0x2b9
#define KEY_KBD_LCD_MENU3 0x2ba
#define KEY_KBD_LCD_MENU4 0x2bb
#define KEY_KBD_LCD_MENU5 0x2bc
#define BTN_TRIGGER_HAPPY 0x2c0
#define BTN_TRIGGER_HAPPY1 0x2c0
......@@ -805,7 +888,8 @@
#define SW_LINEIN_INSERT 0x0d /* set = inserted */
#define SW_MUTE_DEVICE 0x0e /* set = device disabled */
#define SW_PEN_INSERTED 0x0f /* set = pen inserted */
#define SW_MAX 0x0f
#define SW_MACHINE_COVER 0x10 /* set = cover closed */
#define SW_MAX 0x10
#define SW_CNT (SW_MAX+1)
/*
......
project('libinput', 'c',
version : '1.15.3',
version : '1.16.1',
license : 'MIT/Expat',
default_options : [ 'c_std=gnu99', 'warning_level=2' ],
meson_version : '>= 0.41.0')
meson_version : '>= 0.45.0')
libinput_version = meson.project_version().split('.')
......@@ -289,6 +289,7 @@ src_libfilter = [
'src/filter-low-dpi.c',
'src/filter-mouse.c',
'src/filter-touchpad.c',
'src/filter-touchpad-flat.c',
'src/filter-touchpad-x230.c',
'src/filter-tablet.c',
'src/filter-trackpoint.c',
......@@ -306,47 +307,11 @@ libinput_data_override_path = join_paths(dir_sysconf, 'local-overrides.quirks')
config_h.set_quoted('LIBINPUT_QUIRKS_DIR', dir_data)
config_h.set_quoted('LIBINPUT_QUIRKS_OVERRIDE_FILE', libinput_data_override_path)
quirks_data = [
'quirks/10-generic-keyboard.quirks',
'quirks/10-generic-lid.quirks',
'quirks/10-generic-trackball.quirks',
'quirks/30-vendor-aiptek.quirks',
'quirks/30-vendor-alps.quirks',
'quirks/30-vendor-contour.quirks',
'quirks/30-vendor-cypress.quirks',
'quirks/30-vendor-elantech.quirks',
'quirks/30-vendor-ibm.quirks',
'quirks/30-vendor-kensington.quirks',
'quirks/30-vendor-logitech.quirks',
'quirks/30-vendor-madcatz.quirks',
'quirks/30-vendor-microsoft.quirks',
'quirks/30-vendor-razer.quirks',
'quirks/30-vendor-synaptics.quirks',
'quirks/30-vendor-vmware.quirks',
'quirks/30-vendor-wacom.quirks',
'quirks/50-system-acer.quirks',
'quirks/50-system-apple.quirks',
'quirks/50-system-asus.quirks',
'quirks/50-system-chicony.quirks',
'quirks/50-system-cyborg.quirks',
'quirks/50-system-dell.quirks',
'quirks/50-system-google.quirks',
'quirks/50-system-hp.quirks',
'quirks/50-system-lenovo.quirks',
'quirks/50-system-system76.quirks',
'quirks/50-system-toshiba.quirks',
]
test('quirks-in-meson.build',
find_program('quirks/test-quirks-in-meson.build.sh'),
args : [meson.current_source_dir()],
suite : ['all']
)
config_h.set_quoted('LIBINPUT_QUIRKS_FILES', ':'.join(quirks_data))
config_h.set_quoted('LIBINPUT_QUIRKS_SRCDIR', dir_src_quirks)
install_data(quirks_data, install_dir : dir_data)
install_subdir('quirks',
exclude_files: ['README.md'],
install_dir : dir_data,
strip_directory : true)
src_libquirks = [
'src/quirks.c',
......@@ -577,8 +542,24 @@ configure_file(input : 'tools/libinput-measure.man',
install_dir : dir_man1,
)
libinput_analyze_sources = [ 'tools/libinput-analyze.c' ]
executable('libinput-analyze',
libinput_analyze_sources,
dependencies : deps_tools,
include_directories : [includes_src, includes_include],
install_dir : libinput_tool_path,
install : true,
)
configure_file(input : 'tools/libinput-analyze.man',
output : 'libinput-analyze.1',
configuration : man_config,
install_dir : dir_man1,
)
src_python_tools = files(
'tools/libinput-analyze-per-slot-delta.py',
'tools/libinput-measure-fuzz.py',
'tools/libinput-measure-touchpad-size.py',
'tools/libinput-measure-touchpad-tap.py',
'tools/libinput-measure-touchpad-pressure.py',
'tools/libinput-measure-touch-size.py',
......@@ -601,9 +582,11 @@ endforeach
src_man = files(
'tools/libinput-measure-fuzz.man',
'tools/libinput-measure-touchpad-size.man',
'tools/libinput-measure-touchpad-tap.man',
'tools/libinput-measure-touchpad-pressure.man',
'tools/libinput-measure-touch-size.man',
'tools/libinput-analyze-per-slot-delta.man',
)
foreach m : src_man
......@@ -686,13 +669,16 @@ executable('ptraccel-debug',
# subtool lookup
if get_option('buildtype') == 'debug' or get_option('buildtype') == 'debugoptimized'
config_tool_option_test = configuration_data()
config_tool_option_test.set('DISABLE_WARNING', 'yes')
config_tool_option_test.set('MESON_ENABLED_DEBUG_GUI', get_option('debug-gui'))
tool_option_test = configure_file(input: 'tools/test-tool-option-parsing.py',
output: '@BASENAME@',
config_tool_option_test.set('MESON_BUILD_ROOT', meson.current_build_dir())
config_tool_option_test.set('TOOL_PATH', libinput_tool.full_path())
tool_option_test = configure_file(input: 'tools/test_tool_option_parsing.py',
output: '@PLAINNAME@',
configuration : config_tool_option_test)
test('tool-option-parsing',
tool_option_test,
args : ['--tool-path', libinput_tool.full_path()],
args : [tool_option_test, '-n', 'auto'],
suite : ['all', 'root'],
timeout : 240)
endif
......@@ -799,6 +785,7 @@ if get_option('tests')
'test/litest-device-keyboard-razer-blade-stealth-videoswitch.c',
'test/litest-device-lid-switch.c',
'test/litest-device-lid-switch-surface3.c',
'test/litest-device-logitech-media-keyboard-elite.c',
'test/litest-device-logitech-trackball.c',
'test/litest-device-nexus4-touch-screen.c',
'test/litest-device-magic-trackpad.c',
......@@ -812,6 +799,7 @@ if get_option('tests')
'test/litest-device-ms-surface-cover.c',
'test/litest-device-protocol-a-touch-screen.c',
'test/litest-device-qemu-usb-tablet.c',
'test/litest-device-sony-vaio-keys.c',
'test/litest-device-synaptics-x220.c',
'test/litest-device-synaptics-hover.c',
'test/litest-device-synaptics-i2c.c',
......@@ -819,6 +807,7 @@ if get_option('tests')
'test/litest-device-synaptics-st.c',
'test/litest-device-synaptics-t440.c',
'test/litest-device-synaptics-x1-carbon-3rd.c',
'test/litest-device-tablet-mode-switch.c',
'test/litest-device-thinkpad-extrabuttons.c',
'test/litest-device-trackpoint.c',
'test/litest-device-touch-screen.c',
......
......@@ -5,3 +5,10 @@ MatchUdevType=tablet
MatchBus=usb
MatchVendor=0x08CA
AttrEventCodeDisable=ABS_TILT_X;ABS_TILT_Y;
[Aiptek 8000U pressure threshold]
MatchUdevType=tablet
MatchBus=usb
MatchVendor=0x08CA
MatchProduct=0x0010
AttrPressureRange=70:50
......@@ -46,6 +46,33 @@ MatchVendor=0x046D
MatchProduct=0x4011
AttrPalmPressureThreshold=400
[Logitech MX Master]
MatchVendor=0x46D
MatchProduct=0x4041
ModelInvertHorizontalScrolling=1
[Logitech MX Master]
MatchVendor=0x46D
MatchProduct=0x4060
ModelInvertHorizontalScrolling=1
[Logitech MX Master]
MatchVendor=0x46D
MatchProduct=0x4071
ModelInvertHorizontalScrolling=1
# MX Master has a different PID on bluetooth
[Logitech MX Master]
MatchVendor=0x46D
MatchProduct=0xB012
ModelInvertHorizontalScrolling=1
[Logitech MX Master]
MatchVendor=0x46D
MatchProduct=0xB017
ModelInvertHorizontalScrolling=1
[Logitech MX Master]
MatchVendor=0x46D
MatchProduct=0xB01E
ModelInvertHorizontalScrolling=1
[Logitech MX Master 2S]
MatchVendor=0x46D
MatchProduct=0x4069
......