udev: skip EVDEV_ABS override on devices without EV_ABS (#5984)
When we first handle a device with an EVDEV_ABS override, check if it has EV_ABS bits. If not, print a warning and continue. This is required on devices where the match string applies to multiple device nodes, not all of which may have absolute axes. Fixes https://github.com/systemd/systemd/issues/5079
This commit is contained in:
parent
e69c933694
commit
855cf359b2
|
@ -201,6 +201,7 @@ static int builtin_keyboard(struct udev_device *dev, int argc, char *argv[], boo
|
|||
unsigned release_count = 0;
|
||||
_cleanup_close_ int fd = -1;
|
||||
const char *node;
|
||||
int has_abs = -1;
|
||||
|
||||
node = udev_device_get_devnode(dev);
|
||||
if (!node) {
|
||||
|
@ -261,6 +262,24 @@ static int builtin_keyboard(struct udev_device *dev, int argc, char *argv[], boo
|
|||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (has_abs == -1) {
|
||||
unsigned long bits;
|
||||
int rc;
|
||||
|
||||
rc = ioctl(fd, EVIOCGBIT(0, sizeof(bits)), &bits);
|
||||
if (rc < 0) {
|
||||
log_error_errno(errno, "Unable to EVIOCGBIT device \"%s\"", node);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
has_abs = !!(bits & (1 << EV_ABS));
|
||||
if (!has_abs)
|
||||
log_warning("EVDEV_ABS override set but no EV_ABS present on device \"%s\"", node);
|
||||
}
|
||||
|
||||
if (!has_abs)
|
||||
continue;
|
||||
|
||||
override_abs(fd, node, evcode, udev_list_entry_get_value(entry));
|
||||
} else if (streq(key, "POINTINGSTICK_SENSITIVITY"))
|
||||
set_trackpoint_sensitivity(dev, udev_list_entry_get_value(entry));
|
||||
|
|
Loading…
Reference in a new issue