diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/uterm.h | 1 | ||||
-rw-r--r-- | src/uterm_monitor.c | 18 |
2 files changed, 19 insertions, 0 deletions
diff --git a/src/uterm.h b/src/uterm.h index f113d0f..e65f2e7 100644 --- a/src/uterm.h +++ b/src/uterm.h @@ -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 { diff --git a/src/uterm_monitor.c b/src/uterm_monitor.c index e2fa090..846a201 100644 --- a/src/uterm_monitor.c +++ b/src/uterm_monitor.c @@ -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; |