mirror of
https://gitlab.freedesktop.org/libevdev/libevdev.git
synced 2025-12-24 14:40:07 +01:00
Warn if there are multiple devices with the same syspath
Change to the previous code in that we continue looking at devices even after we've found one. However, this way we can warn the user when we can't guarantee syspath correctness. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
This commit is contained in:
parent
a6e25fab76
commit
4b5ffa6bea
1 changed files with 10 additions and 5 deletions
|
|
@ -226,11 +226,16 @@ fetch_syspath_and_devnode(struct libevdev_uinput *uinput_dev)
|
|||
|
||||
buf[len - 1] = '\0'; /* file contains \n */
|
||||
if (strcmp(buf, uinput_dev->name) == 0) {
|
||||
strcpy(buf, SYS_INPUT_DIR);
|
||||
strcat(buf, namelist[i]->d_name);
|
||||
uinput_dev->syspath = strdup(buf);
|
||||
uinput_dev->devnode = fetch_device_node(buf);
|
||||
break;
|
||||
if (uinput_dev->syspath) {
|
||||
/* FIXME: could descend into bit comparison here */
|
||||
log_info("multiple identical devices found. syspath is unreliable\n");
|
||||
break;
|
||||
} else {
|
||||
strcpy(buf, SYS_INPUT_DIR);
|
||||
strcat(buf, namelist[i]->d_name);
|
||||
uinput_dev->syspath = strdup(buf);
|
||||
uinput_dev->devnode = fetch_device_node(buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue