uterm_monitor: add input device support

To allow moving all input handling to uterm, too, we need to detect input
devices in the uterm-monitor like all other devices, too.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
David Herrmann 2012-05-05 18:21:58 +02:00
parent d1be1d60fa
commit 5a5bd3a6f2
2 changed files with 19 additions and 0 deletions

View File

@ -213,6 +213,7 @@ enum uterm_monitor_event_type {
enum uterm_monitor_dev_type {
UTERM_MONITOR_DRM,
UTERM_MONITOR_FBDEV,
UTERM_MONITOR_INPUT,
};
struct uterm_monitor_event {

View File

@ -348,6 +348,8 @@ static void monitor_udev_add(struct uterm_monitor *mon,
return;
}
type = UTERM_MONITOR_FBDEV;
} else if (!strcmp(subs, "input")) {
type = UTERM_MONITOR_INPUT;
} else {
log_debug("adding device with unknown subsystem %s", subs);
return;
@ -543,6 +545,15 @@ int uterm_monitor_new(struct uterm_monitor **out,
goto err_umon;
}
ret = udev_monitor_filter_add_match_subsystem_devtype(mon->umon,
"input", NULL);
if (ret) {
errno = -ret;
log_err("cannot add udev filter (%d): %m", ret);
ret = -EFAULT;
goto err_umon;
}
ret = udev_monitor_filter_add_match_tag(mon->umon, "seat");
if (ret) {
errno = -ret;
@ -665,6 +676,13 @@ void uterm_monitor_scan(struct uterm_monitor *mon)
goto out_enum;
}
ret = udev_enumerate_add_match_subsystem(e, "input");
if (ret) {
errno = -ret;
log_err("cannot add udev match (%d): %m", ret);
goto out_enum;
}
ret = udev_enumerate_add_match_tag(e, "seat");
if (ret) {
errno = -ret;