mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-03-23 13:10:40 +01:00
Compare commits
18 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f8032ba715 | ||
|
|
fb4c3c6c6c | ||
|
|
9c2c1db948 | ||
|
|
67591fcf00 | ||
|
|
29375e543f | ||
|
|
584d3cb0b9 | ||
|
|
259adb7178 | ||
|
|
f9f9bc5927 | ||
|
|
86d81a0ac7 | ||
|
|
0e7a92b4c1 | ||
|
|
5b500c0e74 | ||
|
|
7658efbd71 | ||
|
|
c2fa055fa3 | ||
|
|
ce1c4c5008 | ||
|
|
aec607ecb4 | ||
|
|
560ba890b3 | ||
|
|
f7a6f751dd | ||
|
|
2189fd2c2e |
22 changed files with 236 additions and 60 deletions
|
|
@ -137,7 +137,7 @@ check-ci-script:
|
||||||
image: golang:alpine
|
image: golang:alpine
|
||||||
stage: prep
|
stage: prep
|
||||||
before_script:
|
before_script:
|
||||||
- apk add python3 git
|
- apk add python3 py-pip git
|
||||||
- pip3 install --user jinja2
|
- pip3 install --user jinja2
|
||||||
script:
|
script:
|
||||||
- python3 ./.gitlab-ci/generate-gitlab-ci.py
|
- python3 ./.gitlab-ci/generate-gitlab-ci.py
|
||||||
|
|
@ -153,7 +153,7 @@ check-commit:
|
||||||
image: golang:alpine
|
image: golang:alpine
|
||||||
stage: prep
|
stage: prep
|
||||||
before_script:
|
before_script:
|
||||||
- apk add python3 git
|
- apk add python3 py-pip git
|
||||||
script:
|
script:
|
||||||
- pip3 install GitPython
|
- pip3 install GitPython
|
||||||
- pip3 install pytest
|
- pip3 install pytest
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,7 @@ check-ci-script:
|
||||||
image: golang:alpine
|
image: golang:alpine
|
||||||
stage: prep
|
stage: prep
|
||||||
before_script:
|
before_script:
|
||||||
- apk add python3 git
|
- apk add python3 py-pip git
|
||||||
- pip3 install --user jinja2
|
- pip3 install --user jinja2
|
||||||
script:
|
script:
|
||||||
- python3 ./.gitlab-ci/generate-gitlab-ci.py
|
- python3 ./.gitlab-ci/generate-gitlab-ci.py
|
||||||
|
|
@ -143,7 +143,7 @@ check-commit:
|
||||||
image: golang:alpine
|
image: golang:alpine
|
||||||
stage: prep
|
stage: prep
|
||||||
before_script:
|
before_script:
|
||||||
- apk add python3 git
|
- apk add python3 py-pip git
|
||||||
script:
|
script:
|
||||||
- pip3 install GitPython
|
- pip3 install GitPython
|
||||||
- pip3 install pytest
|
- pip3 install pytest
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ MAX_INITIALIZER_LINES = 0
|
||||||
WARNINGS = YES
|
WARNINGS = YES
|
||||||
QUIET = YES
|
QUIET = YES
|
||||||
INPUT = "@builddir@"
|
INPUT = "@builddir@"
|
||||||
FILTER_PATTERNS = *.h *.dox
|
|
||||||
IMAGE_PATH = "@builddir@"
|
IMAGE_PATH = "@builddir@"
|
||||||
GENERATE_HTML = YES
|
GENERATE_HTML = YES
|
||||||
HTML_OUTPUT = api
|
HTML_OUTPUT = api
|
||||||
|
|
|
||||||
|
|
@ -14,10 +14,13 @@ position.
|
||||||
When libinput detects a cursor jump it prints a bug warning to the log with
|
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.
|
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
|
.. note:: This warning is ratelimited and will stop appearing after a few
|
||||||
that the touch point moves from its previous position. The pointer jump can
|
times, even if the touchpad jumps continue.
|
||||||
usually be seen in the :ref:`libinput record <libinput-record>` output for the device:
|
|
||||||
|
|
||||||
|
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
|
In this recording, the pointer jumps from its position 3752/2216 to
|
||||||
1640/4681 within a single frame. On this particular touchpad, this would
|
1640/4681 within a single frame. On this particular touchpad, this would
|
||||||
represent a physical move of almost 50mm. libinput detects some of these
|
represent a physical move of almost 50mm. libinput detects some of these
|
||||||
jumps and discards the movement but otherwise continues as usual. However,
|
jumps and discards the movement but otherwise continues as usual.
|
||||||
the bug should be fixed at the kernel level.
|
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
|
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.
|
your touchpad with :ref:`libinput record <libinput-record>` and file a bug.
|
||||||
See :ref:`reporting_bugs` for more details.
|
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.
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
project('libinput', 'c',
|
project('libinput', 'c',
|
||||||
version : '1.15.3',
|
version : '1.15.6',
|
||||||
license : 'MIT/Expat',
|
license : 'MIT/Expat',
|
||||||
default_options : [ 'c_std=gnu99', 'warning_level=2' ],
|
default_options : [ 'c_std=gnu99', 'warning_level=2' ],
|
||||||
meson_version : '>= 0.41.0')
|
meson_version : '>= 0.41.0')
|
||||||
|
|
@ -322,6 +322,7 @@ quirks_data = [
|
||||||
'quirks/30-vendor-microsoft.quirks',
|
'quirks/30-vendor-microsoft.quirks',
|
||||||
'quirks/30-vendor-razer.quirks',
|
'quirks/30-vendor-razer.quirks',
|
||||||
'quirks/30-vendor-synaptics.quirks',
|
'quirks/30-vendor-synaptics.quirks',
|
||||||
|
'quirks/30-vendor-trust.quirks',
|
||||||
'quirks/30-vendor-vmware.quirks',
|
'quirks/30-vendor-vmware.quirks',
|
||||||
'quirks/30-vendor-wacom.quirks',
|
'quirks/30-vendor-wacom.quirks',
|
||||||
'quirks/50-system-acer.quirks',
|
'quirks/50-system-acer.quirks',
|
||||||
|
|
@ -333,6 +334,7 @@ quirks_data = [
|
||||||
'quirks/50-system-google.quirks',
|
'quirks/50-system-google.quirks',
|
||||||
'quirks/50-system-hp.quirks',
|
'quirks/50-system-hp.quirks',
|
||||||
'quirks/50-system-lenovo.quirks',
|
'quirks/50-system-lenovo.quirks',
|
||||||
|
'quirks/50-system-sony.quirks',
|
||||||
'quirks/50-system-system76.quirks',
|
'quirks/50-system-system76.quirks',
|
||||||
'quirks/50-system-toshiba.quirks',
|
'quirks/50-system-toshiba.quirks',
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -5,3 +5,10 @@ MatchUdevType=tablet
|
||||||
MatchBus=usb
|
MatchBus=usb
|
||||||
MatchVendor=0x08CA
|
MatchVendor=0x08CA
|
||||||
AttrEventCodeDisable=ABS_TILT_X;ABS_TILT_Y;
|
AttrEventCodeDisable=ABS_TILT_X;ABS_TILT_Y;
|
||||||
|
|
||||||
|
[Aiptek 8000U pressure threshold]
|
||||||
|
MatchUdevType=tablet
|
||||||
|
MatchBus=usb
|
||||||
|
MatchVendor=0x08CA
|
||||||
|
MatchProduct=0x0010
|
||||||
|
AttrPressureRange=70:50
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,13 @@ MatchVendor=0x1532
|
||||||
MatchProduct=0x0220
|
MatchProduct=0x0220
|
||||||
AttrKeyboardIntegration=internal
|
AttrKeyboardIntegration=internal
|
||||||
|
|
||||||
|
[Razer Blade Keyboard]
|
||||||
|
MatchUdevType=keyboard
|
||||||
|
MatchBus=usb
|
||||||
|
MatchVendor=0x1532
|
||||||
|
MatchProduct=0x0233
|
||||||
|
AttrKeyboardIntegration=internal
|
||||||
|
|
||||||
[Razer Blade Lid Switch]
|
[Razer Blade Lid Switch]
|
||||||
MatchName=*Lid Switch*
|
MatchName=*Lid Switch*
|
||||||
MatchDMIModalias=dmi:*svnRazer:pnBlade*
|
MatchDMIModalias=dmi:*svnRazer:pnBlade*
|
||||||
|
|
|
||||||
6
quirks/30-vendor-trust.quirks
Normal file
6
quirks/30-vendor-trust.quirks
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
[Trust GXT 25 Gaming Mouse]
|
||||||
|
MatchUdevType=mouse
|
||||||
|
MatchBus=usb
|
||||||
|
MatchVendor=0x1D57
|
||||||
|
MatchProduct=0xAD03
|
||||||
|
ModelBouncingKeys=1
|
||||||
|
|
@ -37,6 +37,9 @@ MatchVendor=0x05AC
|
||||||
MatchProduct=0x030D
|
MatchProduct=0x030D
|
||||||
AttrEventCodeDisable=EV_ABS
|
AttrEventCodeDisable=EV_ABS
|
||||||
|
|
||||||
|
# The External Apple "Magic" trackpads, both the 1st and 2nd generations, have
|
||||||
|
# pretty good built-in spurious touch filtering in the device firmware. Using
|
||||||
|
# low enough values such as 20:10 effectively disables libinput's filtering.
|
||||||
[Apple Magic Trackpad v1 (2010, clickpad)]
|
[Apple Magic Trackpad v1 (2010, clickpad)]
|
||||||
MatchUdevType=touchpad
|
MatchUdevType=touchpad
|
||||||
MatchBus=bluetooth
|
MatchBus=bluetooth
|
||||||
|
|
@ -47,6 +50,23 @@ AttrTouchSizeRange=20:10
|
||||||
AttrPalmSizeThreshold=900
|
AttrPalmSizeThreshold=900
|
||||||
AttrThumbSizeThreshold=700
|
AttrThumbSizeThreshold=700
|
||||||
|
|
||||||
|
# 2nd generation trackpad can be connected over Bluetooth as well as USB.
|
||||||
|
[Apple Magic Trackpad v2 (2015)]
|
||||||
|
MatchVendor=0x05AC
|
||||||
|
MatchProduct=0x0265
|
||||||
|
AttrSizeHint=162x115
|
||||||
|
AttrTouchSizeRange=20:10
|
||||||
|
AttrPalmSizeThreshold=900
|
||||||
|
AttrThumbSizeThreshold=700
|
||||||
|
|
||||||
|
[Apple Magic Trackpad v2 (new vendor ID)]
|
||||||
|
MatchVendor=0x004C
|
||||||
|
MatchProduct=0x0265
|
||||||
|
AttrSizeHint=162x115
|
||||||
|
AttrTouchSizeRange=20:10
|
||||||
|
AttrPalmSizeThreshold=900
|
||||||
|
AttrThumbSizeThreshold=700
|
||||||
|
|
||||||
[Apple Touchpad OneButton]
|
[Apple Touchpad OneButton]
|
||||||
MatchUdevType=touchpad
|
MatchUdevType=touchpad
|
||||||
MatchBus=usb
|
MatchBus=usb
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,16 @@ MatchName=SYN1EDE:00 06CB:7442
|
||||||
MatchDMIModalias=dmi:*svnHewlett-Packard:pnHPStreamNotebookPC11*
|
MatchDMIModalias=dmi:*svnHewlett-Packard:pnHPStreamNotebookPC11*
|
||||||
ModelHPStream11Touchpad=1
|
ModelHPStream11Touchpad=1
|
||||||
|
|
||||||
|
# The HP stream x360's embedded-controller filters out events form its builtin
|
||||||
|
# keyboard when in tablet-mode itself; and it has a capacitive home-button
|
||||||
|
# (windows logo) underneath its display which also sends PS/2 key-events.
|
||||||
|
# Do not suspend the keyboard when in tablet-mode so that the home button
|
||||||
|
# keeps working when in tablet-mode.
|
||||||
|
[HP Stream x360 11]
|
||||||
|
MatchName=AT Translated Set 2 keyboard
|
||||||
|
MatchDMIModalias=dmi:*:svnHewlett-Packard:pnHPStreamx360ConvertiblePC11:*
|
||||||
|
ModelTabletModeNoSuspend=1
|
||||||
|
|
||||||
[HP ZBook Studio G3]
|
[HP ZBook Studio G3]
|
||||||
MatchName=AlpsPS/2 ALPS GlidePoint
|
MatchName=AlpsPS/2 ALPS GlidePoint
|
||||||
MatchDMIModalias=dmi:*svnHP:pnHPZBookStudioG3:*
|
MatchDMIModalias=dmi:*svnHP:pnHPZBookStudioG3:*
|
||||||
|
|
|
||||||
|
|
@ -169,6 +169,11 @@ MatchName=AT Translated Set 2 keyboard
|
||||||
MatchDMIModalias=dmi:*svnLENOVO:*pvrThinkPadX200Tablet:*
|
MatchDMIModalias=dmi:*svnLENOVO:*pvrThinkPadX200Tablet:*
|
||||||
ModelTabletModeNoSuspend=1
|
ModelTabletModeNoSuspend=1
|
||||||
|
|
||||||
|
[Lenovo X201 Tablet]
|
||||||
|
MatchName=At Translated Set 2 keyboard
|
||||||
|
MatchDMIModalias=dmi:*svnLENOVO:*pvrThinkPadX201Tablet:*
|
||||||
|
ModelTabletModeNoSuspend=1
|
||||||
|
|
||||||
# Lenovo MIIX 720 comes with a detachable keyboard. We must not disable
|
# Lenovo MIIX 720 comes with a detachable keyboard. We must not disable
|
||||||
# the keyboard because some keys are still accessible on the screen and
|
# the keyboard because some keys are still accessible on the screen and
|
||||||
# volume rocker. See
|
# volume rocker. See
|
||||||
|
|
|
||||||
8
quirks/50-system-sony.quirks
Normal file
8
quirks/50-system-sony.quirks
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
# Do not edit this file, it will be overwritten on update
|
||||||
|
|
||||||
|
[Sony Vaio VPCEG Series Touchpad Pressure Override]
|
||||||
|
MatchUdevType=touchpad
|
||||||
|
MatchName=*SynPS/2 Synaptics TouchPad
|
||||||
|
MatchDMIModalias=dmi:*svnSonyCorporation:pnVPCEG*
|
||||||
|
AttrPressureRange=45:40
|
||||||
|
|
||||||
|
|
@ -1718,10 +1718,11 @@ tp_process_state(struct tp_dispatch *tp, uint64_t time)
|
||||||
|
|
||||||
if (tp_detect_jumps(tp, t, time)) {
|
if (tp_detect_jumps(tp, t, time)) {
|
||||||
if (!tp->semi_mt)
|
if (!tp->semi_mt)
|
||||||
evdev_log_bug_kernel(tp->device,
|
evdev_log_bug_kernel_ratelimit(tp->device,
|
||||||
"Touch jump detected and discarded.\n"
|
&tp->jump.warning,
|
||||||
"See %stouchpad-jumping-cursors.html for details\n",
|
"Touch jump detected and discarded.\n"
|
||||||
HTTP_DOC_LINK);
|
"See %stouchpad-jumping-cursors.html for details\n",
|
||||||
|
HTTP_DOC_LINK);
|
||||||
tp_motion_history_reset(t);
|
tp_motion_history_reset(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3581,6 +3582,9 @@ tp_init(struct tp_dispatch *tp,
|
||||||
if (!use_touch_size)
|
if (!use_touch_size)
|
||||||
tp_init_pressure(tp, device);
|
tp_init_pressure(tp, device);
|
||||||
|
|
||||||
|
/* 5 warnings per 2 hours should be enough */
|
||||||
|
ratelimit_init(&tp->jump.warning, s2us(2 * 60 * 60), 5);
|
||||||
|
|
||||||
/* Set the dpi to that of the x axis, because that's what we normalize
|
/* Set the dpi to that of the x axis, because that's what we normalize
|
||||||
to when needed*/
|
to when needed*/
|
||||||
device->dpi = device->abs.absinfo_x->resolution * 25.4;
|
device->dpi = device->abs.absinfo_x->resolution * 25.4;
|
||||||
|
|
|
||||||
|
|
@ -279,6 +279,10 @@ struct tp_dispatch {
|
||||||
*/
|
*/
|
||||||
unsigned int fake_touches;
|
unsigned int fake_touches;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
struct ratelimit warning;
|
||||||
|
} jump;
|
||||||
|
|
||||||
/* if pressure goes above high -> touch down,
|
/* if pressure goes above high -> touch down,
|
||||||
if pressure then goes below low -> touch up */
|
if pressure then goes below low -> touch up */
|
||||||
struct {
|
struct {
|
||||||
|
|
|
||||||
|
|
@ -1066,6 +1066,49 @@ axis_range_percentage(const struct input_absinfo *a, double percent)
|
||||||
return (a->maximum - a->minimum) * percent/100.0 + a->minimum;
|
return (a->maximum - a->minimum) * percent/100.0 + a->minimum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
tool_set_pressure_thresholds(struct tablet_dispatch *tablet,
|
||||||
|
struct libinput_tablet_tool *tool)
|
||||||
|
{
|
||||||
|
struct evdev_device *device = tablet->device;
|
||||||
|
const struct input_absinfo *pressure;
|
||||||
|
struct quirks_context *quirks = NULL;
|
||||||
|
struct quirks *q = NULL;
|
||||||
|
struct quirk_range r;
|
||||||
|
int lo = 0, hi = 1;
|
||||||
|
|
||||||
|
tool->pressure_offset = 0;
|
||||||
|
tool->has_pressure_offset = false;
|
||||||
|
|
||||||
|
pressure = libevdev_get_abs_info(device->evdev, ABS_PRESSURE);
|
||||||
|
if (!pressure)
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
quirks = evdev_libinput_context(device)->quirks;
|
||||||
|
q = quirks_fetch_for_device(quirks, device->udev_device);
|
||||||
|
|
||||||
|
tool->pressure_offset = pressure->minimum;
|
||||||
|
|
||||||
|
/* 5 and 1% of the pressure range */
|
||||||
|
hi = axis_range_percentage(pressure, 5);
|
||||||
|
lo = axis_range_percentage(pressure, 1);
|
||||||
|
|
||||||
|
if (q && quirks_get_range(q, QUIRK_ATTR_PRESSURE_RANGE, &r)) {
|
||||||
|
if (r.lower >= r.upper) {
|
||||||
|
evdev_log_info(device,
|
||||||
|
"Invalid pressure range, using defaults\n");
|
||||||
|
} else {
|
||||||
|
hi = r.upper;
|
||||||
|
lo = r.lower;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
out:
|
||||||
|
tool->pressure_threshold.upper = hi;
|
||||||
|
tool->pressure_threshold.lower = lo;
|
||||||
|
|
||||||
|
quirks_unref(q);
|
||||||
|
}
|
||||||
|
|
||||||
static struct libinput_tablet_tool *
|
static struct libinput_tablet_tool *
|
||||||
tablet_get_tool(struct tablet_dispatch *tablet,
|
tablet_get_tool(struct tablet_dispatch *tablet,
|
||||||
enum libinput_tablet_tool_type type,
|
enum libinput_tablet_tool_type type,
|
||||||
|
|
@ -1116,8 +1159,6 @@ tablet_get_tool(struct tablet_dispatch *tablet,
|
||||||
/* If we didn't already have the new_tool in our list of tools,
|
/* If we didn't already have the new_tool in our list of tools,
|
||||||
* add it */
|
* add it */
|
||||||
if (!tool) {
|
if (!tool) {
|
||||||
const struct input_absinfo *pressure;
|
|
||||||
|
|
||||||
tool = zalloc(sizeof *tool);
|
tool = zalloc(sizeof *tool);
|
||||||
|
|
||||||
*tool = (struct libinput_tablet_tool) {
|
*tool = (struct libinput_tablet_tool) {
|
||||||
|
|
@ -1127,23 +1168,7 @@ tablet_get_tool(struct tablet_dispatch *tablet,
|
||||||
.refcount = 1,
|
.refcount = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
tool->pressure_offset = 0;
|
tool_set_pressure_thresholds(tablet, tool);
|
||||||
tool->has_pressure_offset = false;
|
|
||||||
tool->pressure_threshold.lower = 0;
|
|
||||||
tool->pressure_threshold.upper = 1;
|
|
||||||
|
|
||||||
pressure = libevdev_get_abs_info(tablet->device->evdev,
|
|
||||||
ABS_PRESSURE);
|
|
||||||
if (pressure) {
|
|
||||||
tool->pressure_offset = pressure->minimum;
|
|
||||||
|
|
||||||
/* 5 and 1% of the pressure range */
|
|
||||||
tool->pressure_threshold.upper =
|
|
||||||
axis_range_percentage(pressure, 5);
|
|
||||||
tool->pressure_threshold.lower =
|
|
||||||
axis_range_percentage(pressure, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
tool_set_bits(tablet, tool);
|
tool_set_bits(tablet, tool);
|
||||||
|
|
||||||
list_insert(tool_list, &tool->link);
|
list_insert(tool_list, &tool->link);
|
||||||
|
|
|
||||||
|
|
@ -312,3 +312,29 @@ error:
|
||||||
free(result);
|
free(result);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Strip any of the characters in what from the beginning and end of the
|
||||||
|
* input string.
|
||||||
|
*
|
||||||
|
* @return a newly allocated string with none of "what" at the beginning or
|
||||||
|
* end of string
|
||||||
|
*/
|
||||||
|
static inline char *
|
||||||
|
strstrip(const char *input, const char *what)
|
||||||
|
{
|
||||||
|
char *str, *last;
|
||||||
|
|
||||||
|
str = safe_strdup(&input[strspn(input, what)]);
|
||||||
|
|
||||||
|
last = str;
|
||||||
|
|
||||||
|
for (char *c = str; *c != '\0'; c++) {
|
||||||
|
if (!strchr(what, *c))
|
||||||
|
last = c + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
*last = '\0';
|
||||||
|
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -725,7 +725,7 @@ litest_init_device_udev_rules(struct litest_test_device *dev, FILE *f)
|
||||||
if (need_keyboard_builtin) {
|
if (need_keyboard_builtin) {
|
||||||
fprintf(f, ""
|
fprintf(f, ""
|
||||||
"ATTRS{name}==\"litest %s*\","
|
"ATTRS{name}==\"litest %s*\","
|
||||||
" IMPORT{builtin}+=\"keyboard\"\n",
|
" IMPORT{builtin}=\"keyboard\"\n",
|
||||||
dev->name);
|
dev->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1033,6 +1033,44 @@ START_TEST(strjoin_test)
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
START_TEST(strstrip_test)
|
||||||
|
{
|
||||||
|
struct strstrip_test {
|
||||||
|
const char *string;
|
||||||
|
const char *expected;
|
||||||
|
const char *what;
|
||||||
|
} tests[] = {
|
||||||
|
{ "foo", "foo", "1234" },
|
||||||
|
{ "\"bar\"", "bar", "\"" },
|
||||||
|
{ "'bar'", "bar", "'" },
|
||||||
|
{ "\"bar\"", "\"bar\"", "'" },
|
||||||
|
{ "'bar'", "'bar'", "\"" },
|
||||||
|
{ "\"bar\"", "bar", "\"" },
|
||||||
|
{ "\"\"", "", "\"" },
|
||||||
|
{ "\"foo\"bar\"", "foo\"bar", "\"" },
|
||||||
|
{ "\"'foo\"bar\"", "foo\"bar", "\"'" },
|
||||||
|
{ "abcfooabcbarbca", "fooabcbar", "abc" },
|
||||||
|
{ "xxxxfoo", "foo", "x" },
|
||||||
|
{ "fooyyyy", "foo", "y" },
|
||||||
|
{ "xxxxfooyyyy", "foo", "xy" },
|
||||||
|
{ "x xfooy y", " xfooy ", "xy" },
|
||||||
|
{ " foo\n", "foo", " \n" },
|
||||||
|
{ "", "", "abc" },
|
||||||
|
{ "", "", "" },
|
||||||
|
{ NULL , NULL, NULL }
|
||||||
|
};
|
||||||
|
struct strstrip_test *t = tests;
|
||||||
|
|
||||||
|
while (t->string) {
|
||||||
|
char *str;
|
||||||
|
str = strstrip(t->string, t->what);
|
||||||
|
ck_assert_str_eq(str, t->expected);
|
||||||
|
free(str);
|
||||||
|
t++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
END_TEST
|
||||||
|
|
||||||
START_TEST(list_test_insert)
|
START_TEST(list_test_insert)
|
||||||
{
|
{
|
||||||
struct list_test {
|
struct list_test {
|
||||||
|
|
@ -1138,6 +1176,7 @@ litest_utils_suite(void)
|
||||||
tcase_add_test(tc, strsplit_test);
|
tcase_add_test(tc, strsplit_test);
|
||||||
tcase_add_test(tc, kvsplit_double_test);
|
tcase_add_test(tc, kvsplit_double_test);
|
||||||
tcase_add_test(tc, strjoin_test);
|
tcase_add_test(tc, strjoin_test);
|
||||||
|
tcase_add_test(tc, strstrip_test);
|
||||||
tcase_add_test(tc, time_conversion);
|
tcase_add_test(tc, time_conversion);
|
||||||
|
|
||||||
tcase_add_test(tc, list_test_insert);
|
tcase_add_test(tc, list_test_insert);
|
||||||
|
|
|
||||||
|
|
@ -1430,37 +1430,26 @@ print_system_header(struct record_context *ctx)
|
||||||
struct utsname u;
|
struct utsname u;
|
||||||
const char *kernel = "unknown";
|
const char *kernel = "unknown";
|
||||||
FILE *dmi, *osrelease;
|
FILE *dmi, *osrelease;
|
||||||
char buf[2048] = "unknown";
|
char dmistr[2048] = "unknown";
|
||||||
|
|
||||||
if (uname(&u) != -1)
|
|
||||||
kernel = u.release;
|
|
||||||
|
|
||||||
dmi = fopen("/sys/class/dmi/id/modalias", "r");
|
|
||||||
if (dmi) {
|
|
||||||
if (fgets(buf, sizeof(buf), dmi)) {
|
|
||||||
buf[strlen(buf) - 1] = '\0'; /* linebreak */
|
|
||||||
} else {
|
|
||||||
sprintf(buf, "unknown");
|
|
||||||
}
|
|
||||||
fclose(dmi);
|
|
||||||
}
|
|
||||||
|
|
||||||
iprintf(ctx, "system:\n");
|
iprintf(ctx, "system:\n");
|
||||||
indent_push(ctx);
|
indent_push(ctx);
|
||||||
|
|
||||||
|
/* /etc/os-release version and distribution name */
|
||||||
osrelease = fopen("/etc/os-release", "r");
|
osrelease = fopen("/etc/os-release", "r");
|
||||||
if (!osrelease)
|
if (!osrelease)
|
||||||
osrelease = fopen("/usr/lib/os-release", "r");
|
osrelease = fopen("/usr/lib/os-release", "r");
|
||||||
if (osrelease) {
|
if (osrelease) {
|
||||||
char *distro = NULL, *version = NULL;
|
char *distro = NULL, *version = NULL;
|
||||||
|
char osrstr[256] = "unknown";
|
||||||
|
|
||||||
while (fgets(buf, sizeof(buf), osrelease)) {
|
while (fgets(osrstr, sizeof(osrstr), osrelease)) {
|
||||||
buf[strlen(buf) - 1] = '\0'; /* linebreak */
|
osrstr[strlen(osrstr) - 1] = '\0'; /* linebreak */
|
||||||
|
|
||||||
if (!distro && strneq(buf, "ID=", 3))
|
if (!distro && strneq(osrstr, "ID=", 3))
|
||||||
distro = safe_strdup(&buf[3]);
|
distro = strstrip(&osrstr[3], "\"'");
|
||||||
else if (!version && strneq(buf, "VERSION_ID=", 11))
|
else if (!version && strneq(osrstr, "VERSION_ID=", 11))
|
||||||
version = safe_strdup(&buf[11]);
|
version = strstrip(&osrstr[11], "\"'");
|
||||||
|
|
||||||
if (distro && version) {
|
if (distro && version) {
|
||||||
iprintf(ctx, "os: \"%s:%s\"\n", distro, version);
|
iprintf(ctx, "os: \"%s:%s\"\n", distro, version);
|
||||||
|
|
@ -1471,8 +1460,23 @@ print_system_header(struct record_context *ctx)
|
||||||
free(version);
|
free(version);
|
||||||
fclose(osrelease);
|
fclose(osrelease);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* kernel version */
|
||||||
|
if (uname(&u) != -1)
|
||||||
|
kernel = u.release;
|
||||||
iprintf(ctx, "kernel: \"%s\"\n", kernel);
|
iprintf(ctx, "kernel: \"%s\"\n", kernel);
|
||||||
iprintf(ctx, "dmi: \"%s\"\n", buf);
|
|
||||||
|
/* dmi modalias */
|
||||||
|
dmi = fopen("/sys/class/dmi/id/modalias", "r");
|
||||||
|
if (dmi) {
|
||||||
|
if (fgets(dmistr, sizeof(dmistr), dmi)) {
|
||||||
|
dmistr[strlen(dmistr) - 1] = '\0'; /* linebreak */
|
||||||
|
} else {
|
||||||
|
sprintf(dmistr, "unknown");
|
||||||
|
}
|
||||||
|
fclose(dmi);
|
||||||
|
}
|
||||||
|
iprintf(ctx, "dmi: \"%s\"\n", dmistr);
|
||||||
indent_pop(ctx);
|
indent_pop(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -620,9 +620,11 @@ tools_list_device_quirks(struct quirks_context *ctx,
|
||||||
do {
|
do {
|
||||||
if (quirks_has_quirk(quirks, q)) {
|
if (quirks_has_quirk(quirks, q)) {
|
||||||
const char *name;
|
const char *name;
|
||||||
|
bool b;
|
||||||
|
|
||||||
name = quirk_get_name(q);
|
name = quirk_get_name(q);
|
||||||
snprintf(buf, sizeof(buf), "%s=1", name);
|
quirks_get_bool(quirks, q, &b);
|
||||||
|
snprintf(buf, sizeof(buf), "%s=%d", name, b ? 1 : 0);
|
||||||
callback(userdata, buf);
|
callback(userdata, buf);
|
||||||
}
|
}
|
||||||
} while(++q < _QUIRK_LAST_MODEL_QUIRK_);
|
} while(++q < _QUIRK_LAST_MODEL_QUIRK_);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
ACTION!="add|change", GOTO="libinput_device_group_end"
|
ACTION!="add|change", GOTO="libinput_device_group_end"
|
||||||
KERNEL!="event[0-9]*", GOTO="libinput_device_group_end"
|
KERNEL!="event[0-9]*", GOTO="libinput_device_group_end"
|
||||||
|
|
||||||
ATTRS{phys}=="?*", IMPORT{program}+="@UDEV_TEST_PATH@libinput-device-group %S%p"
|
ATTRS{phys}=="?*", IMPORT{program}="@UDEV_TEST_PATH@libinput-device-group %S%p"
|
||||||
|
|
||||||
LABEL="libinput_device_group_end"
|
LABEL="libinput_device_group_end"
|
||||||
|
|
|
||||||
|
|
@ -15,12 +15,12 @@ KERNEL!="event*", GOTO="libinput_fuzz_override_end"
|
||||||
# about that.
|
# about that.
|
||||||
ATTRS{capabilities/abs}!="0", \
|
ATTRS{capabilities/abs}!="0", \
|
||||||
ENV{ID_INPUT_TOUCHPAD}=="1", \
|
ENV{ID_INPUT_TOUCHPAD}=="1", \
|
||||||
IMPORT{program}+="@UDEV_TEST_PATH@libinput-fuzz-extract %S%p", \
|
IMPORT{program}="@UDEV_TEST_PATH@libinput-fuzz-extract %S%p", \
|
||||||
RUN{program}+="@UDEV_TEST_PATH@libinput-fuzz-to-zero %S%p", \
|
RUN{program}+="@UDEV_TEST_PATH@libinput-fuzz-to-zero %S%p", \
|
||||||
GOTO="libinput_fuzz_override_end"
|
GOTO="libinput_fuzz_override_end"
|
||||||
ATTRS{capabilities/abs}!="0", \
|
ATTRS{capabilities/abs}!="0", \
|
||||||
ENV{ID_INPUT_TOUCHSCREEN}=="1", \
|
ENV{ID_INPUT_TOUCHSCREEN}=="1", \
|
||||||
IMPORT{program}+="@UDEV_TEST_PATH@libinput-fuzz-extract %S%p", \
|
IMPORT{program}="@UDEV_TEST_PATH@libinput-fuzz-extract %S%p", \
|
||||||
RUN{program}+="@UDEV_TEST_PATH@libinput-fuzz-to-zero %S%p", \
|
RUN{program}+="@UDEV_TEST_PATH@libinput-fuzz-to-zero %S%p", \
|
||||||
GOTO="libinput_fuzz_override_end"
|
GOTO="libinput_fuzz_override_end"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue