Commit fad04dd9 authored by Lennart Poettering's avatar Lennart Poettering Committed by Keith Packard

udev: make use of udev_enumerate_add_match_tag() only when it is available

udev_enumerate_add_match_tag() and udev_monitor_filter_add_match_tag()
are mostly optimizations, hence simply skip these calls if they are not
available in the installed version of libudev.

This should fix the build on older versions of udev.

[airlied: fixes tinderbox failures on RHEL6]
Signed-off-by: Lennart Poettering's avatarLennart Poettering <lennart@poettering.net>
Reviewed-by: default avatarDave Airlie <airlied@redhat.com>
Tested-by: default avatarDave Airlie <airlied@redhat.com>
Reviewed-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Keith Packard's avatarKeith Packard <keithp@keithp.com>
parent 77743f87
......@@ -285,8 +285,10 @@ config_udev_init(void)
udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "input", NULL);
udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "tty", NULL); /* For Wacom serial devices */
#ifdef HAVE_UDEV_MONITOR_FILTER_ADD_MATCH_TAG
if (SeatId && strcmp(SeatId, "seat0"))
udev_monitor_filter_add_match_tag(udev_monitor, SeatId);
#endif
if (udev_monitor_enable_receiving(udev_monitor)) {
ErrorF("config/udev: failed to bind the udev monitor\n");
......@@ -300,8 +302,10 @@ config_udev_init(void)
udev_enumerate_add_match_subsystem(enumerate, "input");
udev_enumerate_add_match_subsystem(enumerate, "tty");
#ifdef HAVE_UDEV_ENUMERATE_ADD_MATCH_TAG
if (SeatId && strcmp(SeatId, "seat0"))
udev_enumerate_add_match_tag(enumerate, SeatId);
#endif
udev_enumerate_scan_devices(enumerate);
devices = udev_enumerate_get_list_entry(enumerate);
......
......@@ -822,6 +822,15 @@ if test "x$CONFIG_UDEV" = xyes; then
AC_MSG_ERROR([udev configuration API requested, but libudev is not installed])
fi
AC_DEFINE(CONFIG_UDEV, 1, [Use libudev for input hotplug])
SAVE_LIBS=$LIBS
SAVE_CFLAGS=$CFLAGS
CFLAGS=$UDEV_CFLAGS
LIBS=$UDEV_LIBS
AC_CHECK_FUNCS([udev_monitor_filter_add_match_tag])
AC_CHECK_FUNCS([udev_enumerate_add_match_tag])
LIBS=$SAVE_LIBS
CFLAGS=$SAVE_CFLAGS
fi
dnl HAVE_DBUS is true if we actually have the D-Bus library, whereas
......
......@@ -399,6 +399,12 @@
/* Use libudev for input hotplug */
#undef CONFIG_UDEV
/* Use udev_monitor_filter_add_match_tag() */
#undef HAVE_UDEV_MONITOR_FILTER_ADD_MATCH_TAG
/* Use udev_enumerate_add_match_tag() */
#undef HAVE_UDEV_ENUMERATE_ADD_MATCH_TAG
/* Use D-Bus for input hotplug */
#undef CONFIG_NEED_DBUS
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment