summaryrefslogtreecommitdiff
path: root/libevdev/libevdev-uinput.c
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2013-08-31 13:03:47 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2013-09-03 17:01:42 +1000
commit4b5ffa6bea0d4ac92d567fdb3579baf0fe3ab80d (patch)
treee000510b52e528aeffa81eb28cdfe80ee2507deb /libevdev/libevdev-uinput.c
parenta6e25fab76949c5d7ffbaee676ad380b33d78cdb (diff)
downloadlibevdev-4b5ffa6bea0d4ac92d567fdb3579baf0fe3ab80d.tar.gz
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>
Diffstat (limited to 'libevdev/libevdev-uinput.c')
-rw-r--r--libevdev/libevdev-uinput.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/libevdev/libevdev-uinput.c b/libevdev/libevdev-uinput.c
index afebc0b..af98fa4 100644
--- a/libevdev/libevdev-uinput.c
+++ b/libevdev/libevdev-uinput.c
@@ -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);
+ }
}
}