test: remove some old compat code for kernel<4.5

Kernel 4.5 and libevdev 1.5 were released in 2016, this code is no
longer necessary.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/986>
This commit is contained in:
Peter Hutterer 2024-03-18 09:51:49 +10:00 committed by Marge Bot
parent 3d246ef248
commit 47f94633fe

View file

@ -3396,7 +3396,7 @@ litest_create_uinput(const char *name,
struct libevdev_uinput *uinput;
struct libevdev *dev;
int type, code;
int rc, fd;
int rc;
const struct input_absinfo *abs;
const struct input_absinfo default_abs = {
.value = 0,
@ -3407,7 +3407,6 @@ litest_create_uinput(const char *name,
.resolution = 100
};
char buf[512];
const char *devnode;
dev = libevdev_new();
litest_assert_ptr_notnull(dev);
@ -3452,38 +3451,6 @@ litest_create_uinput(const char *name,
libevdev_free(dev);
devnode = libevdev_uinput_get_devnode(uinput);
litest_assert_notnull(devnode);
fd = open(devnode, O_RDONLY);
litest_assert_int_gt(fd, -1);
rc = libevdev_new_from_fd(fd, &dev);
litest_assert_int_eq(rc, 0);
/* uinput before kernel 4.5 + libevdev 1.5.0 does not support
* setting the resolution, so we set it afterwards. This is of
* course racy as hell but the way we _generally_ use this function
* by the time libinput uses the device, we're finished here.
*
* If you have kernel 4.5 and libevdev 1.5.0 or later, this code
* just keeps the room warm.
*/
abs = abs_info;
while (abs && abs->value != -1) {
if (abs->resolution != 0) {
if (libevdev_get_abs_resolution(dev, abs->value) ==
abs->resolution)
break;
rc = libevdev_kernel_set_abs_info(dev,
abs->value,
abs);
litest_assert_int_eq(rc, 0);
}
abs++;
}
close(fd);
libevdev_free(dev);
return uinput;
}