diff options
Diffstat (limited to 'xserver/config')
-rw-r--r-- | xserver/config/10-evdev.conf | 40 | ||||
-rw-r--r-- | xserver/config/Makefile.am | 35 | ||||
-rw-r--r-- | xserver/config/Makefile.in | 233 | ||||
-rw-r--r-- | xserver/config/config-backends.h | 21 | ||||
-rw-r--r-- | xserver/config/config.c | 81 | ||||
-rw-r--r-- | xserver/config/dbus-core.c | 1 | ||||
-rw-r--r-- | xserver/config/dbus.c | 4 | ||||
-rw-r--r-- | xserver/config/hal.c | 97 | ||||
-rw-r--r-- | xserver/config/udev.c | 267 |
9 files changed, 623 insertions, 156 deletions
diff --git a/xserver/config/10-evdev.conf b/xserver/config/10-evdev.conf new file mode 100644 index 000000000..cc83ab232 --- /dev/null +++ b/xserver/config/10-evdev.conf @@ -0,0 +1,40 @@ +# +# Catch-all evdev loader for udev-based systems +# We don't simply match on any device since that also adds accelerometers +# and other devices that we don't really want to use. The list below +# matches everything but joysticks. + +Section "InputClass" + Identifier "evdev pointer catchall" + MatchIsPointer "on" + MatchDevicePath "/dev/input/event*" + Driver "evdev" +EndSection + +Section "InputClass" + Identifier "evdev keyboard catchall" + MatchIsKeyboard "on" + MatchDevicePath "/dev/input/event*" + Driver "evdev" +EndSection + +Section "InputClass" + Identifier "evdev touchpad catchall" + MatchIsTouchpad "on" + MatchDevicePath "/dev/input/event*" + Driver "evdev" +EndSection + +Section "InputClass" + Identifier "evdev tablet catchall" + MatchIsTablet "on" + MatchDevicePath "/dev/input/event*" + Driver "evdev" +EndSection + +Section "InputClass" + Identifier "evdev touchscreen catchall" + MatchIsTouchscreen "on" + MatchDevicePath "/dev/input/event*" + Driver "evdev" +EndSection diff --git a/xserver/config/Makefile.am b/xserver/config/Makefile.am index 1e7c501c3..675a3b260 100644 --- a/xserver/config/Makefile.am +++ b/xserver/config/Makefile.am @@ -1,22 +1,39 @@ -AM_CFLAGS = @DIX_CFLAGS@ +AM_CFLAGS = $(DIX_CFLAGS) -noinst_LIBRARIES = libconfig.a -libconfig_a_SOURCES = config.c config-backends.h +noinst_LTLIBRARIES = libconfig.la +libconfig_la_SOURCES = config.c config-backends.h + +if CONFIG_UDEV + +AM_CFLAGS += $(UDEV_CFLAGS) +libconfig_la_SOURCES += udev.c +libconfig_la_LIBADD = $(UDEV_LIBS) + +xorgconfddir = $(datadir)/X11/$(XF86CONFIGDIR) +xorgconfd_DATA = 10-evdev.conf + +else if CONFIG_NEED_DBUS -AM_CFLAGS += @DBUS_CFLAGS@ -libconfig_a_SOURCES += dbus-core.c -endif +AM_CFLAGS += $(DBUS_CFLAGS) +libconfig_la_SOURCES += dbus-core.c +libconfig_la_LIBADD = $(DBUS_LIBS) if CONFIG_DBUS_API dbusconfigdir = $(sysconfdir)/dbus-1/system.d dbusconfig_DATA = xorg-server.conf -libconfig_a_SOURCES += dbus.c +libconfig_la_SOURCES += dbus.c endif if CONFIG_HAL -libconfig_a_SOURCES += hal.c +AM_CFLAGS += $(HAL_CFLAGS) +libconfig_la_SOURCES += hal.c +libconfig_la_LIBADD += $(HAL_LIBS) endif -EXTRA_DIST = xorg-server.conf x11-input.fdi +endif # CONFIG_NEED_DBUS + +endif # !CONFIG_UDEV + +EXTRA_DIST = xorg-server.conf x11-input.fdi 10-evdev.conf diff --git a/xserver/config/Makefile.in b/xserver/config/Makefile.in index 85457ea16..36205c632 100644 --- a/xserver/config/Makefile.in +++ b/xserver/config/Makefile.in @@ -37,15 +37,19 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -@CONFIG_NEED_DBUS_TRUE@am__append_1 = @DBUS_CFLAGS@ -@CONFIG_NEED_DBUS_TRUE@am__append_2 = dbus-core.c -@CONFIG_DBUS_API_TRUE@am__append_3 = dbus.c -@CONFIG_HAL_TRUE@am__append_4 = hal.c +@CONFIG_UDEV_TRUE@am__append_1 = $(UDEV_CFLAGS) +@CONFIG_UDEV_TRUE@am__append_2 = udev.c +@CONFIG_NEED_DBUS_TRUE@@CONFIG_UDEV_FALSE@am__append_3 = $(DBUS_CFLAGS) +@CONFIG_NEED_DBUS_TRUE@@CONFIG_UDEV_FALSE@am__append_4 = dbus-core.c +@CONFIG_DBUS_API_TRUE@@CONFIG_NEED_DBUS_TRUE@@CONFIG_UDEV_FALSE@am__append_5 = dbus.c +@CONFIG_HAL_TRUE@@CONFIG_NEED_DBUS_TRUE@@CONFIG_UDEV_FALSE@am__append_6 = $(HAL_CFLAGS) +@CONFIG_HAL_TRUE@@CONFIG_NEED_DBUS_TRUE@@CONFIG_UDEV_FALSE@am__append_7 = hal.c +@CONFIG_HAL_TRUE@@CONFIG_NEED_DBUS_TRUE@@CONFIG_UDEV_FALSE@am__append_8 = $(HAL_LIBS) subdir = config DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \ + $(top_srcdir)/m4/dolt.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(install_sh) -d @@ -55,21 +59,27 @@ CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ $(top_builddir)/include/xorg-config.h \ $(top_builddir)/include/xkb-config.h \ $(top_builddir)/include/xwin-config.h \ - $(top_builddir)/include/kdrive-config.h + $(top_builddir)/include/kdrive-config.h \ + $(top_builddir)/include/version-config.h CONFIG_CLEAN_FILES = -LIBRARIES = $(noinst_LIBRARIES) -ARFLAGS = cru -libconfig_a_AR = $(AR) $(ARFLAGS) -libconfig_a_LIBADD = -am__libconfig_a_SOURCES_DIST = config.c config-backends.h dbus-core.c \ - dbus.c hal.c -@CONFIG_NEED_DBUS_TRUE@am__objects_1 = dbus-core.$(OBJEXT) -@CONFIG_DBUS_API_TRUE@am__objects_2 = dbus.$(OBJEXT) -@CONFIG_HAL_TRUE@am__objects_3 = hal.$(OBJEXT) -am_libconfig_a_OBJECTS = config.$(OBJEXT) $(am__objects_1) \ - $(am__objects_2) $(am__objects_3) -libconfig_a_OBJECTS = $(am_libconfig_a_OBJECTS) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include -I$(top_builddir)/include -I$(top_builddir)/include -I$(top_builddir)/include -I$(top_builddir)/include -I$(top_builddir)/include -I$(top_builddir)/include +LTLIBRARIES = $(noinst_LTLIBRARIES) +am__DEPENDENCIES_1 = +@CONFIG_HAL_TRUE@@CONFIG_NEED_DBUS_TRUE@@CONFIG_UDEV_FALSE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) +@CONFIG_NEED_DBUS_TRUE@@CONFIG_UDEV_FALSE@libconfig_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ +@CONFIG_NEED_DBUS_TRUE@@CONFIG_UDEV_FALSE@ $(am__DEPENDENCIES_2) +@CONFIG_UDEV_TRUE@libconfig_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ +@CONFIG_UDEV_TRUE@ $(am__DEPENDENCIES_2) +am__libconfig_la_SOURCES_DIST = config.c config-backends.h udev.c \ + dbus-core.c dbus.c hal.c +@CONFIG_UDEV_TRUE@am__objects_1 = udev.lo +@CONFIG_NEED_DBUS_TRUE@@CONFIG_UDEV_FALSE@am__objects_2 = \ +@CONFIG_NEED_DBUS_TRUE@@CONFIG_UDEV_FALSE@ dbus-core.lo +@CONFIG_DBUS_API_TRUE@@CONFIG_NEED_DBUS_TRUE@@CONFIG_UDEV_FALSE@am__objects_3 = dbus.lo +@CONFIG_HAL_TRUE@@CONFIG_NEED_DBUS_TRUE@@CONFIG_UDEV_FALSE@am__objects_4 = hal.lo +am_libconfig_la_OBJECTS = config.lo $(am__objects_1) $(am__objects_2) \ + $(am__objects_3) $(am__objects_4) +libconfig_la_OBJECTS = $(am_libconfig_la_OBJECTS) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include -I$(top_builddir)/include -I$(top_builddir)/include -I$(top_builddir)/include -I$(top_builddir)/include -I$(top_builddir)/include -I$(top_builddir)/include -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ @@ -77,17 +87,19 @@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libconfig_a_SOURCES) -DIST_SOURCES = $(am__libconfig_a_SOURCES_DIST) +SOURCES = $(libconfig_la_SOURCES) +DIST_SOURCES = $(am__libconfig_la_SOURCES_DIST) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(dbusconfigdir)" +am__installdirs = "$(DESTDIR)$(dbusconfigdir)" \ + "$(DESTDIR)$(xorgconfddir)" dbusconfigDATA_INSTALL = $(INSTALL_DATA) -DATA = $(dbusconfig_DATA) +xorgconfdDATA_INSTALL = $(INSTALL_DATA) +DATA = $(dbusconfig_DATA) $(xorgconfd_DATA) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) @@ -104,12 +116,13 @@ ALPHA_VIDEO_TRUE = @ALPHA_VIDEO_TRUE@ AMDEP_FALSE = @AMDEP_FALSE@ AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ -APPLE_APPLICATION_ID = @APPLE_APPLICATION_ID@ APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@ APP_MAN_DIR = @APP_MAN_DIR@ APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ AR = @AR@ +ARM_BACKTRACE_CFLAGS = @ARM_BACKTRACE_CFLAGS@ ARM_VIDEO_FALSE = @ARM_VIDEO_FALSE@ ARM_VIDEO_TRUE = @ARM_VIDEO_TRUE@ AS = @AS@ @@ -137,6 +150,7 @@ CCAS = @CCAS@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CHANGELOG_CMD = @CHANGELOG_CMD@ COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ COMPOSITE_FALSE = @COMPOSITE_FALSE@ COMPOSITE_TRUE = @COMPOSITE_TRUE@ @@ -146,8 +160,11 @@ CONFIG_HAL_FALSE = @CONFIG_HAL_FALSE@ CONFIG_HAL_TRUE = @CONFIG_HAL_TRUE@ CONFIG_NEED_DBUS_FALSE = @CONFIG_NEED_DBUS_FALSE@ CONFIG_NEED_DBUS_TRUE = @CONFIG_NEED_DBUS_TRUE@ +CONFIG_UDEV_FALSE = @CONFIG_UDEV_FALSE@ +CONFIG_UDEV_TRUE = @CONFIG_UDEV_TRUE@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CWARNFLAGS = @CWARNFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ @@ -161,6 +178,7 @@ DBUS_LIBS = @DBUS_LIBS@ DEBUG_FALSE = @DEBUG_FALSE@ DEBUG_TRUE = @DEBUG_TRUE@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ +DEFAULT_LOGDIR = @DEFAULT_LOGDIR@ DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ DEFS = @DEFS@ @@ -170,7 +188,9 @@ DGA_FALSE = @DGA_FALSE@ DGA_LIBS = @DGA_LIBS@ DGA_TRUE = @DGA_TRUE@ DIX_CFLAGS = @DIX_CFLAGS@ +DIX_LIB = @DIX_LIB@ DLLTOOL = @DLLTOOL@ +DLOPEN_LIBS = @DLOPEN_LIBS@ DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ @@ -186,6 +206,7 @@ DMX_BUILD_USB_TRUE = @DMX_BUILD_USB_TRUE@ DMX_FALSE = @DMX_FALSE@ DMX_TRUE = @DMX_TRUE@ DOLT_BASH = @DOLT_BASH@ +DOXYGEN = @DOXYGEN@ DPMSExtension_FALSE = @DPMSExtension_FALSE@ DPMSExtension_TRUE = @DPMSExtension_TRUE@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ @@ -198,8 +219,10 @@ DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ DRIPROTO_LIBS = @DRIPROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ +DRI_CFLAGS = @DRI_CFLAGS@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ DRI_FALSE = @DRI_FALSE@ +DRI_LIBS = @DRI_LIBS@ DRI_TRUE = @DRI_TRUE@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ @@ -215,8 +238,17 @@ FBDEVHW_TRUE = @FBDEVHW_TRUE@ FFLAGS = @FFLAGS@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ +FONT100DPIDIR = @FONT100DPIDIR@ +FONT75DPIDIR = @FONT75DPIDIR@ +FONTMISCDIR = @FONTMISCDIR@ +FONTOTFDIR = @FONTOTFDIR@ +FONTROOTDIR = @FONTROOTDIR@ +FONTTTFDIR = @FONTTTFDIR@ +FONTTYPE1DIR = @FONTTYPE1DIR@ FREEBSD_KLDLOAD_FALSE = @FREEBSD_KLDLOAD_FALSE@ FREEBSD_KLDLOAD_TRUE = @FREEBSD_KLDLOAD_TRUE@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ GLX_FALSE = @GLX_FALSE@ @@ -226,18 +258,17 @@ GL_LIBS = @GL_LIBS@ GREP = @GREP@ HAL_CFLAGS = @HAL_CFLAGS@ HAL_LIBS = @HAL_LIBS@ -HAVE_AGL_FRAMEWORK_FALSE = @HAVE_AGL_FRAMEWORK_FALSE@ -HAVE_AGL_FRAMEWORK_TRUE = @HAVE_AGL_FRAMEWORK_TRUE@ HAVE_DBUS_FALSE = @HAVE_DBUS_FALSE@ HAVE_DBUS_TRUE = @HAVE_DBUS_TRUE@ -HAVE_XPLUGIN_FALSE = @HAVE_XPLUGIN_FALSE@ -HAVE_XPLUGIN_TRUE = @HAVE_XPLUGIN_TRUE@ +HAVE_DOXYGEN_FALSE = @HAVE_DOXYGEN_FALSE@ +HAVE_DOXYGEN_TRUE = @HAVE_DOXYGEN_TRUE@ HP300_VIDEO_FALSE = @HP300_VIDEO_FALSE@ HP300_VIDEO_TRUE = @HP300_VIDEO_TRUE@ HPPA_VIDEO_FALSE = @HPPA_VIDEO_FALSE@ HPPA_VIDEO_TRUE = @HPPA_VIDEO_TRUE@ I386_VIDEO_FALSE = @I386_VIDEO_FALSE@ I386_VIDEO_TRUE = @I386_VIDEO_TRUE@ +INSTALL_CMD = @INSTALL_CMD@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_LIBXF86CONFIG_FALSE = @INSTALL_LIBXF86CONFIG_FALSE@ INSTALL_LIBXF86CONFIG_TRUE = @INSTALL_LIBXF86CONFIG_TRUE@ @@ -246,6 +277,8 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_SETUID_FALSE = @INSTALL_SETUID_FALSE@ INSTALL_SETUID_TRUE = @INSTALL_SETUID_TRUE@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INT10MODULE_FALSE = @INT10MODULE_FALSE@ +INT10MODULE_TRUE = @INT10MODULE_TRUE@ INT10_STUB_FALSE = @INT10_STUB_FALSE@ INT10_STUB_TRUE = @INT10_STUB_TRUE@ INT10_VM86_FALSE = @INT10_VM86_FALSE@ @@ -258,20 +291,23 @@ KDRIVELINUX_FALSE = @KDRIVELINUX_FALSE@ KDRIVELINUX_TRUE = @KDRIVELINUX_TRUE@ KDRIVEOPENBSD_FALSE = @KDRIVEOPENBSD_FALSE@ KDRIVEOPENBSD_TRUE = @KDRIVEOPENBSD_TRUE@ -KDRIVEVESA_FALSE = @KDRIVEVESA_FALSE@ -KDRIVEVESA_TRUE = @KDRIVEVESA_TRUE@ KDRIVEWSCONS_FALSE = @KDRIVEWSCONS_FALSE@ KDRIVEWSCONS_TRUE = @KDRIVEWSCONS_TRUE@ KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ +KDRIVE_EVDEV_FALSE = @KDRIVE_EVDEV_FALSE@ +KDRIVE_EVDEV_TRUE = @KDRIVE_EVDEV_TRUE@ KDRIVE_FALSE = @KDRIVE_FALSE@ -KDRIVE_HW_FALSE = @KDRIVE_HW_FALSE@ -KDRIVE_HW_TRUE = @KDRIVE_HW_TRUE@ KDRIVE_INCS = @KDRIVE_INCS@ +KDRIVE_KBD_FALSE = @KDRIVE_KBD_FALSE@ +KDRIVE_KBD_TRUE = @KDRIVE_KBD_TRUE@ KDRIVE_LIBS = @KDRIVE_LIBS@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ +KDRIVE_MOUSE_FALSE = @KDRIVE_MOUSE_FALSE@ +KDRIVE_MOUSE_TRUE = @KDRIVE_MOUSE_TRUE@ KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ KDRIVE_TRUE = @KDRIVE_TRUE@ +LAUNCHD_ID_PREFIX = @LAUNCHD_ID_PREFIX@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ LEX = @LEX@ @@ -300,12 +336,12 @@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MAKE_HTML = @MAKE_HTML@ MAKE_PDF = @MAKE_PDF@ MAKE_PS = @MAKE_PS@ MAKE_TEXT = @MAKE_TEXT@ -MESA_SOURCE = @MESA_SOURCE@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ MITSHM_FALSE = @MITSHM_FALSE@ @@ -324,6 +360,9 @@ OBJCFLAGS = @OBJCFLAGS@ OBJCLINK = @OBJCLINK@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ +OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ +OPENSSL_LIBS = @OPENSSL_LIBS@ +OS_LIB = @OS_LIB@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -352,34 +391,51 @@ SCREENSAVER_TRUE = @SCREENSAVER_TRUE@ SECURE_RPC_FALSE = @SECURE_RPC_FALSE@ SECURE_RPC_TRUE = @SECURE_RPC_TRUE@ SED = @SED@ +SELINUX_CFLAGS = @SELINUX_CFLAGS@ +SELINUX_LIBS = @SELINUX_LIBS@ SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ SET_MAKE = @SET_MAKE@ SGI_VIDEO_FALSE = @SGI_VIDEO_FALSE@ SGI_VIDEO_TRUE = @SGI_VIDEO_TRUE@ +SHA1_CFLAGS = @SHA1_CFLAGS@ +SHA1_LIBS = @SHA1_LIBS@ SHELL = @SHELL@ SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@ SOLARIS_ASM_INLINE_FALSE = @SOLARIS_ASM_INLINE_FALSE@ SOLARIS_ASM_INLINE_TRUE = @SOLARIS_ASM_INLINE_TRUE@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ -SOLARIS_USL_CONSOLE_FALSE = @SOLARIS_USL_CONSOLE_FALSE@ -SOLARIS_USL_CONSOLE_TRUE = @SOLARIS_USL_CONSOLE_TRUE@ +SOLARIS_VT_FALSE = @SOLARIS_VT_FALSE@ +SOLARIS_VT_TRUE = @SOLARIS_VT_TRUE@ SPARC64_VIDEO_FALSE = @SPARC64_VIDEO_FALSE@ SPARC64_VIDEO_TRUE = @SPARC64_VIDEO_TRUE@ +SPECIAL_DTRACE_OBJECTS_FALSE = @SPECIAL_DTRACE_OBJECTS_FALSE@ +SPECIAL_DTRACE_OBJECTS_TRUE = @SPECIAL_DTRACE_OBJECTS_TRUE@ STANDALONE_XPBPROXY_FALSE = @STANDALONE_XPBPROXY_FALSE@ STANDALONE_XPBPROXY_TRUE = @STANDALONE_XPBPROXY_TRUE@ STRIP = @STRIP@ +SYSCONFDIR = @SYSCONFDIR@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_FALSE = @TSLIB_FALSE@ TSLIB_LIBS = @TSLIB_LIBS@ TSLIB_TRUE = @TSLIB_TRUE@ +UDEV_CFLAGS = @UDEV_CFLAGS@ +UDEV_LIBS = @UDEV_LIBS@ +UNITTESTS_FALSE = @UNITTESTS_FALSE@ +UNITTESTS_TRUE = @UNITTESTS_TRUE@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ -VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@ -VENDOR_NAME = @VENDOR_NAME@ +VBE_FALSE = @VBE_FALSE@ +VBE_TRUE = @VBE_TRUE@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ -VENDOR_RELEASE = @VENDOR_RELEASE@ VERSION = @VERSION@ +VGAHW_FALSE = @VGAHW_FALSE@ +VGAHW_TRUE = @VGAHW_TRUE@ +WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@ +WINDOWSWM_LIBS = @WINDOWSWM_LIBS@ +WINDRES = @WINDRES@ X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ +XAA_FALSE = @XAA_FALSE@ +XAA_TRUE = @XAA_TRUE@ XACE_FALSE = @XACE_FALSE@ XACE_TRUE = @XACE_TRUE@ XCALIBRATE_FALSE = @XCALIBRATE_FALSE@ @@ -404,6 +460,7 @@ XEPHYR_LIBS = @XEPHYR_LIBS@ XEPHYR_TRUE = @XEPHYR_TRUE@ XF86BIGFONT_FALSE = @XF86BIGFONT_FALSE@ XF86BIGFONT_TRUE = @XF86BIGFONT_TRUE@ +XF86CONFIGDIR = @XF86CONFIGDIR@ XF86CONFIGFILE = @XF86CONFIGFILE@ XF86UTILS_FALSE = @XF86UTILS_FALSE@ XF86UTILS_TRUE = @XF86UTILS_TRUE@ @@ -446,15 +503,14 @@ XORG_TRUE = @XORG_TRUE@ XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@ XPBPROXY_LIBS = @XPBPROXY_LIBS@ XQUARTZ_FALSE = @XQUARTZ_FALSE@ +XQUARTZ_SPARKLE = @XQUARTZ_SPARKLE@ +XQUARTZ_SPARKLE_FALSE = @XQUARTZ_SPARKLE_FALSE@ +XQUARTZ_SPARKLE_TRUE = @XQUARTZ_SPARKLE_TRUE@ XQUARTZ_TRUE = @XQUARTZ_TRUE@ XREGISTRY_FALSE = @XREGISTRY_FALSE@ XREGISTRY_TRUE = @XREGISTRY_TRUE@ XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ -XSDLSERVER_FALSE = @XSDLSERVER_FALSE@ -XSDLSERVER_TRUE = @XSDLSERVER_TRUE@ -XSDL_INCS = @XSDL_INCS@ -XSDL_LIBS = @XSDL_LIBS@ XSELINUX_FALSE = @XSELINUX_FALSE@ XSELINUX_TRUE = @XSELINUX_TRUE@ XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ @@ -502,10 +558,10 @@ X_PRIVSEP_FALSE = @X_PRIVSEP_FALSE@ X_PRIVSEP_TRUE = @X_PRIVSEP_TRUE@ YACC = @YACC@ YFLAGS = @YFLAGS@ +__XCONFIGDIR__ = @__XCONFIGDIR__@ __XCONFIGFILE__ = @__XCONFIGFILE__@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ -abi_font = @abi_font@ abi_videodrv = @abi_videodrv@ abi_xinput = @abi_xinput@ ac_ct_CC = @ac_ct_CC@ @@ -560,15 +616,24 @@ psdir = @psdir@ sbindir = @sbindir@ sdkdir = @sdkdir@ sharedstatedir = @sharedstatedir@ +symbol_visibility = @symbol_visibility@ sysconfdir = @sysconfdir@ +sysconfigdir = @sysconfigdir@ target_alias = @target_alias@ -AM_CFLAGS = @DIX_CFLAGS@ $(am__append_1) -noinst_LIBRARIES = libconfig.a -libconfig_a_SOURCES = config.c config-backends.h $(am__append_2) \ - $(am__append_3) $(am__append_4) -@CONFIG_DBUS_API_TRUE@dbusconfigdir = $(sysconfdir)/dbus-1/system.d -@CONFIG_DBUS_API_TRUE@dbusconfig_DATA = xorg-server.conf -EXTRA_DIST = xorg-server.conf x11-input.fdi +AM_CFLAGS = $(DIX_CFLAGS) $(am__append_1) $(am__append_3) \ + $(am__append_6) +noinst_LTLIBRARIES = libconfig.la +libconfig_la_SOURCES = config.c config-backends.h $(am__append_2) \ + $(am__append_4) $(am__append_5) $(am__append_7) +@CONFIG_NEED_DBUS_TRUE@@CONFIG_UDEV_FALSE@libconfig_la_LIBADD = \ +@CONFIG_NEED_DBUS_TRUE@@CONFIG_UDEV_FALSE@ $(DBUS_LIBS) \ +@CONFIG_NEED_DBUS_TRUE@@CONFIG_UDEV_FALSE@ $(am__append_8) +@CONFIG_UDEV_TRUE@libconfig_la_LIBADD = $(UDEV_LIBS) $(am__append_8) +@CONFIG_UDEV_TRUE@xorgconfddir = $(datadir)/X11/$(XF86CONFIGDIR) +@CONFIG_UDEV_TRUE@xorgconfd_DATA = 10-evdev.conf +@CONFIG_DBUS_API_TRUE@@CONFIG_NEED_DBUS_TRUE@@CONFIG_UDEV_FALSE@dbusconfigdir = $(sysconfdir)/dbus-1/system.d +@CONFIG_DBUS_API_TRUE@@CONFIG_NEED_DBUS_TRUE@@CONFIG_UDEV_FALSE@dbusconfig_DATA = xorg-server.conf +EXTRA_DIST = xorg-server.conf x11-input.fdi 10-evdev.conf all: all-am .SUFFIXES: @@ -603,12 +668,16 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -clean-noinstLIBRARIES: - -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) -libconfig.a: $(libconfig_a_OBJECTS) $(libconfig_a_DEPENDENCIES) - -rm -f libconfig.a - $(libconfig_a_AR) libconfig.a $(libconfig_a_OBJECTS) $(libconfig_a_LIBADD) - $(RANLIB) libconfig.a +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libconfig.la: $(libconfig_la_OBJECTS) $(libconfig_la_DEPENDENCIES) + $(LINK) $(libconfig_la_LDFLAGS) $(libconfig_la_OBJECTS) $(libconfig_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -616,10 +685,11 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/config.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dbus-core.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dbus.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hal.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/config.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dbus-core.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dbus.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hal.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/udev.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @@ -668,6 +738,23 @@ uninstall-dbusconfigDATA: echo " rm -f '$(DESTDIR)$(dbusconfigdir)/$$f'"; \ rm -f "$(DESTDIR)$(dbusconfigdir)/$$f"; \ done +install-xorgconfdDATA: $(xorgconfd_DATA) + @$(NORMAL_INSTALL) + test -z "$(xorgconfddir)" || $(mkdir_p) "$(DESTDIR)$(xorgconfddir)" + @list='$(xorgconfd_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(xorgconfdDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(xorgconfddir)/$$f'"; \ + $(xorgconfdDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(xorgconfddir)/$$f"; \ + done + +uninstall-xorgconfdDATA: + @$(NORMAL_UNINSTALL) + @list='$(xorgconfd_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(xorgconfddir)/$$f'"; \ + rm -f "$(DESTDIR)$(xorgconfddir)/$$f"; \ + done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ @@ -746,9 +833,9 @@ distdir: $(DISTFILES) done check-am: all-am check: check-am -all-am: Makefile $(LIBRARIES) $(DATA) +all-am: Makefile $(LTLIBRARIES) $(DATA) installdirs: - for dir in "$(DESTDIR)$(dbusconfigdir)"; do \ + for dir in "$(DESTDIR)$(dbusconfigdir)" "$(DESTDIR)$(xorgconfddir)"; do \ test -z "$$dir" || $(mkdir_p) "$$dir"; \ done install: install-am @@ -777,7 +864,7 @@ maintainer-clean-generic: @echo "it deletes files that may require special tools to rebuild." clean: clean-am -clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \ +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am @@ -796,7 +883,7 @@ info: info-am info-am: -install-data-am: install-dbusconfigDATA +install-data-am: install-dbusconfigDATA install-xorgconfdDATA install-exec-am: @@ -824,20 +911,22 @@ ps: ps-am ps-am: -uninstall-am: uninstall-dbusconfigDATA uninstall-info-am +uninstall-am: uninstall-dbusconfigDATA uninstall-info-am \ + uninstall-xorgconfdDATA .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLIBRARIES ctags distclean \ + clean-libtool clean-noinstLTLIBRARIES ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am \ install-dbusconfigDATA install-exec install-exec-am \ install-info install-info-am install-man install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am uninstall-dbusconfigDATA \ - uninstall-info-am + install-xorgconfdDATA installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-dbusconfigDATA uninstall-info-am \ + uninstall-xorgconfdDATA # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/xserver/config/config-backends.h b/xserver/config/config-backends.h index 907e86b9c..0a2a22af0 100644 --- a/xserver/config/config-backends.h +++ b/xserver/config/config-backends.h @@ -26,8 +26,18 @@ #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif +#include "input.h" -#ifdef CONFIG_NEED_DBUS +void remove_devices(const char *backend, const char *config_info); +BOOL device_is_duplicate(const char *config_info); +void add_option(InputOption **options, const char *key, const char *value); + +#ifdef CONFIG_UDEV +int config_udev_init(void); +void config_udev_fini(void); +#else + +# ifdef CONFIG_NEED_DBUS #include <dbus/dbus.h> typedef void (*config_dbus_core_connect_hook)(DBusConnection *connection, @@ -46,14 +56,15 @@ int config_dbus_core_init(void); void config_dbus_core_fini(void); int config_dbus_core_add_hook(struct config_dbus_core_hook *hook); void config_dbus_core_remove_hook(struct config_dbus_core_hook *hook); -#endif +# endif -#ifdef CONFIG_DBUS_API +# ifdef CONFIG_DBUS_API int config_dbus_init(void); void config_dbus_fini(void); -#endif +# endif -#ifdef CONFIG_HAL +# ifdef CONFIG_HAL int config_hal_init(void); void config_hal_fini(void); +# endif #endif diff --git a/xserver/config/config.c b/xserver/config/config.c index 882b699a0..7bf5e4179 100644 --- a/xserver/config/config.c +++ b/xserver/config/config.c @@ -28,13 +28,17 @@ #endif #include "os.h" +#include "inputstr.h" #include "hotplug.h" #include "config-backends.h" void -config_init() +config_init(void) { -#if defined(CONFIG_DBUS_API) || defined(CONFIG_HAL) +#ifdef CONFIG_UDEV + if (!config_udev_init()) + ErrorF("[config] failed to initialise udev\n"); +#elif defined(CONFIG_NEED_DBUS) if (config_dbus_core_init()) { # ifdef CONFIG_DBUS_API if (!config_dbus_init()) @@ -52,9 +56,11 @@ config_init() } void -config_fini() +config_fini(void) { -#if defined(CONFIG_DBUS_API) || defined(CONFIG_HAL) +#if defined(CONFIG_UDEV) + config_udev_fini(); +#elif defined(CONFIG_NEED_DBUS) # ifdef CONFIG_HAL config_hal_fini(); # endif @@ -64,3 +70,70 @@ config_fini() config_dbus_core_fini(); #endif } + +static void +remove_device(const char *backend, DeviceIntPtr dev) +{ + /* this only gets called for devices that have already been added */ + LogMessage(X_INFO, "config/%s: removing device %s\n", backend, dev->name); + + /* Call PIE here so we don't try to dereference a device that's + * already been removed. */ + OsBlockSignals(); + ProcessInputEvents(); + DeleteInputDeviceRequest(dev); + OsReleaseSignals(); +} + +void +remove_devices(const char *backend, const char *config_info) +{ + DeviceIntPtr dev, next; + + for (dev = inputInfo.devices; dev; dev = next) { + next = dev->next; + if (dev->config_info && strcmp(dev->config_info, config_info) == 0) + remove_device(backend, dev); + } + for (dev = inputInfo.off_devices; dev; dev = next) { + next = dev->next; + if (dev->config_info && strcmp(dev->config_info, config_info) == 0) + remove_device(backend, dev); + } +} + +BOOL +device_is_duplicate(const char *config_info) +{ + DeviceIntPtr dev; + + for (dev = inputInfo.devices; dev; dev = dev->next) + { + if (dev->config_info && (strcmp(dev->config_info, config_info) == 0)) + return TRUE; + } + + for (dev = inputInfo.off_devices; dev; dev = dev->next) + { + if (dev->config_info && (strcmp(dev->config_info, config_info) == 0)) + return TRUE; + } + + return FALSE; +} + +void +add_option(InputOption **options, const char *key, const char *value) +{ + if (!value || *value == '\0') + return; + + for (; *options; options = &(*options)->next) + ; + *options = xcalloc(sizeof(**options), 1); + if (!*options) /* Yeesh. */ + return; + (*options)->key = xstrdup(key); + (*options)->value = xstrdup(value); + (*options)->next = NULL; +} diff --git a/xserver/config/dbus-core.c b/xserver/config/dbus-core.c index b349c6e3c..4c5e10f51 100644 --- a/xserver/config/dbus-core.c +++ b/xserver/config/dbus-core.c @@ -27,7 +27,6 @@ #include <dix-config.h> #endif -#define DBUS_API_SUBJECT_TO_CHANGE #include <dbus/dbus.h> #include <sys/select.h> diff --git a/xserver/config/dbus.c b/xserver/config/dbus.c index cef8ed5db..86d9d287f 100644 --- a/xserver/config/dbus.c +++ b/xserver/config/dbus.c @@ -147,7 +147,7 @@ add_device(DBusMessage *message, DBusMessage *reply, DBusError *error) dbus_message_iter_next(&iter); } - ret = NewInputDeviceRequest(options, &dev); + ret = NewInputDeviceRequest(options, NULL, &dev); if (ret != Success) { DebugF("[config/dbus] NewInputDeviceRequest failed\n"); goto unwind; @@ -175,7 +175,7 @@ add_device(DBusMessage *message, DBusMessage *reply, DBusError *error) unwind: if (ret != Success) { if (dev) - RemoveDevice(dev); + RemoveDevice(dev, TRUE); err = -ret; dbus_message_iter_append_basic(&reply_iter, DBUS_TYPE_INT32, &err); diff --git a/xserver/config/hal.c b/xserver/config/hal.c index 28f55a02f..d3daa84cd 100644 --- a/xserver/config/hal.c +++ b/xserver/config/hal.c @@ -58,25 +58,9 @@ struct xkb_options { char* options; }; - -static void -remove_device(DeviceIntPtr dev) -{ - /* this only gets called for devices that have already been added */ - LogMessage(X_INFO, "config/hal: removing device %s\n", dev->name); - - /* Call PIE here so we don't try to dereference a device that's - * already been removed. */ - OsBlockSignals(); - ProcessInputEvents(); - DeleteInputDeviceRequest(dev); - OsReleaseSignals(); -} - static void device_removed(LibHalContext *ctx, const char *udi) { - DeviceIntPtr dev, next; char *value; value = xalloc(strlen(udi) + 5); /* "hal:" + NULL */ @@ -84,36 +68,11 @@ device_removed(LibHalContext *ctx, const char *udi) return; sprintf(value, "hal:%s", udi); - for (dev = inputInfo.devices; dev; dev = next) { - next = dev->next; - if (dev->config_info && strcmp(dev->config_info, value) == 0) - remove_device(dev); - } - for (dev = inputInfo.off_devices; dev; dev = next) { - next = dev->next; - if (dev->config_info && strcmp(dev->config_info, value) == 0) - remove_device(dev); - } + remove_devices("hal", value); xfree(value); } -static void -add_option(InputOption **options, const char *key, const char *value) -{ - if (!value || *value == '\0') - return; - - for (; *options; options = &(*options)->next) - ; - *options = xcalloc(sizeof(**options), 1); - if (!*options) /* Yeesh. */ - return; - (*options)->key = xstrdup(key); - (*options)->value = xstrdup(value); - (*options)->next = NULL; -} - static char * get_prop_string(LibHalContext *hal_ctx, const char *udi, const char *name) { @@ -166,31 +125,12 @@ get_prop_string_array(LibHalContext *hal_ctx, const char *udi, const char *prop) return ret; } -static BOOL -device_is_duplicate(char *config_info) -{ - DeviceIntPtr dev; - - for (dev = inputInfo.devices; dev; dev = dev->next) - { - if (dev->config_info && (strcmp(dev->config_info, config_info) == 0)) - return TRUE; - } - - for (dev = inputInfo.off_devices; dev; dev = dev->next) - { - if (dev->config_info && (strcmp(dev->config_info, config_info) == 0)) - return TRUE; - } - - return FALSE; -} - static void device_added(LibHalContext *hal_ctx, const char *udi) { char *path = NULL, *driver = NULL, *name = NULL, *config_info = NULL; InputOption *options = NULL, *tmpo = NULL; + InputAttributes attrs = {0}; DeviceIntPtr dev = NULL; DBusError error; struct xkb_options xkb_opts = {0}; @@ -215,10 +155,29 @@ device_added(LibHalContext *hal_ctx, const char *udi) LogMessage(X_WARNING,"config/hal: no driver or path specified for %s\n", udi); goto unwind; } + attrs.device = xstrdup(path); name = get_prop_string(hal_ctx, udi, "info.product"); if (!name) name = xstrdup("(unnamed)"); + else + attrs.product = xstrdup(name); + + attrs.vendor = get_prop_string(hal_ctx, udi, "info.vendor"); + attrs.tags = xstrtokenize(get_prop_string(hal_ctx, udi, "input.tags"), ","); + + if (libhal_device_query_capability(hal_ctx, udi, "input.keys", NULL)) + attrs.flags |= ATTR_KEYBOARD; + if (libhal_device_query_capability(hal_ctx, udi, "input.mouse", NULL)) + attrs.flags |= ATTR_POINTER; + if (libhal_device_query_capability(hal_ctx, udi, "input.joystick", NULL)) + attrs.flags |= ATTR_JOYSTICK; + if (libhal_device_query_capability(hal_ctx, udi, "input.tablet", NULL)) + attrs.flags |= ATTR_TABLET; + if (libhal_device_query_capability(hal_ctx, udi, "input.touchpad", NULL)) + attrs.flags |= ATTR_TOUCHPAD; + if (libhal_device_query_capability(hal_ctx, udi, "input.touchscreen", NULL)) + attrs.flags |= ATTR_TOUCHSCREEN; options = xcalloc(sizeof(*options), 1); if (!options){ @@ -400,7 +359,7 @@ device_added(LibHalContext *hal_ctx, const char *udi) /* this isn't an error, but how else do you output something that the user can see? */ LogMessage(X_INFO, "config/hal: Adding input device %s\n", name); - if ((rc = NewInputDeviceRequest(options, &dev)) != Success) { + if ((rc = NewInputDeviceRequest(options, &attrs, &dev)) != Success) { LogMessage(X_ERROR, "config/hal: NewInputDeviceRequest failed (%d)\n", rc); dev = NULL; goto unwind; @@ -430,6 +389,18 @@ unwind: xfree(tmpo); } + xfree(attrs.product); + xfree(attrs.vendor); + xfree(attrs.device); + if (attrs.tags) { + char **tag = attrs.tags; + while (*tag) { + xfree(*tag); + tag++; + } + xfree(attrs.tags); + } + if (xkb_opts.layout) xfree(xkb_opts.layout); if (xkb_opts.rules) diff --git a/xserver/config/udev.c b/xserver/config/udev.c new file mode 100644 index 000000000..452fb5a8d --- /dev/null +++ b/xserver/config/udev.c @@ -0,0 +1,267 @@ +/* + * Copyright © 2009 Julien Cristau + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Author: Julien Cristau <jcristau@debian.org> + */ + +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#include <libudev.h> + +#include "input.h" +#include "inputstr.h" +#include "hotplug.h" +#include "config-backends.h" +#include "os.h" + +#define UDEV_XKB_PROP_KEY "xkb" + +static struct udev_monitor *udev_monitor; + +static void +device_added(struct udev_device *udev_device) +{ + const char *path, *name = NULL; + char *config_info = NULL; + const char *syspath; + const char *key, *value, *tmp; + InputOption *options = NULL, *tmpo; + InputAttributes attrs = {}; + DeviceIntPtr dev = NULL; + struct udev_list_entry *set, *entry; + struct udev_device *parent; + int rc; + + path = udev_device_get_devnode(udev_device); + + syspath = udev_device_get_syspath(udev_device); + + if (!path || !syspath) + return; + + if (!udev_device_get_property_value(udev_device, "ID_INPUT")) + return; + + options = xcalloc(sizeof(*options), 1); + if (!options) + return; + + options->key = xstrdup("_source"); + options->value = xstrdup("server/udev"); + if (!options->key || !options->value) + goto unwind; + + parent = udev_device_get_parent(udev_device); + if (parent) { + name = udev_device_get_sysattr_value(parent, "name"); + if (!name) + name = udev_device_get_property_value(parent, "NAME"); + } + if (!name) + name = "(unnamed)"; + else + attrs.product = name; + add_option(&options, "name", name); + + add_option(&options, "path", path); + add_option(&options, "device", path); + attrs.device = path; + attrs.tags = xstrtokenize(udev_device_get_property_value(udev_device, "ID_INPUT.tags"), ","); + + config_info = Xprintf("udev:%s", syspath); + if (!config_info) + goto unwind; + + if (device_is_duplicate(config_info)) { + LogMessage(X_WARNING, "config/udev: device %s already added. " + "Ignoring.\n", name); + goto unwind; + } + + set = udev_device_get_properties_list_entry(udev_device); + udev_list_entry_foreach(entry, set) { + key = udev_list_entry_get_name(entry); + if (!key) + continue; + value = udev_list_entry_get_value(entry); + if (!strncasecmp(key, UDEV_XKB_PROP_KEY, + sizeof(UDEV_XKB_PROP_KEY) - 1)) { + tmp = key + sizeof(UDEV_XKB_PROP_KEY) - 1; + if (!strcasecmp(tmp, "rules")) + add_option(&options, "xkb_rules", value); + else if (!strcasecmp(tmp, "layout")) + add_option(&options, "xkb_layout", value); + else if (!strcasecmp(tmp, "variant")) + add_option(&options, "xkb_variant", value); + else if (!strcasecmp(tmp, "model")) + add_option(&options, "xkb_model", value); + else if (!strcasecmp(tmp, "options")) + add_option(&options, "xkb_options", value); + } else if (!strcmp(key, "ID_VENDOR")) { + attrs.vendor = value; + } else if (!strcmp(key, "ID_INPUT_KEY")) { + attrs.flags |= ATTR_KEYBOARD; + } else if (!strcmp(key, "ID_INPUT_MOUSE")) { + attrs.flags |= ATTR_POINTER; + } else if (!strcmp(key, "ID_INPUT_JOYSTICK")) { + attrs.flags |= ATTR_JOYSTICK; + } else if (!strcmp(key, "ID_INPUT_TABLET")) { + attrs.flags |= ATTR_TABLET; + } else if (!strcmp(key, "ID_INPUT_TOUCHPAD")) { + attrs.flags |= ATTR_TOUCHPAD; + } else if (!strcmp(key, "ID_INPUT_TOUCHSCREEN")) { + attrs.flags |= ATTR_TOUCHSCREEN; + } + } + LogMessage(X_INFO, "config/udev: Adding input device %s (%s)\n", + name, path); + rc = NewInputDeviceRequest(options, &attrs, &dev); + if (rc != Success) + goto unwind; + + for (; dev; dev = dev->next) { + xfree(dev->config_info); + dev->config_info = xstrdup(config_info); + } + + unwind: + xfree(config_info); + while (!dev && (tmpo = options)) { + options = tmpo->next; + xfree(tmpo->key); + xfree(tmpo->value); + xfree(tmpo); + } + + if (attrs.tags) { + char **tag = attrs.tags; + while (*tag) { + xfree(*tag); + tag++; + } + xfree(attrs.tags); + } + + return; +} + +static void +device_removed(struct udev_device *device) +{ + char *value; + const char *syspath = udev_device_get_syspath(device); + + value = Xprintf("udev:%s", syspath); + if (!value) + return; + + remove_devices("udev", value); + + xfree(value); +} + +static void +wakeup_handler(pointer data, int err, pointer read_mask) +{ + int udev_fd = udev_monitor_get_fd(udev_monitor); + struct udev_device *udev_device; + const char *action; + + if (err < 0) + return; + + if (FD_ISSET(udev_fd, (fd_set *)read_mask)) { + udev_device = udev_monitor_receive_device(udev_monitor); + if (!udev_device) + return; + action = udev_device_get_action(udev_device); + if (action) { + if (!strcmp(action, "add")) + device_added(udev_device); + else if (!strcmp(action, "remove")) + device_removed(udev_device); + } + udev_device_unref(udev_device); + } +} + +static void +block_handler(pointer data, struct timeval **tv, pointer read_mask) +{ +} + +int +config_udev_init(void) +{ + struct udev *udev; + struct udev_enumerate *enumerate; + struct udev_list_entry *devices, *device; + + udev = udev_new(); + if (!udev) + return 0; + udev_monitor = udev_monitor_new_from_netlink(udev, "udev"); + if (!udev_monitor) + return 0; + + if (udev_monitor_enable_receiving(udev_monitor)) { + ErrorF("config/udev: failed to bind the udev monitor\n"); + return 0; + } + + enumerate = udev_enumerate_new(udev); + if (!enumerate) + return 0; + udev_enumerate_scan_devices(enumerate); + devices = udev_enumerate_get_list_entry(enumerate); + udev_list_entry_foreach(device, devices) { + const char *syspath = udev_list_entry_get_name(device); + struct udev_device *udev_device = udev_device_new_from_syspath(udev, syspath); + device_added(udev_device); + udev_device_unref(udev_device); + } + udev_enumerate_unref(enumerate); + + RegisterBlockAndWakeupHandlers(block_handler, wakeup_handler, NULL); + AddGeneralSocket(udev_monitor_get_fd(udev_monitor)); + + return 1; +} + +void +config_udev_fini(void) +{ + struct udev *udev; + + if (!udev_monitor) + return; + + udev = udev_monitor_get_udev(udev_monitor); + + RemoveGeneralSocket(udev_monitor_get_fd(udev_monitor)); + RemoveBlockAndWakeupHandlers(block_handler, wakeup_handler, udev_monitor); + udev_monitor_unref(udev_monitor); + udev_monitor = NULL; + udev_unref(udev); +} |