Compare commits

...

18 commits
main ... 1.15.6

Author SHA1 Message Date
Peter Hutterer
f8032ba715 libinput 1.15.6
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-06-19 08:58:33 +10:00
John Rodriguez
fb4c3c6c6c Add quirks file for Sony Vaio Laptop
The file contains pressure overrides for the VPCEG series.
Signed-off-by: John Rodriguez <johrodri@optonline.net>
(cherry picked from commit c8e8c8fb4b)
2020-06-18 14:27:23 +10:00
Yariv Barkan
9c2c1db948 quirks: fix Apple external trackpad v2 thresholds
The external Apple "Magic" trackpads, both the first and the second
generations, have pretty good built-in spurious touch filtering. For
these device models libinput's own filtering is not required. Using low
enough values such as 20:10 effectively disables libinput's filtering.

Signed-off-by: Yariv Barkan <oigevald+libinput@gmail.com>
(cherry picked from commit 84b3b1731a)
2020-06-18 10:09:19 +10:00
Peter Hutterer
67591fcf00 gitlab CI: alpine needs pip explicitly installed now
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 75ca6dcfa3)
2020-06-17 13:01:03 +10:00
Hans de Goede
29375e543f quirks: Add HP stream x360 11 ModelTabletModeNoSuspend keyboard quirk
The HP stream x360 11'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.

Suspending the keyboard while in tablet-mode also disable the capacitive
home button, which is undesirable.

Add a ModelTabletModeNoSuspend quirk so that the home button keeps working
when in tablet-mode. This can safely be done since the rest of the
keyboard gets disabled by the embedded-controller for us.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit 3618129496)
2020-06-17 12:10:23 +10:00
Peter Hutterer
584d3cb0b9 quirks: mark the 0x233 razer keyboard as internal
Razer Blade 2018 has a different model ID than the one we already have.

Fixes #489

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 152837f44a)
2020-06-17 12:10:14 +10:00
Troels Blicher Petersen
259adb7178 Lenovo X201 Tablet: Added bezel buttons support in tablet mode
This patch allows the bezel buttons,
to work when entering SW_TABLET_MODE
similar to how other x2xx tablets are
working.

Signed-off-by: Troels Blicher Petersen <troels@newtec.dk>
(cherry picked from commit 50ee371c59)
2020-06-17 12:09:59 +10:00
Loïc Yhuel
f9f9bc5927 quirks: correctly print boolean values
When a boolean quirk is set to "0", it is correctly disabled, but "libinput quirks list" and
"libinput record" showed it as "1".

This happens for example if ModelXXXX=0 is set in /etc/libinput/local-overrides.quirks, to
override a default quirk.

Signed-off-by: Loïc Yhuel <loic.yhuel@softathome.com>
(cherry picked from commit dd0370f73c)
2020-06-17 12:09:28 +10:00
Peter Hutterer
86d81a0ac7 tablet: use the AttrPressureRange quirk for tablets too
The Aiptek 8000U has a pressure offset above our default (%5) but no
meaningful way of detecting that. It doesn't provide distance or BTN_TOOL_PEN
either, so our heuristics can't hook onto anything. BTN_TOUCH is set by this
tablet but not at consistent pressure thresholds.

Work around this by shipping a quirk that ups it to 70. Aiptek
re-uses USB IDs because of course they do, so this applies to more than one
device. Let's see what breaks.

Fixes #462

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 72af32c89e)
2020-06-17 12:09:18 +10:00
Martin Cihlář
0e7a92b4c1 add trust mouse quirk #455
Signed-off-by: Martin Cihlář <martin.cibule@seznam.cz>
(cherry picked from commit 4d42e9b9e2)
2020-06-17 12:08:29 +10:00
Peter Hutterer
5b500c0e74 libinput 1.15.5
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-04-11 10:01:55 +10:00
Peter Hutterer
7658efbd71 doc/api: remove invalid doxygen option
doxygen 1.8.17 shows this error:

error: Illegal format for option FILTER_PATTERNS, no equal sign ('=') specified for item '*.h'
error: Illegal format for option FILTER_PATTERNS, no equal sign ('=') specified for item '*.dox'

This was added in deadbf35c4 but I cannot figure out how this ever had any
effect based on the documentation for it. So let's drop it, I don't think it
has any effect anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 33c98fed54)
2020-04-11 09:13:14 +10:00
Peter Hutterer
c2fa055fa3 udev: don't use IMPORT+=
IMPORT really only supports == and != and for a short while udevd warned about
this before that warning was reverted again.

Where anything else is used, it falls back to ==. systemd upstream rules all
use a single = though, so let's stick with that to be consistent, even if it
is technically wrong (udevd will warn about this in debug mode).

See the long discussion in systemd upstream for details:
https://github.com/systemd/systemd/issues/14062

Fixes #461

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 281ecf10d1)
2020-04-11 09:07:42 +10:00
Peter Hutterer
ce1c4c5008 doc: update the jumping cursor docs
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 150f5dc801)
2020-04-11 09:07:11 +10:00
Peter Hutterer
aec607ecb4 touchpad: ratelimit the touch jump tests
In most cases these days touch jumps aren't actually fixable, they don't have
any good heuristics we can employ to remove them. And, luckily, in most cases
it doesn't matter because the users only notice the issue because of the error
message. To avoid spamming the user's log, let's ratelimit it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit d6eef77dd2)
2020-04-11 09:07:06 +10:00
Peter Hutterer
560ba890b3 tools: record: drop quotes from os-release information
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit d80bbcb028)
2020-04-11 09:06:57 +10:00
Peter Hutterer
f7a6f751dd libinput 1.15.4
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-18 15:30:25 +10:00
Peter Hutterer
2189fd2c2e tools: record: fix dmi recording
Processing os-release in the same buffer that the dmi modalias used caused the
dmi to be recorded as 'dmi: "VERSION_ID=31"'. The cause for that was simply
that the dmi modalias was read but not printed until after the os-release
information was processed.

Fix this two-fold: rearrange that each part now reads and prints in
one go, and rename the buffers so we don't re-use them.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 850925910f)
2020-03-18 15:29:50 +10:00
22 changed files with 236 additions and 60 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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.

View file

@ -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',
] ]

View file

@ -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

View file

@ -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*

View file

@ -0,0 +1,6 @@
[Trust GXT 25 Gaming Mouse]
MatchUdevType=mouse
MatchBus=usb
MatchVendor=0x1D57
MatchProduct=0xAD03
ModelBouncingKeys=1

View file

@ -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

View file

@ -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:*

View file

@ -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

View 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

View file

@ -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;

View file

@ -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 {

View file

@ -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);

View file

@ -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;
}

View file

@ -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);
} }

View file

@ -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);

View file

@ -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);
} }

View file

@ -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_);

View file

@ -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"

View file

@ -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"