mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-03-23 16:40:42 +01:00
Compare commits
16 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4d6545a6a1 | ||
|
|
4ab9c15cac | ||
|
|
17692e5d24 | ||
|
|
c24abedeb4 | ||
|
|
8ac3c49a61 | ||
|
|
7079bef05f | ||
|
|
63c9cc5d75 | ||
|
|
c5f3939478 | ||
|
|
51cc2088ab | ||
|
|
1630d2ef2d | ||
|
|
1061485cd2 | ||
|
|
d0fe38e1ae | ||
|
|
e69dccd95e | ||
|
|
a0e677cc92 | ||
|
|
124c112420 | ||
|
|
c17ab4dacd |
19 changed files with 323 additions and 29 deletions
|
|
@ -2,7 +2,7 @@ AC_PREREQ([2.64])
|
||||||
|
|
||||||
m4_define([libinput_major_version], [1])
|
m4_define([libinput_major_version], [1])
|
||||||
m4_define([libinput_minor_version], [7])
|
m4_define([libinput_minor_version], [7])
|
||||||
m4_define([libinput_micro_version], [0])
|
m4_define([libinput_micro_version], [2])
|
||||||
m4_define([libinput_version],
|
m4_define([libinput_version],
|
||||||
[libinput_major_version.libinput_minor_version.libinput_micro_version])
|
[libinput_major_version.libinput_minor_version.libinput_micro_version])
|
||||||
|
|
||||||
|
|
@ -36,7 +36,7 @@ AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz])
|
||||||
# b) If interfaces have been changed or added, but binary compatibility has
|
# b) If interfaces have been changed or added, but binary compatibility has
|
||||||
# been preserved, change to C+1:0:A+1
|
# been preserved, change to C+1:0:A+1
|
||||||
# c) If the interface is the same as the previous version, change to C:R+1:A
|
# c) If the interface is the same as the previous version, change to C:R+1:A
|
||||||
LIBINPUT_LT_VERSION=22:2:12
|
LIBINPUT_LT_VERSION=22:4:12
|
||||||
AC_SUBST(LIBINPUT_LT_VERSION)
|
AC_SUBST(LIBINPUT_LT_VERSION)
|
||||||
|
|
||||||
AM_SILENT_RULES([yes])
|
AM_SILENT_RULES([yes])
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ header_files = \
|
||||||
$(srcdir)/test-suite.dox \
|
$(srcdir)/test-suite.dox \
|
||||||
$(srcdir)/tools.dox \
|
$(srcdir)/tools.dox \
|
||||||
$(srcdir)/touchpad-jumping-cursors.dox \
|
$(srcdir)/touchpad-jumping-cursors.dox \
|
||||||
|
$(srcdir)/touchpad-pressure.dox \
|
||||||
$(srcdir)/touchpads.dox \
|
$(srcdir)/touchpads.dox \
|
||||||
$(srcdir)/what-is-libinput.dox
|
$(srcdir)/what-is-libinput.dox
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,8 @@ overwriting manually installed files.
|
||||||
<li><b>Debian/Ubuntu</b> based distributions: ```sudo apt-get install
|
<li><b>Debian/Ubuntu</b> based distributions: ```sudo apt-get install
|
||||||
--reinstall libinput```</li>
|
--reinstall libinput```</li>
|
||||||
<li><b>Fedora 22</b> and later: ```sudo dnf reinstall libinput```</li>
|
<li><b>Fedora 22</b> and later: ```sudo dnf reinstall libinput```</li>
|
||||||
<li><b>SuSE/RHEL/CentOS/Fedora 21</b> and earlier: ```sudo yum reinstall libinput```</li>
|
<li><b>RHEL/CentOS/Fedora 21</b> and earlier: ```sudo yum reinstall libinput```</li>
|
||||||
|
<li><b>openSUSE</b>: ```sudo zypper install --force libinput10```</li>
|
||||||
<li><b>Arch</b>: ```sudo packman -S libinput```</li>
|
<li><b>Arch</b>: ```sudo packman -S libinput```</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|
@ -80,7 +81,15 @@ These can be installed with one of the following commands:
|
||||||
<li><b>Debian/Ubuntu</b> based distributions: ```sudo apt-get build-dep
|
<li><b>Debian/Ubuntu</b> based distributions: ```sudo apt-get build-dep
|
||||||
libinput```</li>
|
libinput```</li>
|
||||||
<li><b>Fedora 22</b> and later: ```sudo dnf builddep libinput```</li>
|
<li><b>Fedora 22</b> and later: ```sudo dnf builddep libinput```</li>
|
||||||
<li><b>SuSE/RHEL/CentOS/Fedora 21</b> and earlier: ```sudo yum-builddep libinput```</li>
|
<li><b>RHEL/CentOS/Fedora 21</b> and earlier: ```sudo yum-builddep libinput```</li>
|
||||||
|
<li><b>openSUSE</b>:
|
||||||
|
<pre>
|
||||||
|
$> sudo zypper modifyrepo --enable `zypper repos | grep source | awk '{print $5}'`
|
||||||
|
$> sudo zypper source-install -d libinput10
|
||||||
|
$> sudo zypper install autoconf automake libtool
|
||||||
|
$> sudo zypper modifyrepo --disable `zypper repos | grep source | awk '{print $5}'`
|
||||||
|
</pre>
|
||||||
|
</li>
|
||||||
<li><b>Arch</b>:
|
<li><b>Arch</b>:
|
||||||
<pre>
|
<pre>
|
||||||
$> abs extra/libinput
|
$> abs extra/libinput
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ devices with the same property value are grouped into the same device group,
|
||||||
the value itself is irrelevant otherwise.
|
the value itself is irrelevant otherwise.
|
||||||
</dd>
|
</dd>
|
||||||
<dt>ID_SEAT</dt>
|
<dt>ID_SEAT</dt>
|
||||||
<dd>Assigns the physical seat for this device. See
|
<dd>Assigns the physical @ref seats "seat" for this device. See
|
||||||
libinput_seat_get_physical_name(). Defaults to "seat0".</dd>
|
libinput_seat_get_physical_name(). Defaults to "seat0".</dd>
|
||||||
<dt>ID_INPUT</dt>
|
<dt>ID_INPUT</dt>
|
||||||
<dd>If this property is set, the device is considered an input device. Any
|
<dd>If this property is set, the device is considered an input device. Any
|
||||||
|
|
@ -49,7 +49,7 @@ one of these may be set at any time, libinput will select only one of these
|
||||||
to determine the device type. To ensure libinput selects the correct device
|
to determine the device type. To ensure libinput selects the correct device
|
||||||
type, only set one of them.</dd>
|
type, only set one of them.</dd>
|
||||||
<dt>WL_SEAT</dt>
|
<dt>WL_SEAT</dt>
|
||||||
<dd>Assigns the logical seat for this device. See
|
<dd>Assigns the logical @ref seats "seat" for this device. See
|
||||||
libinput_seat_get_logical_name()
|
libinput_seat_get_logical_name()
|
||||||
context. Defaults to "default".</dd>
|
context. Defaults to "default".</dd>
|
||||||
<dt>MOUSE_DPI</dt>
|
<dt>MOUSE_DPI</dt>
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,11 @@ motion_normalization for a detailed explanation.
|
||||||
|
|
||||||
See @ref tapping_default
|
See @ref tapping_default
|
||||||
|
|
||||||
|
@section faq_touchpad_pressure Why does my touchpad lose track of touches
|
||||||
|
|
||||||
|
The most common cause for this is an incorrect pressure threshold range.
|
||||||
|
See @ref touchpad_pressure for more info.
|
||||||
|
|
||||||
@section faq_kinetic_scrolling Kinetic scrolling does not work
|
@section faq_kinetic_scrolling Kinetic scrolling does not work
|
||||||
|
|
||||||
The X.Org synaptics driver implemented kinetic scrolling in the driver. It
|
The X.Org synaptics driver implemented kinetic scrolling in the driver. It
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
- @subpage clickpad_softbuttons
|
- @subpage clickpad_softbuttons
|
||||||
- @subpage tapping
|
- @subpage tapping
|
||||||
- @subpage gestures
|
- @subpage gestures
|
||||||
|
- @subpage touchpad_pressure
|
||||||
- @subpage palm_detection
|
- @subpage palm_detection
|
||||||
- @subpage t440_support
|
- @subpage t440_support
|
||||||
- @subpage touchpad_jumping_cursor
|
- @subpage touchpad_jumping_cursor
|
||||||
|
|
|
||||||
138
doc/touchpad-pressure.dox
Normal file
138
doc/touchpad-pressure.dox
Normal file
|
|
@ -0,0 +1,138 @@
|
||||||
|
/**
|
||||||
|
@page touchpad_pressure Touchpad pressure-based touch detection
|
||||||
|
|
||||||
|
libinput uses the touchpad pressure values to detect wether a finger has
|
||||||
|
been placed on the touchpad. This is @ref kernel_pressure_information and
|
||||||
|
combines with a libinput-specific hardware database to adjust the thresholds
|
||||||
|
on a per-device basis. libinput uses pressure thresholds primarily to filter
|
||||||
|
out accidental light touches but pressure information is also used for
|
||||||
|
some @ref palm_detection.
|
||||||
|
|
||||||
|
Pressure thresholds are **not** directly configurable by the user, rather it
|
||||||
|
is planned that libinput provides custom pressure thresholds for each device
|
||||||
|
where necessary. See @ref touchpad_pressure_hwdb for instructions for your
|
||||||
|
local device.
|
||||||
|
|
||||||
|
@section kernel_pressure_information Information provided by the kernel
|
||||||
|
|
||||||
|
The kernel sends multiple values to inform userspace about a finger touching
|
||||||
|
the touchpad. The most basic is the ```EV_KEY/BTN_TOUCH``` boolean event
|
||||||
|
that simply announces physical contact with the touchpad. The decision when
|
||||||
|
this event is sent is usually made by the kernel driver and may depend on
|
||||||
|
device-specific thresholds. These thresholds are transparent to userspace
|
||||||
|
and cannot be modified.
|
||||||
|
|
||||||
|
Many contemporary touchpad devices provide an absolute pressure axis in
|
||||||
|
addition to ```BTN_TOUCH```. This pressure generally increases as the pressure
|
||||||
|
increases, however few touchpads are capable of detection pressure. The
|
||||||
|
pressure value is usually related to the covered area - as the pressure
|
||||||
|
increases a finger flattens and thus covers a larger area. The range
|
||||||
|
provided by the kernel is not mapped to a specific physical range and
|
||||||
|
often requires adjustment. Pressure is sent by the ```ABS_PRESSURE``` axis
|
||||||
|
for single-touch touchpads or ```ABS_MT_PRESSURE``` on multi-touch capable
|
||||||
|
touchpads.
|
||||||
|
|
||||||
|
Some devices provide additional touch size information through
|
||||||
|
the ```ABS_MT_TOUCH_MAJOR/ABS_MT_TOUCH_MINOR``` axes and/or
|
||||||
|
the ```ABS_MT_WIDTH_MAJOR/ABS_MT_WIDTH_MINOR``` axes. While the kernel
|
||||||
|
documentation specifies how these axes are supposed to be mapped, few
|
||||||
|
devices forward
|
||||||
|
reliable information.
|
||||||
|
|
||||||
|
@section touchpad_pressure_hwdb Debugging touchpad pressure ranges
|
||||||
|
|
||||||
|
This section describes how to determine the touchpad pressure ranges
|
||||||
|
required for a touchpad device and how to add the required hwdb entry
|
||||||
|
locally. Note that the hwdb entry is **not public API** and **may change at
|
||||||
|
any time**. Users are advised to @ref reporting_bugs "report a bug" with the
|
||||||
|
updated pressure ranges when testing has completed.
|
||||||
|
|
||||||
|
First, install the "evemu" package providing the ```evemu-record``` tool.
|
||||||
|
Run ```evemu-record``` as root (without arguments) to see a list of devices
|
||||||
|
and select the touchpad device. Pipe the actual output of the tool into a
|
||||||
|
file for later analysis. For example:
|
||||||
|
|
||||||
|
<pre>
|
||||||
|
$ sudo evemu-record > touchpad-pressure.txt
|
||||||
|
Available devices:
|
||||||
|
/dev/input/event0: Lid Switch
|
||||||
|
/dev/input/event1: Sleep Button
|
||||||
|
/dev/input/event2: Power Button
|
||||||
|
/dev/input/event3: AT Translated Set 2 keyboard
|
||||||
|
/dev/input/event4: SynPS/2 Synaptics TouchPad
|
||||||
|
/dev/input/event5: ELAN Touchscreen
|
||||||
|
[...]
|
||||||
|
Select the device event number [0-19]: 4
|
||||||
|
# Ctrl+C to quit, the output will be in touchpad-pressure.txt
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
Now move a finger at **normal pressure** several times around the touchpad,
|
||||||
|
as if moving the cursor normally around the screen. Avoid any accidental
|
||||||
|
palm touches or any excessive or light pressure.
|
||||||
|
|
||||||
|
The event recording is then filtered for pressure information, which is
|
||||||
|
sorted and exported to a new file:
|
||||||
|
<pre>
|
||||||
|
$ grep --only-matching "ABS_MT_PRESSURE[ ]*[0-9]*" touchpad-pressure.txt | \
|
||||||
|
sed -e "s/ABS_MT_PRESSURE[ ]*//" | \
|
||||||
|
sort -n | uniq -c > touchpad-pressure-statistics.txt
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
The file contains a list of (count, pressure-value) tuples which can be
|
||||||
|
visualized with gnuplot. Copy the following into a file named
|
||||||
|
```touchpad-pressure-statistics.gnuplot```:
|
||||||
|
|
||||||
|
<pre>
|
||||||
|
set style data lines
|
||||||
|
plot 'touchpad-pressure-statistics.txt' using 2:1
|
||||||
|
pause -1
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
Now, you can visualize the touchpad pressure curve with the following
|
||||||
|
command:
|
||||||
|
<pre>
|
||||||
|
$ gnuplot touchpad-pressure-statistics.gnuplot
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
The visualization will show a curve with the various pressure ranges, see
|
||||||
|
[this bugzilla attachment](https://bugs.freedesktop.org/attachment.cgi?id=130659).
|
||||||
|
In most cases, the thresholds can be guessed based on this curve. libinput
|
||||||
|
employes a [Schmitt trigger](https://en.wikipedia.org/wiki/Schmitt_trigger)
|
||||||
|
with an upper threshold and a lower threshold. A touch is detected when the
|
||||||
|
pressure goes above the high threshold, a release is detected when the
|
||||||
|
pressure fallse below the low threshold. Thus, an ideal threshold
|
||||||
|
combination is with a high threshold slightly above the minimum threshold, a
|
||||||
|
low threshold on the minimum threshold.
|
||||||
|
|
||||||
|
Once the thresholds are decided on (e.g. 10 and 8), they can be enabled with
|
||||||
|
the following hwdb file:
|
||||||
|
|
||||||
|
<pre>
|
||||||
|
$> cat /etc/udev/hwdb.d/99-touchpad-pressure.hwdb
|
||||||
|
libinput:name:*SynPS/2 Synaptics TouchPad:dmi:*svnHewlett-Packard:*pnHPCompaq6910p*
|
||||||
|
LIBINPUT_ATTR_PRESSURE_RANGE=10:8
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
The first line is the match line and should be adjusted for the device name
|
||||||
|
(see evemu-record's output) and for the local system, based on the
|
||||||
|
information in ```/sys/class/dmi/id/modalias```. The modalias should be
|
||||||
|
shortened to the specific system's information, usually system vendor (svn)
|
||||||
|
and product name (pn).
|
||||||
|
|
||||||
|
Once in place, you need to run the following to commands, adjusted for your
|
||||||
|
device's event node (see @ref faq_hwdb_changes):
|
||||||
|
<pre>
|
||||||
|
sudo udevadm hwdb --update
|
||||||
|
sudo udevadm test /sys/class/input/eventX
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
If the pressure range property shows up correctly, restart X or the
|
||||||
|
Wayland compositor and libinput should now use the correct pressure
|
||||||
|
thresholds. The @ref developer_tools can be used to verify the correct
|
||||||
|
functionality first without the need for a restart.
|
||||||
|
|
||||||
|
Once the pressure ranges are deemed correct,
|
||||||
|
@ref reporting_bugs "report a bug" to get the pressure ranges into the
|
||||||
|
repository.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
@ -811,6 +811,9 @@ tp_unhover_pressure(struct tp_dispatch *tp, uint64_t time)
|
||||||
for (i = 0; i < (int)tp->num_slots; i++) {
|
for (i = 0; i < (int)tp->num_slots; i++) {
|
||||||
t = tp_get_touch(tp, i);
|
t = tp_get_touch(tp, i);
|
||||||
|
|
||||||
|
if (t->state == TOUCH_NONE)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (t->dirty) {
|
if (t->dirty) {
|
||||||
if (t->state == TOUCH_HOVERING) {
|
if (t->state == TOUCH_HOVERING) {
|
||||||
if (t->pressure >= tp->pressure.high) {
|
if (t->pressure >= tp->pressure.high) {
|
||||||
|
|
@ -2364,8 +2367,9 @@ tp_init_pressure(struct tp_dispatch *tp,
|
||||||
struct evdev_device *device)
|
struct evdev_device *device)
|
||||||
{
|
{
|
||||||
const struct input_absinfo *abs;
|
const struct input_absinfo *abs;
|
||||||
unsigned int range;
|
|
||||||
unsigned int code = ABS_PRESSURE;
|
unsigned int code = ABS_PRESSURE;
|
||||||
|
const char *prop;
|
||||||
|
int hi, lo;
|
||||||
|
|
||||||
if (tp->has_mt)
|
if (tp->has_mt)
|
||||||
code = ABS_MT_PRESSURE;
|
code = ABS_MT_PRESSURE;
|
||||||
|
|
@ -2375,25 +2379,44 @@ tp_init_pressure(struct tp_dispatch *tp,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
tp->pressure.use_pressure = true;
|
|
||||||
|
|
||||||
abs = libevdev_get_abs_info(device->evdev, code);
|
abs = libevdev_get_abs_info(device->evdev, code);
|
||||||
assert(abs);
|
assert(abs);
|
||||||
|
|
||||||
range = abs->maximum - abs->minimum;
|
prop = udev_device_get_property_value(device->udev_device,
|
||||||
|
"LIBINPUT_ATTR_PRESSURE_RANGE");
|
||||||
if (device->model_flags & EVDEV_MODEL_ELANTECH_TOUCHPAD) {
|
if (prop) {
|
||||||
tp->pressure.high = 24;
|
if (!parse_pressure_range_property(prop, &hi, &lo)) {
|
||||||
tp->pressure.low = 10;
|
evdev_log_bug_client(device,
|
||||||
} else if (device->model_flags & EVDEV_MODEL_CYAPA) {
|
"discarding invalid pressure range '%s'\n",
|
||||||
tp->pressure.high = 10;
|
prop);
|
||||||
tp->pressure.low = 8;
|
return;
|
||||||
} else {
|
|
||||||
/* Approximately the synaptics defaults */
|
|
||||||
tp->pressure.high = abs->minimum + 0.12 * range;
|
|
||||||
tp->pressure.low = abs->minimum + 0.10 * range;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hi == 0 && lo == 0) {
|
||||||
|
evdev_log_info(device,
|
||||||
|
"pressure-based touch detection disabled\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
unsigned int range = abs->maximum - abs->minimum;
|
||||||
|
|
||||||
|
/* Approximately the synaptics defaults */
|
||||||
|
hi = abs->minimum + 0.12 * range;
|
||||||
|
lo = abs->minimum + 0.10 * range;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hi > abs->maximum || hi < abs->minimum ||
|
||||||
|
lo > abs->maximum || lo < abs->minimum) {
|
||||||
|
evdev_log_bug_libinput(device,
|
||||||
|
"discarding out-of-bounds pressure range %d:%d\n",
|
||||||
|
hi, lo);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
tp->pressure.use_pressure = true;
|
||||||
|
tp->pressure.high = hi;
|
||||||
|
tp->pressure.low = lo;
|
||||||
|
|
||||||
evdev_log_debug(device,
|
evdev_log_debug(device,
|
||||||
"using pressure-based touch detection\n");
|
"using pressure-based touch detection\n");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2245,7 +2245,6 @@ evdev_read_model_flags(struct evdev_device *device)
|
||||||
MODEL(ALPS_TOUCHPAD),
|
MODEL(ALPS_TOUCHPAD),
|
||||||
MODEL(SYNAPTICS_SERIAL_TOUCHPAD),
|
MODEL(SYNAPTICS_SERIAL_TOUCHPAD),
|
||||||
MODEL(JUMPING_SEMI_MT),
|
MODEL(JUMPING_SEMI_MT),
|
||||||
MODEL(ELANTECH_TOUCHPAD),
|
|
||||||
MODEL(APPLE_INTERNAL_KEYBOARD),
|
MODEL(APPLE_INTERNAL_KEYBOARD),
|
||||||
MODEL(CYBORG_RAT),
|
MODEL(CYBORG_RAT),
|
||||||
MODEL(CYAPA),
|
MODEL(CYAPA),
|
||||||
|
|
@ -2617,7 +2616,7 @@ evdev_configure_device(struct evdev_device *device)
|
||||||
|
|
||||||
if (udev_tags & EVDEV_UDEV_TAG_TOUCHPAD) {
|
if (udev_tags & EVDEV_UDEV_TAG_TOUCHPAD) {
|
||||||
dispatch = evdev_mt_touchpad_create(device);
|
dispatch = evdev_mt_touchpad_create(device);
|
||||||
evdev_log_info(device, "device is a atouchpad\n");
|
evdev_log_info(device, "device is a touchpad\n");
|
||||||
return dispatch;
|
return dispatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,6 @@ enum evdev_device_model {
|
||||||
EVDEV_MODEL_ALPS_TOUCHPAD = (1 << 8),
|
EVDEV_MODEL_ALPS_TOUCHPAD = (1 << 8),
|
||||||
EVDEV_MODEL_SYNAPTICS_SERIAL_TOUCHPAD = (1 << 9),
|
EVDEV_MODEL_SYNAPTICS_SERIAL_TOUCHPAD = (1 << 9),
|
||||||
EVDEV_MODEL_JUMPING_SEMI_MT = (1 << 10),
|
EVDEV_MODEL_JUMPING_SEMI_MT = (1 << 10),
|
||||||
EVDEV_MODEL_ELANTECH_TOUCHPAD = (1 << 11),
|
|
||||||
EVDEV_MODEL_LENOVO_X220_TOUCHPAD_FW81 = (1 << 12),
|
EVDEV_MODEL_LENOVO_X220_TOUCHPAD_FW81 = (1 << 12),
|
||||||
EVDEV_MODEL_APPLE_INTERNAL_KEYBOARD = (1 << 13),
|
EVDEV_MODEL_APPLE_INTERNAL_KEYBOARD = (1 << 13),
|
||||||
EVDEV_MODEL_CYBORG_RAT = (1 << 14),
|
EVDEV_MODEL_CYBORG_RAT = (1 << 14),
|
||||||
|
|
|
||||||
|
|
@ -359,6 +359,42 @@ parse_tpkbcombo_layout_poperty(const char *prop,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parses a string of the format "a:b" where both a and b must be integer
|
||||||
|
* numbers and a > b. Also allowed is the special string vaule "none" which
|
||||||
|
* amounts to unsetting the property.
|
||||||
|
*
|
||||||
|
* @param prop The value of the property
|
||||||
|
* @param hi Set to the first digit or 0 in case of 'none'
|
||||||
|
* @param lo Set to the second digit or 0 in case of 'none'
|
||||||
|
* @return true on success, false otherwise
|
||||||
|
*/
|
||||||
|
bool
|
||||||
|
parse_pressure_range_property(const char *prop, int *hi, int *lo)
|
||||||
|
{
|
||||||
|
int first, second;
|
||||||
|
|
||||||
|
if (!prop)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (streq(prop, "none")) {
|
||||||
|
*hi = 0;
|
||||||
|
*lo = 0;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sscanf(prop, "%d:%d", &first, &second) != 2)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (second >= first)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
*hi = first;
|
||||||
|
*lo = second;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the next word in a string pointed to by state before the first
|
* Return the next word in a string pointed to by state before the first
|
||||||
* separator character. Call repeatedly to tokenize a whole string.
|
* separator character. Call repeatedly to tokenize a whole string.
|
||||||
|
|
|
||||||
|
|
@ -378,6 +378,7 @@ int parse_mouse_wheel_click_count_property(const char *prop);
|
||||||
double parse_trackpoint_accel_property(const char *prop);
|
double parse_trackpoint_accel_property(const char *prop);
|
||||||
bool parse_dimension_property(const char *prop, size_t *width, size_t *height);
|
bool parse_dimension_property(const char *prop, size_t *width, size_t *height);
|
||||||
bool parse_calibration_property(const char *prop, float calibration[6]);
|
bool parse_calibration_property(const char *prop, float calibration[6]);
|
||||||
|
bool parse_pressure_range_property(const char *prop, int *hi, int *lo);
|
||||||
|
|
||||||
enum tpkbcombo_layout {
|
enum tpkbcombo_layout {
|
||||||
TPKBCOMBO_LAYOUT_UNKNOWN,
|
TPKBCOMBO_LAYOUT_UNKNOWN,
|
||||||
|
|
|
||||||
|
|
@ -3491,6 +3491,14 @@ libinput_device_get_id_vendor(struct libinput_device *device);
|
||||||
* beyond the boundaries of this output. An absolute device has its input
|
* beyond the boundaries of this output. An absolute device has its input
|
||||||
* coordinates mapped to the extents of this output.
|
* coordinates mapped to the extents of this output.
|
||||||
*
|
*
|
||||||
|
* @note <b>Use of this function is discouraged.</b> Its return value is not
|
||||||
|
* precisely defined and may not be understood by the caller or may be
|
||||||
|
* insufficient to map the device. Instead, the system configuration could
|
||||||
|
* set a udev property the caller understands and interprets correctly. The
|
||||||
|
* caller could then obtain device with libinput_device_get_udev_device()
|
||||||
|
* and query it for this property. For more complex cases, the caller
|
||||||
|
* must implement monitor-to-device association heuristics.
|
||||||
|
*
|
||||||
* @return The name of the output this device is mapped to, or NULL if no
|
* @return The name of the output this device is mapped to, or NULL if no
|
||||||
* output is set
|
* output is set
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -88,6 +88,24 @@ static struct input_absinfo absinfo[] = {
|
||||||
{ .value = -1 }
|
{ .value = -1 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Force MOUSE_DPI to the empty string. As of systemd commit f013e99e160f
|
||||||
|
* ID_BUS=bluetooth now triggers the hwdb entry for this device. This causes
|
||||||
|
* test case failures because deltas change. Detecting old vs new systemd is
|
||||||
|
* hard, and because our rules are 99-prefixed we can't set ID_BUS ourselves
|
||||||
|
* on older systemd.
|
||||||
|
* So let's go the easy way and unset MOUSE_DPI so we can continue to use
|
||||||
|
* the current tests.
|
||||||
|
*/
|
||||||
|
static const char udev_rule[] =
|
||||||
|
"ACTION==\"remove\", GOTO=\"mouse_end\"\n"
|
||||||
|
"KERNEL!=\"event*\", GOTO=\"mouse_end\"\n"
|
||||||
|
"ENV{ID_INPUT_MOUSE}==\"\", GOTO=\"mouse_end\"\n"
|
||||||
|
"\n"
|
||||||
|
"ATTRS{name}==\"litest Apple Magic Mouse\","
|
||||||
|
" ENV{MOUSE_DPI}=\"\""
|
||||||
|
"\n"
|
||||||
|
"LABEL=\"mouse_end\"";
|
||||||
|
|
||||||
struct litest_test_device litest_magicmouse_device = {
|
struct litest_test_device litest_magicmouse_device = {
|
||||||
.type = LITEST_MAGICMOUSE,
|
.type = LITEST_MAGICMOUSE,
|
||||||
.features = LITEST_RELATIVE | LITEST_BUTTON | LITEST_WHEEL,
|
.features = LITEST_RELATIVE | LITEST_BUTTON | LITEST_WHEEL,
|
||||||
|
|
@ -99,4 +117,5 @@ struct litest_test_device litest_magicmouse_device = {
|
||||||
.id = &input_id,
|
.id = &input_id,
|
||||||
.events = events,
|
.events = events,
|
||||||
.absinfo = absinfo,
|
.absinfo = absinfo,
|
||||||
|
.udev_rule = udev_rule,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1001,6 +1001,48 @@ START_TEST(calibration_prop_parser)
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
struct parser_test_pressure_range {
|
||||||
|
char *tag;
|
||||||
|
bool success;
|
||||||
|
int hi, lo;
|
||||||
|
};
|
||||||
|
|
||||||
|
START_TEST(pressure_range_prop_parser)
|
||||||
|
{
|
||||||
|
struct parser_test_pressure_range tests[] = {
|
||||||
|
{ "10:8", true, 10, 8 },
|
||||||
|
{ "100:-1", true, 100, -1 },
|
||||||
|
{ "-203813:-502023", true, -203813, -502023 },
|
||||||
|
{ "238492:28210", true, 238492, 28210 },
|
||||||
|
{ "none", true, 0, 0 },
|
||||||
|
{ "0:0", false, 0, 0 },
|
||||||
|
{ "", false, 0, 0 },
|
||||||
|
{ "abcd", false, 0, 0 },
|
||||||
|
{ "10:30:10", false, 0, 0 },
|
||||||
|
{ NULL, false, 0, 0 }
|
||||||
|
};
|
||||||
|
int i;
|
||||||
|
int hi, lo;
|
||||||
|
bool success;
|
||||||
|
|
||||||
|
for (i = 0; tests[i].tag != NULL; i++) {
|
||||||
|
hi = lo = 0xad;
|
||||||
|
success = parse_pressure_range_property(tests[i].tag, &hi, &lo);
|
||||||
|
ck_assert(success == tests[i].success);
|
||||||
|
if (success) {
|
||||||
|
ck_assert_int_eq(hi, tests[i].hi);
|
||||||
|
ck_assert_int_eq(lo, tests[i].lo);
|
||||||
|
} else {
|
||||||
|
ck_assert_int_eq(hi, 0xad);
|
||||||
|
ck_assert_int_eq(lo, 0xad);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
success = parse_pressure_range_property(NULL, NULL, NULL);
|
||||||
|
ck_assert(success == false);
|
||||||
|
}
|
||||||
|
END_TEST
|
||||||
|
|
||||||
START_TEST(time_conversion)
|
START_TEST(time_conversion)
|
||||||
{
|
{
|
||||||
ck_assert_int_eq(us(10), 10);
|
ck_assert_int_eq(us(10), 10);
|
||||||
|
|
@ -1275,6 +1317,7 @@ litest_setup_tests_misc(void)
|
||||||
litest_add_no_device("misc:parser", dimension_prop_parser);
|
litest_add_no_device("misc:parser", dimension_prop_parser);
|
||||||
litest_add_no_device("misc:parser", reliability_prop_parser);
|
litest_add_no_device("misc:parser", reliability_prop_parser);
|
||||||
litest_add_no_device("misc:parser", calibration_prop_parser);
|
litest_add_no_device("misc:parser", calibration_prop_parser);
|
||||||
|
litest_add_no_device("misc:parser", pressure_range_prop_parser);
|
||||||
litest_add_no_device("misc:parser", safe_atoi_test);
|
litest_add_no_device("misc:parser", safe_atoi_test);
|
||||||
litest_add_no_device("misc:parser", safe_atod_test);
|
litest_add_no_device("misc:parser", safe_atod_test);
|
||||||
litest_add_no_device("misc:parser", strsplit_test);
|
litest_add_no_device("misc:parser", strsplit_test);
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
.SH NAME
|
.SH NAME
|
||||||
libinput-debug-events \- debug helper for libinput
|
libinput-debug-events \- debug helper for libinput
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.B libinput-debug-events [--help]
|
.B libinput-debug-events [--help] [--show-keycodes]
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.PP
|
.PP
|
||||||
The
|
The
|
||||||
|
|
@ -18,6 +18,12 @@ This tool usually needs to be run as root to have access to the
|
||||||
.TP 8
|
.TP 8
|
||||||
.B --help
|
.B --help
|
||||||
Print help
|
Print help
|
||||||
|
.TP 8
|
||||||
|
.B --show-keycodes
|
||||||
|
Key events shown by this tool are partially obfuscated to avoid passwords
|
||||||
|
and other sensitive information showing up in the output. Use the
|
||||||
|
.B --show-keycodes
|
||||||
|
argument to make all keycodes visible.
|
||||||
.PP
|
.PP
|
||||||
For all other options, see the output from --help. Options may be added or
|
For all other options, see the output from --help. Options may be added or
|
||||||
removed at any time.
|
removed at any time.
|
||||||
|
|
@ -25,7 +31,3 @@ removed at any time.
|
||||||
.PP
|
.PP
|
||||||
Events shown by this tool may not correspond to the events seen by a
|
Events shown by this tool may not correspond to the events seen by a
|
||||||
different user of libinput. This tool initializes a separate context.
|
different user of libinput. This tool initializes a separate context.
|
||||||
.PP
|
|
||||||
Events shown by this tool include key codes in plain text. Anything you type
|
|
||||||
while this tool is running will show up in the output, including your
|
|
||||||
passwords.
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ libinput-list-devices \- list local devices as recognized by libinput
|
||||||
The
|
The
|
||||||
.I libinput-list-devices
|
.I libinput-list-devices
|
||||||
tool creates a libinput context on the default seat "seat0" and lists all
|
tool creates a libinput context on the default seat "seat0" and lists all
|
||||||
devices regonized by libinput. Each device shows available configurations
|
devices recognized by libinput. Each device shows available configurations
|
||||||
the respective default configuration setting.
|
the respective default configuration setting.
|
||||||
.PP
|
.PP
|
||||||
For configuration options that allow multiple different settings (e.g.
|
For configuration options that allow multiple different settings (e.g.
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,10 @@ libinput:name:* Touchpad:dmi:*svnDellInc.:*
|
||||||
##########################################
|
##########################################
|
||||||
libinput:name:*ETPS/2 Elantech Touchpad*:dmi:*
|
libinput:name:*ETPS/2 Elantech Touchpad*:dmi:*
|
||||||
LIBINPUT_ATTR_RESOLUTION_HINT=31x31
|
LIBINPUT_ATTR_RESOLUTION_HINT=31x31
|
||||||
LIBINPUT_MODEL_ELANTECH_TOUCHPAD=1
|
LIBINPUT_ATTR_PRESSURE_RANGE=10:8
|
||||||
|
|
||||||
|
libinput:name:*ETPS/2 Elantech Touchpad*:dmi:*svnASUSTeKComputerInc.:pnUX21E:*
|
||||||
|
LIBINPUT_ATTR_PRESSURE_RANGE=24:10
|
||||||
|
|
||||||
##########################################
|
##########################################
|
||||||
# Google
|
# Google
|
||||||
|
|
@ -111,6 +114,7 @@ libinput:name:Atmel maXTouch Touchpad:dmi:*svn*GOOGLE*:pn*Samus*
|
||||||
|
|
||||||
libinput:name:Cypress APA Trackpad ?cyapa?:dmi:*
|
libinput:name:Cypress APA Trackpad ?cyapa?:dmi:*
|
||||||
LIBINPUT_MODEL_CYAPA=1
|
LIBINPUT_MODEL_CYAPA=1
|
||||||
|
LIBINPUT_ATTR_PRESSURE_RANGE=10:8
|
||||||
|
|
||||||
##########################################
|
##########################################
|
||||||
# HP
|
# HP
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,13 @@ def property_grammar():
|
||||||
Suppress('=') -
|
Suppress('=') -
|
||||||
tpkbcombo_tags('VALUE')]
|
tpkbcombo_tags('VALUE')]
|
||||||
|
|
||||||
grammar = Or(model_props + size_props + reliability + tpkbcombo)
|
pressure_range = INTEGER('X') + Suppress(':') + INTEGER('Y')
|
||||||
|
pressure_prop = [ Literal('LIBINPUT_ATTR_PRESSURE_RANGE')('NAME') -
|
||||||
|
Suppress('=') -
|
||||||
|
Group(pressure_range('SETTINGS*')) ]
|
||||||
|
|
||||||
|
grammar = Or(model_props + size_props + reliability + tpkbcombo +
|
||||||
|
pressure_prop)
|
||||||
|
|
||||||
return grammar
|
return grammar
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue