aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/config
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/config')
-rw-r--r--xorg-server/config/Makefile.am22
-rw-r--r--xorg-server/config/Makefile.in688
-rw-r--r--xorg-server/config/config-backends.h59
-rw-r--r--xorg-server/config/config.c66
-rw-r--r--xorg-server/config/dbus-core.c248
-rw-r--r--xorg-server/config/dbus.c442
-rw-r--r--xorg-server/config/hal.c560
-rw-r--r--xorg-server/config/x11-input.fdi81
-rw-r--r--xorg-server/config/xorg-server.conf13
9 files changed, 2179 insertions, 0 deletions
diff --git a/xorg-server/config/Makefile.am b/xorg-server/config/Makefile.am
new file mode 100644
index 000000000..056f30ed0
--- /dev/null
+++ b/xorg-server/config/Makefile.am
@@ -0,0 +1,22 @@
+AM_CFLAGS = @DIX_CFLAGS@
+
+noinst_LIBRARIES = libconfig.a
+libconfig_a_SOURCES = config.c config-backends.h
+
+if HAVE_DBUS
+AM_CFLAGS += @DBUS_CFLAGS@
+libconfig_a_SOURCES += dbus-core.c
+endif
+
+if CONFIG_DBUS_API
+dbusconfigdir = $(sysconfdir)/dbus-1/system.d
+dbusconfig_DATA = xorg-server.conf
+
+libconfig_a_SOURCES += dbus.c
+endif
+
+if CONFIG_HAL
+libconfig_a_SOURCES += hal.c
+endif
+
+EXTRA_DIST = xorg-server.conf x11-input.fdi
diff --git a/xorg-server/config/Makefile.in b/xorg-server/config/Makefile.in
new file mode 100644
index 000000000..128607bf6
--- /dev/null
+++ b/xorg-server/config/Makefile.in
@@ -0,0 +1,688 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+@HAVE_DBUS_TRUE@am__append_1 = @DBUS_CFLAGS@
+@HAVE_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
+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__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
+ $(top_builddir)/include/xorg-server.h \
+ $(top_builddir)/include/dix-config.h \
+ $(top_builddir)/include/xgl-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
+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
+@HAVE_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.@am__isrc@ -I$(top_builddir)/include
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libconfig_a_SOURCES)
+DIST_SOURCES = $(am__libconfig_a_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)"
+dbusconfigDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(dbusconfig_DATA)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
+ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+APPDEFAULTDIR = @APPDEFAULTDIR@
+APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APP_MAN_DIR = @APP_MAN_DIR@
+APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASE_FONT_PATH = @BASE_FONT_PATH@
+BUILD_DATE = @BUILD_DATE@
+BUILD_TIME = @BUILD_TIME@
+CC = @CC@
+CCAS = @CCAS@
+CCASDEPMODE = @CCASDEPMODE@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DARWIN_LIBS = @DARWIN_LIBS@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
+DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
+DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DGA_CFLAGS = @DGA_CFLAGS@
+DGA_LIBS = @DGA_LIBS@
+DIX_CFLAGS = @DIX_CFLAGS@
+DLLTOOL = @DLLTOOL@
+DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@
+DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@
+DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@
+DMXMODULES_LIBS = @DMXMODULES_LIBS@
+DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
+DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
+DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
+DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
+DRIPROTO_LIBS = @DRIPROTO_LIBS@
+DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
+DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
+DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
+DSYMUTIL = @DSYMUTIL@
+DTRACE = @DTRACE@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+FILE_MAN_DIR = @FILE_MAN_DIR@
+FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
+FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
+FREETYPE_LIBS = @FREETYPE_LIBS@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
+GLX_DEFINES = @GLX_DEFINES@
+GL_CFLAGS = @GL_CFLAGS@
+GL_LIBS = @GL_LIBS@
+GREP = @GREP@
+HAL_CFLAGS = @HAL_CFLAGS@
+HAL_LIBS = @HAL_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KDRIVE_CFLAGS = @KDRIVE_CFLAGS@
+KDRIVE_INCS = @KDRIVE_INCS@
+KDRIVE_LIBS = @KDRIVE_LIBS@
+KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
+KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
+KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
+LAUNCHD = @LAUNCHD@
+LDFLAGS = @LDFLAGS@
+LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
+LIBDRM_LIBS = @LIBDRM_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIB_MAN_DIR = @LIB_MAN_DIR@
+LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
+LINUXDOC = @LINUXDOC@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+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@
+MKDIR_P = @MKDIR_P@
+MKFONTDIR = @MKFONTDIR@
+MKFONTSCALE = @MKFONTSCALE@
+NMEDIT = @NMEDIT@
+OBJC = @OBJC@
+OBJCCLD = @OBJCCLD@
+OBJCDEPMODE = @OBJCDEPMODE@
+OBJCFLAGS = @OBJCFLAGS@
+OBJCLINK = @OBJCLINK@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
+OPENSSL_LIBS = @OPENSSL_LIBS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
+PCIACCESS_LIBS = @PCIACCESS_LIBS@
+PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PROJECTROOT = @PROJECTROOT@
+PS2PDF = @PS2PDF@
+RANLIB = @RANLIB@
+RAWCPP = @RAWCPP@
+RAWCPPFLAGS = @RAWCPPFLAGS@
+SED = @SED@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@
+SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
+STRIP = @STRIP@
+TSLIB_CFLAGS = @TSLIB_CFLAGS@
+TSLIB_LIBS = @TSLIB_LIBS@
+UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
+VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@
+VENDOR_NAME = @VENDOR_NAME@
+VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
+VENDOR_RELEASE = @VENDOR_RELEASE@
+VERSION = @VERSION@
+X11APP_ARCHS = @X11APP_ARCHS@
+X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
+X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
+XDMCP_CFLAGS = @XDMCP_CFLAGS@
+XDMCP_LIBS = @XDMCP_LIBS@
+XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@
+XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
+XDMX_CFLAGS = @XDMX_CFLAGS@
+XDMX_LIBS = @XDMX_LIBS@
+XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
+XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
+XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
+XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
+XEPHYR_INCS = @XEPHYR_INCS@
+XEPHYR_LIBS = @XEPHYR_LIBS@
+XF86CONFIGFILE = @XF86CONFIGFILE@
+XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
+XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
+XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
+XGLMODULES_LIBS = @XGLMODULES_LIBS@
+XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
+XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
+XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
+XGL_LIBS = @XGL_LIBS@
+XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
+XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
+XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
+XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
+XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@
+XLIB_CFLAGS = @XLIB_CFLAGS@
+XLIB_LIBS = @XLIB_LIBS@
+XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
+XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
+XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
+XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
+XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
+XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
+XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
+XORG_CFLAGS = @XORG_CFLAGS@
+XORG_INCS = @XORG_INCS@
+XORG_LIBS = @XORG_LIBS@
+XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
+XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
+XORG_OS = @XORG_OS@
+XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
+XORG_SYS_LIBS = @XORG_SYS_LIBS@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
+XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
+XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
+XPRINT_CFLAGS = @XPRINT_CFLAGS@
+XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
+XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
+XSDL_INCS = @XSDL_INCS@
+XSDL_LIBS = @XSDL_LIBS@
+XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
+XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
+XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
+XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
+XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
+XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
+XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
+XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
+XWINMODULES_LIBS = @XWINMODULES_LIBS@
+XWIN_LIBS = @XWIN_LIBS@
+XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+driverdir = @driverdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+extdir = @extdir@
+ft_config = @ft_config@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sdkdir = @sdkdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+xglmoduledir = @xglmoduledir@
+xpconfigdir = @xpconfigdir@
+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
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign config/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign config/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(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
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+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@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-dbusconfigDATA: $(dbusconfig_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(dbusconfigdir)" || $(MKDIR_P) "$(DESTDIR)$(dbusconfigdir)"
+ @list='$(dbusconfig_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(dbusconfigDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(dbusconfigdir)/$$f'"; \
+ $(dbusconfigDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(dbusconfigdir)/$$f"; \
+ done
+
+uninstall-dbusconfigDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dbusconfig_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(dbusconfigdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(dbusconfigdir)/$$f"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES) $(DATA)
+installdirs:
+ for dir in "$(DESTDIR)$(dbusconfigdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-dbusconfigDATA
+
+install-dvi: install-dvi-am
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-dbusconfigDATA
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLIBRARIES 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-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am 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
+
+# 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.
+.NOEXPORT:
diff --git a/xorg-server/config/config-backends.h b/xorg-server/config/config-backends.h
new file mode 100644
index 000000000..ce0e5e436
--- /dev/null
+++ b/xorg-server/config/config-backends.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright © 2006-2007 Daniel Stone
+ *
+ * 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: Daniel Stone <daniel@fooishbar.org>
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifdef HAVE_DBUS
+#include <dbus/dbus.h>
+
+typedef void (*config_dbus_core_connect_hook)(DBusConnection *connection,
+ void *data);
+typedef void (*config_dbus_core_disconnect_hook)(void *data);
+
+struct config_dbus_core_hook {
+ config_dbus_core_connect_hook connect;
+ config_dbus_core_disconnect_hook disconnect;
+ void *data;
+
+ struct config_dbus_core_hook *next;
+};
+
+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
+
+#ifdef CONFIG_DBUS_API
+int config_dbus_init(void);
+void config_dbus_fini(void);
+#endif
+
+#ifdef CONFIG_HAL
+int config_hal_init(void);
+void config_hal_fini(void);
+#endif
diff --git a/xorg-server/config/config.c b/xorg-server/config/config.c
new file mode 100644
index 000000000..882b699a0
--- /dev/null
+++ b/xorg-server/config/config.c
@@ -0,0 +1,66 @@
+/*
+ * Copyright © 2006-2007 Daniel Stone
+ *
+ * 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: Daniel Stone <daniel@fooishbar.org>
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "os.h"
+#include "hotplug.h"
+#include "config-backends.h"
+
+void
+config_init()
+{
+#if defined(CONFIG_DBUS_API) || defined(CONFIG_HAL)
+ if (config_dbus_core_init()) {
+# ifdef CONFIG_DBUS_API
+ if (!config_dbus_init())
+ ErrorF("[config] failed to initialise D-Bus API\n");
+# endif
+# ifdef CONFIG_HAL
+ if (!config_hal_init())
+ ErrorF("[config] failed to initialise HAL\n");
+# endif
+ }
+ else {
+ ErrorF("[config] failed to initialise D-Bus core\n");
+ }
+#endif
+}
+
+void
+config_fini()
+{
+#if defined(CONFIG_DBUS_API) || defined(CONFIG_HAL)
+# ifdef CONFIG_HAL
+ config_hal_fini();
+# endif
+# ifdef CONFIG_DBUS_API
+ config_dbus_fini();
+# endif
+ config_dbus_core_fini();
+#endif
+}
diff --git a/xorg-server/config/dbus-core.c b/xorg-server/config/dbus-core.c
new file mode 100644
index 000000000..b349c6e3c
--- /dev/null
+++ b/xorg-server/config/dbus-core.c
@@ -0,0 +1,248 @@
+/*
+ * Copyright © 2006-2007 Daniel Stone
+ *
+ * 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: Daniel Stone <daniel@fooishbar.org>
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#define DBUS_API_SUBJECT_TO_CHANGE
+#include <dbus/dbus.h>
+#include <sys/select.h>
+
+#include "config-backends.h"
+#include "dix.h"
+#include "os.h"
+
+/* How often to attempt reconnecting when we get booted off the bus. */
+#define RECONNECT_DELAY (10 * 1000) /* in ms */
+
+struct dbus_core_info {
+ int fd;
+ DBusConnection *connection;
+ OsTimerPtr timer;
+ struct config_dbus_core_hook *hooks;
+};
+static struct dbus_core_info bus_info;
+
+static CARD32 reconnect_timer(OsTimerPtr timer, CARD32 time, pointer arg);
+
+static void
+wakeup_handler(pointer data, int err, pointer read_mask)
+{
+ struct dbus_core_info *info = data;
+
+ if (info->connection && FD_ISSET(info->fd, (fd_set *) read_mask)) {
+ do {
+ dbus_connection_read_write_dispatch(info->connection, 0);
+ } while (info->connection &&
+ dbus_connection_get_is_connected(info->connection) &&
+ dbus_connection_get_dispatch_status(info->connection) == DBUS_DISPATCH_DATA_REMAINS);
+ }
+}
+
+static void
+block_handler(pointer data, struct timeval **tv, pointer read_mask)
+{
+}
+
+/**
+ * Disconnect (if we haven't already been forcefully disconnected), clean up
+ * after ourselves, and call all registered disconnect hooks.
+ */
+static void
+teardown(void)
+{
+ struct config_dbus_core_hook *hook;
+
+ if (bus_info.timer) {
+ TimerFree(bus_info.timer);
+ bus_info.timer = NULL;
+ }
+
+ /* We should really have pre-disconnect hooks and run them here, for
+ * completeness. But then it gets awkward, given that you can't
+ * guarantee that they'll be called ... */
+ if (bus_info.connection)
+ dbus_connection_unref(bus_info.connection);
+
+ RemoveBlockAndWakeupHandlers(block_handler, wakeup_handler, &bus_info);
+ if (bus_info.fd != -1)
+ RemoveGeneralSocket(bus_info.fd);
+ bus_info.fd = -1;
+ bus_info.connection = NULL;
+
+ for (hook = bus_info.hooks; hook; hook = hook->next) {
+ if (hook->disconnect)
+ hook->disconnect(hook->data);
+ }
+}
+
+/**
+ * This is a filter, which only handles the disconnected signal, which
+ * doesn't go to the normal message handling function. This takes
+ * precedence over the message handling function, so have have to be
+ * careful to ignore anything we don't want to deal with here.
+ */
+static DBusHandlerResult
+message_filter(DBusConnection *connection, DBusMessage *message, void *data)
+{
+ /* If we get disconnected, then take everything down, and attempt to
+ * reconnect immediately (assuming it's just a restart). The
+ * connection isn't valid at this point, so throw it out immediately. */
+ if (dbus_message_is_signal(message, DBUS_INTERFACE_LOCAL,
+ "Disconnected")) {
+ DebugF("[config/dbus-core] disconnected from bus\n");
+ bus_info.connection = NULL;
+ teardown();
+
+ if (bus_info.timer)
+ TimerFree(bus_info.timer);
+ bus_info.timer = TimerSet(NULL, 0, 1, reconnect_timer, NULL);
+
+ return DBUS_HANDLER_RESULT_HANDLED;
+ }
+
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+}
+
+/**
+ * Attempt to connect to the system bus, and set a filter to deal with
+ * disconnection (see message_filter above).
+ *
+ * @return 1 on success, 0 on failure.
+ */
+static int
+connect_to_bus(void)
+{
+ DBusError error;
+ struct config_dbus_core_hook *hook;
+
+ dbus_error_init(&error);
+ bus_info.connection = dbus_bus_get(DBUS_BUS_SYSTEM, &error);
+ if (!bus_info.connection || dbus_error_is_set(&error)) {
+ DebugF("[config/dbus-core] error connecting to system bus: %s (%s)\n",
+ error.name, error.message);
+ goto err_begin;
+ }
+
+ /* Thankyou. Really, thankyou. */
+ dbus_connection_set_exit_on_disconnect(bus_info.connection, FALSE);
+
+ if (!dbus_connection_get_unix_fd(bus_info.connection, &bus_info.fd)) {
+ ErrorF("[config/dbus-core] couldn't get fd for system bus\n");
+ goto err_unref;
+ }
+
+ if (!dbus_connection_add_filter(bus_info.connection, message_filter,
+ &bus_info, NULL)) {
+ ErrorF("[config/dbus-core] couldn't add filter: %s (%s)\n", error.name,
+ error.message);
+ goto err_fd;
+ }
+
+ dbus_error_free(&error);
+ AddGeneralSocket(bus_info.fd);
+
+ RegisterBlockAndWakeupHandlers(block_handler, wakeup_handler, &bus_info);
+
+ for (hook = bus_info.hooks; hook; hook = hook->next) {
+ if (hook->connect)
+ hook->connect(bus_info.connection, hook->data);
+ }
+
+ return 1;
+
+err_fd:
+ bus_info.fd = -1;
+err_unref:
+ dbus_connection_unref(bus_info.connection);
+ bus_info.connection = NULL;
+err_begin:
+ dbus_error_free(&error);
+
+ return 0;
+}
+
+static CARD32
+reconnect_timer(OsTimerPtr timer, CARD32 time, pointer arg)
+{
+ if (connect_to_bus()) {
+ TimerFree(bus_info.timer);
+ bus_info.timer = NULL;
+ return 0;
+ }
+ else {
+ return RECONNECT_DELAY;
+ }
+}
+
+int
+config_dbus_core_add_hook(struct config_dbus_core_hook *hook)
+{
+ struct config_dbus_core_hook **prev;
+
+ for (prev = &bus_info.hooks; *prev; prev = &(*prev)->next)
+ ;
+
+ hook->next = NULL;
+ *prev = hook;
+
+ /* If we're already connected, call the connect hook. */
+ if (bus_info.connection)
+ hook->connect(bus_info.connection, hook->data);
+
+ return 1;
+}
+
+void
+config_dbus_core_remove_hook(struct config_dbus_core_hook *hook)
+{
+ struct config_dbus_core_hook **prev;
+
+ for (prev = &bus_info.hooks; *prev; prev = &(*prev)->next) {
+ if (*prev == hook) {
+ *prev = hook->next;
+ break;
+ }
+ }
+}
+
+int
+config_dbus_core_init(void)
+{
+ memset(&bus_info, 0, sizeof(bus_info));
+ bus_info.fd = -1;
+ bus_info.hooks = NULL;
+ bus_info.connection = NULL;
+ bus_info.timer = TimerSet(NULL, 0, 1, reconnect_timer, NULL);
+
+ return 1;
+}
+
+void
+config_dbus_core_fini(void)
+{
+ teardown();
+}
diff --git a/xorg-server/config/dbus.c b/xorg-server/config/dbus.c
new file mode 100644
index 000000000..cef8ed5db
--- /dev/null
+++ b/xorg-server/config/dbus.c
@@ -0,0 +1,442 @@
+/*
+ * Copyright © 2006-2007 Daniel Stone
+ *
+ * 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: Daniel Stone <daniel@fooishbar.org>
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#define DBUS_API_SUBJECT_TO_CHANGE
+#include <dbus/dbus.h>
+#include <string.h>
+
+#include <X11/X.h>
+
+#include "config-backends.h"
+#include "opaque.h" /* for 'display': there should be a better way. */
+#include "input.h"
+#include "inputstr.h"
+
+#define API_VERSION 2
+
+#define MATCH_RULE "type='method_call',interface='org.x.config.input'"
+
+#define MALFORMED_MSG "[config/dbus] malformed message, dropping"
+#define MALFORMED_MESSAGE() { DebugF(MALFORMED_MSG "\n"); \
+ ret = BadValue; \
+ goto unwind; }
+#define MALFORMED_MESSAGE_ERROR() { DebugF(MALFORMED_MSG ": %s, %s", \
+ error->name, error->message); \
+ ret = BadValue; \
+ goto unwind; }
+
+struct connection_info {
+ char busobject[32];
+ char busname[64];
+ DBusConnection *connection;
+};
+
+static void
+reset_info(struct connection_info *info)
+{
+ info->connection = NULL;
+ info->busname[0] = '\0';
+ info->busobject[0] = '\0';
+}
+
+static int
+add_device(DBusMessage *message, DBusMessage *reply, DBusError *error)
+{
+ DBusMessageIter iter, reply_iter, subiter;
+ InputOption *tmpo = NULL, *options = NULL;
+ char *tmp = NULL;
+ int ret, err;
+ DeviceIntPtr dev = NULL;
+
+ dbus_message_iter_init_append(reply, &reply_iter);
+
+ if (!dbus_message_iter_init(message, &iter)) {
+ ErrorF("[config/dbus] couldn't initialise iterator\n");
+ MALFORMED_MESSAGE();
+ }
+
+ options = xcalloc(sizeof(*options), 1);
+ if (!options) {
+ ErrorF("[config/dbus] couldn't allocate option\n");
+ return BadAlloc;
+ }
+
+ options->key = xstrdup("_source");
+ options->value = xstrdup("client/dbus");
+ if (!options->key || !options->value) {
+ ErrorF("[config/dbus] couldn't allocate first key/value pair\n");
+ ret = BadAlloc;
+ goto unwind;
+ }
+
+ /* signature should be [ss][ss]... */
+ while (dbus_message_iter_get_arg_type(&iter) == DBUS_TYPE_ARRAY) {
+ tmpo = xcalloc(sizeof(*tmpo), 1);
+ if (!tmpo) {
+ ErrorF("[config/dbus] couldn't allocate option\n");
+ ret = BadAlloc;
+ goto unwind;
+ }
+ tmpo->next = options;
+ options = tmpo;
+
+ dbus_message_iter_recurse(&iter, &subiter);
+
+ if (dbus_message_iter_get_arg_type(&subiter) != DBUS_TYPE_STRING)
+ MALFORMED_MESSAGE();
+
+ dbus_message_iter_get_basic(&subiter, &tmp);
+ if (!tmp)
+ MALFORMED_MESSAGE();
+ /* The _ prefix refers to internal settings, and may not be given by
+ * the client. */
+ if (tmp[0] == '_') {
+ ErrorF("[config/dbus] attempted subterfuge: option name %s given\n",
+ tmp);
+ MALFORMED_MESSAGE();
+ }
+ options->key = xstrdup(tmp);
+ if (!options->key) {
+ ErrorF("[config/dbus] couldn't duplicate key!\n");
+ ret = BadAlloc;
+ goto unwind;
+ }
+
+ if (!dbus_message_iter_has_next(&subiter))
+ MALFORMED_MESSAGE();
+ dbus_message_iter_next(&subiter);
+ if (dbus_message_iter_get_arg_type(&subiter) != DBUS_TYPE_STRING)
+ MALFORMED_MESSAGE();
+
+ dbus_message_iter_get_basic(&subiter, &tmp);
+ if (!tmp)
+ MALFORMED_MESSAGE();
+ options->value = xstrdup(tmp);
+ if (!options->value) {
+ ErrorF("[config/dbus] couldn't duplicate option!\n");
+ ret = BadAlloc;
+ goto unwind;
+ }
+
+ dbus_message_iter_next(&iter);
+ }
+
+ ret = NewInputDeviceRequest(options, &dev);
+ if (ret != Success) {
+ DebugF("[config/dbus] NewInputDeviceRequest failed\n");
+ goto unwind;
+ }
+
+ if (!dev) {
+ DebugF("[config/dbus] NewInputDeviceRequest provided no device\n");
+ ret = BadImplementation;
+ goto unwind;
+ }
+
+ /* XXX: If we fail halfway through, we don't seem to have any way to
+ * empty the iterator, so you'll end up with some device IDs,
+ * plus an error. This seems to be a shortcoming in the D-Bus
+ * API. */
+ for (; dev; dev = dev->next) {
+ if (!dbus_message_iter_append_basic(&reply_iter, DBUS_TYPE_INT32,
+ &dev->id)) {
+ ErrorF("[config/dbus] couldn't append to iterator\n");
+ ret = BadAlloc;
+ goto unwind;
+ }
+ }
+
+unwind:
+ if (ret != Success) {
+ if (dev)
+ RemoveDevice(dev);
+
+ err = -ret;
+ dbus_message_iter_append_basic(&reply_iter, DBUS_TYPE_INT32, &err);
+ }
+
+ while (options) {
+ tmpo = options;
+ options = options->next;
+ if (tmpo->key)
+ xfree(tmpo->key);
+ if (tmpo->value)
+ xfree(tmpo->value);
+ xfree(tmpo);
+ }
+
+ return ret;
+}
+
+static int
+remove_device(DBusMessage *message, DBusMessage *reply, DBusError *error)
+{
+ int deviceid, ret, err;
+ DeviceIntPtr dev;
+ DBusMessageIter iter, reply_iter;
+
+ dbus_message_iter_init_append(reply, &reply_iter);
+
+ if (!dbus_message_iter_init(message, &iter)) {
+ ErrorF("[config/dbus] failed to init iterator\n");
+ MALFORMED_MESSAGE();
+ }
+
+ if (!dbus_message_get_args(message, error, DBUS_TYPE_UINT32,
+ &deviceid, DBUS_TYPE_INVALID)) {
+ MALFORMED_MESSAGE_ERROR();
+ }
+
+ dixLookupDevice(&dev, deviceid, serverClient, DixDestroyAccess);
+ if (!dev) {
+ DebugF("[config/dbus] bogus device id %d given\n", deviceid);
+ ret = BadMatch;
+ goto unwind;
+ }
+
+ DebugF("[config/dbus] removing device %s (id %d)\n", dev->name, deviceid);
+
+ /* Call PIE here so we don't try to dereference a device that's
+ * already been removed. */
+ OsBlockSignals();
+ ProcessInputEvents();
+ DeleteInputDeviceRequest(dev);
+ OsReleaseSignals();
+
+ ret = Success;
+
+unwind:
+ err = (ret == Success) ? ret : -ret;
+ dbus_message_iter_append_basic(&reply_iter, DBUS_TYPE_INT32, &err);
+
+ return ret;
+}
+
+static int
+list_devices(DBusMessage *message, DBusMessage *reply, DBusError *error)
+{
+ DeviceIntPtr dev;
+ DBusMessageIter iter, subiter;
+
+ dbus_message_iter_init_append(reply, &iter);
+
+ for (dev = inputInfo.devices; dev; dev = dev->next) {
+ if (!dbus_message_iter_open_container(&iter, DBUS_TYPE_STRUCT, NULL,
+ &subiter)) {
+ ErrorF("[config/dbus] couldn't init container\n");
+ return BadAlloc;
+ }
+ if (!dbus_message_iter_append_basic(&subiter, DBUS_TYPE_UINT32,
+ &dev->id)) {
+ ErrorF("[config/dbus] couldn't append to iterator\n");
+ return BadAlloc;
+ }
+ if (!dbus_message_iter_append_basic(&subiter, DBUS_TYPE_STRING,
+ &dev->name)) {
+ ErrorF("[config/dbus] couldn't append to iterator\n");
+ return BadAlloc;
+ }
+ if (!dbus_message_iter_close_container(&iter, &subiter)) {
+ ErrorF("[config/dbus] couldn't close container\n");
+ return BadAlloc;
+ }
+ }
+
+ return Success;
+}
+
+static int
+get_version(DBusMessage *message, DBusMessage *reply, DBusError *error)
+{
+ DBusMessageIter iter;
+ unsigned int version = API_VERSION;
+
+ dbus_message_iter_init_append(reply, &iter);
+ if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_UINT32, &version)) {
+ ErrorF("[config/dbus] couldn't append version\n");
+ return BadAlloc;
+ }
+
+ return Success;
+}
+
+static DBusHandlerResult
+message_handler(DBusConnection *connection, DBusMessage *message, void *data)
+{
+ DBusError error;
+ DBusMessage *reply;
+ struct connection_info *info = data;
+
+ /* ret is the overall D-Bus handler result, whereas err is the internal
+ * X error from our individual functions. */
+ int ret = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ int err;
+
+ DebugF("[config/dbus] received a message for %s\n",
+ dbus_message_get_interface(message));
+
+ dbus_error_init(&error);
+
+ reply = dbus_message_new_method_return(message);
+ if (!reply) {
+ ErrorF("[config/dbus] failed to create reply\n");
+ ret = DBUS_HANDLER_RESULT_NEED_MEMORY;
+ goto err_start;
+ }
+
+ if (strcmp(dbus_message_get_member(message), "add") == 0)
+ err = add_device(message, reply, &error);
+ else if (strcmp(dbus_message_get_member(message), "remove") == 0)
+ err = remove_device(message, reply, &error);
+ else if (strcmp(dbus_message_get_member(message), "listDevices") == 0)
+ err = list_devices(message, reply, &error);
+ else if (strcmp(dbus_message_get_member(message), "version") == 0)
+ err = get_version(message, reply, &error);
+ else
+ goto err_reply;
+
+ /* Failure to allocate is a special case. */
+ if (err == BadAlloc) {
+ ret = DBUS_HANDLER_RESULT_NEED_MEMORY;
+ goto err_reply;
+ }
+
+ /* While failure here is always an OOM, we don't return that,
+ * since that would result in devices being double-added/removed. */
+ if (dbus_connection_send(info->connection, reply, NULL))
+ dbus_connection_flush(info->connection);
+ else
+ ErrorF("[config/dbus] failed to send reply\n");
+
+ ret = DBUS_HANDLER_RESULT_HANDLED;
+
+err_reply:
+ dbus_message_unref(reply);
+err_start:
+ dbus_error_free(&error);
+
+ return ret;
+}
+
+static void
+connect_hook(DBusConnection *connection, void *data)
+{
+ DBusError error;
+ DBusObjectPathVTable vtable = { .message_function = message_handler, };
+ struct connection_info *info = data;
+
+ info->connection = connection;
+
+ dbus_error_init(&error);
+
+ dbus_bus_request_name(info->connection, info->busname, 0, &error);
+ if (dbus_error_is_set(&error)) {
+ ErrorF("[config/dbus] couldn't take over org.x.config: %s (%s)\n",
+ error.name, error.message);
+ goto err_start;
+ }
+
+ /* blocks until we get a reply. */
+ dbus_bus_add_match(info->connection, MATCH_RULE, &error);
+ if (dbus_error_is_set(&error)) {
+ ErrorF("[config/dbus] couldn't add match: %s (%s)\n", error.name,
+ error.message);
+ goto err_name;
+ }
+
+ if (!dbus_connection_register_object_path(info->connection,
+ info->busobject, &vtable,
+ info)) {
+ ErrorF("[config/dbus] couldn't register object path\n");
+ goto err_match;
+ }
+
+ DebugF("[dbus] registered %s, %s\n", info->busname, info->busobject);
+
+ dbus_error_free(&error);
+
+ return;
+
+err_match:
+ dbus_bus_remove_match(info->connection, MATCH_RULE, &error);
+err_name:
+ dbus_bus_release_name(info->connection, info->busname, &error);
+err_start:
+ dbus_error_free(&error);
+
+ reset_info(info);
+}
+
+static void
+disconnect_hook(void *data)
+{
+}
+
+#if 0
+void
+pre_disconnect_hook(void)
+{
+ DBusError error;
+
+ dbus_error_init(&error);
+ dbus_connection_unregister_object_path(connection_data->connection,
+ connection_data->busobject);
+ dbus_bus_remove_match(connection_data->connection, MATCH_RULE,
+ &error);
+ dbus_bus_release_name(connection_data->connection,
+ connection_data->busname, &error);
+ dbus_error_free(&error);
+}
+#endif
+
+static struct connection_info connection_data;
+static struct config_dbus_core_hook core_hook = {
+ .connect = connect_hook,
+ .disconnect = disconnect_hook,
+ .data = &connection_data,
+};
+
+int
+config_dbus_init(void)
+{
+ snprintf(connection_data.busname, sizeof(connection_data.busname),
+ "org.x.config.display%d", atoi(display));
+ snprintf(connection_data.busobject, sizeof(connection_data.busobject),
+ "/org/x/config/%d", atoi(display));
+
+ return config_dbus_core_add_hook(&core_hook);
+}
+
+void
+config_dbus_fini(void)
+{
+ config_dbus_core_remove_hook(&core_hook);
+ connection_data.busname[0] = '\0';
+ connection_data.busobject[0] = '\0';
+}
diff --git a/xorg-server/config/hal.c b/xorg-server/config/hal.c
new file mode 100644
index 000000000..639e0ec2b
--- /dev/null
+++ b/xorg-server/config/hal.c
@@ -0,0 +1,560 @@
+/*
+ * Copyright © 2007 Daniel Stone
+ * Copyright © 2007 Red Hat, Inc.
+ *
+ * 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: Daniel Stone <daniel@fooishbar.org>
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <dbus/dbus.h>
+#include <hal/libhal.h>
+#include <string.h>
+#include <sys/select.h>
+
+#include "input.h"
+#include "inputstr.h"
+#include "hotplug.h"
+#include "config-backends.h"
+#include "os.h"
+
+
+#define LIBHAL_PROP_KEY "input.x11_options."
+#define LIBHAL_XKB_PROP_KEY "input.xkb."
+
+
+struct config_hal_info {
+ DBusConnection *system_bus;
+ LibHalContext *hal_ctx;
+};
+
+/* Used for special handling of xkb options. */
+struct xkb_options {
+ char* layout;
+ char* model;
+ char* rules;
+ char* variant;
+ 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 */
+ if (!value)
+ 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);
+ }
+
+ 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)
+{
+ char *prop, *ret;
+
+ prop = libhal_device_get_property_string(hal_ctx, udi, name, NULL);
+ LogMessageVerb(X_INFO, 10, "config/hal: getting %s on %s returned %s\n", name, udi, prop);
+ if (prop) {
+ ret = xstrdup(prop);
+ libhal_free_string(prop);
+ }
+ else {
+ return NULL;
+ }
+
+ return ret;
+}
+
+static char *
+get_prop_string_array(LibHalContext *hal_ctx, const char *udi, const char *prop)
+{
+ char **props, *ret, *str;
+ int i, len = 0;
+
+ props = libhal_device_get_property_strlist(hal_ctx, udi, prop, NULL);
+ if (props) {
+ for (i = 0; props[i]; i++)
+ len += strlen(props[i]);
+
+ ret = xcalloc(sizeof(char), len + i); /* i - 1 commas, 1 NULL */
+ if (!ret) {
+ libhal_free_string_array(props);
+ return NULL;
+ }
+
+ str = ret;
+ for (i = 0; props[i]; i++) {
+ strcpy(str, props[i]);
+ str += strlen(props[i]);
+ *str++ = ',';
+ }
+ *(str-1) = '\0';
+
+ libhal_free_string_array(props);
+ }
+ else {
+ return NULL;
+ }
+
+ 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;
+ DeviceIntPtr dev;
+ DBusError error;
+ struct xkb_options xkb_opts = {0};
+
+ LibHalPropertySet *set = NULL;
+ LibHalPropertySetIterator set_iter;
+ char *psi_key = NULL, *tmp_val;
+
+
+ dbus_error_init(&error);
+
+ driver = get_prop_string(hal_ctx, udi, "input.x11_driver");
+ if (!driver){
+ /* verbose, don't tell the user unless they _want_ to see it */
+ LogMessageVerb(X_INFO,7,"config/hal: no driver specified for device %s\n", udi);
+ goto unwind;
+ }
+
+ path = get_prop_string(hal_ctx, udi, "input.device");
+ if (!path) {
+ LogMessage(X_WARNING,"config/hal: no driver or path specified for %s\n", udi);
+ goto unwind;
+ }
+
+ name = get_prop_string(hal_ctx, udi, "info.product");
+ if (!name)
+ name = xstrdup("(unnamed)");
+
+ options = xcalloc(sizeof(*options), 1);
+ if (!options){
+ LogMessage(X_ERROR, "config/hal: couldn't allocate space for input options!\n");
+ goto unwind;
+ }
+
+ options->key = xstrdup("_source");
+ options->value = xstrdup("server/hal");
+ if (!options->key || !options->value) {
+ LogMessage(X_ERROR, "config/hal: couldn't allocate first key/value pair\n");
+ goto unwind;
+ }
+
+ /* most drivers use device.. not path. evdev uses both however, but the
+ * path version isn't documented apparently. support both for now. */
+ add_option(&options, "path", path);
+ add_option(&options, "device", path);
+
+ add_option(&options, "driver", driver);
+ add_option(&options, "name", name);
+
+ config_info = xalloc(strlen(udi) + 5); /* "hal:" and NULL */
+ if (!config_info) {
+ LogMessage(X_ERROR, "config/hal: couldn't allocate name\n");
+ goto unwind;
+ }
+ sprintf(config_info, "hal:%s", udi);
+
+ /* Check for duplicate devices */
+ if (device_is_duplicate(config_info))
+ {
+ LogMessage(X_WARNING, "config/hal: device %s already added. Ignoring.\n", name);
+ goto unwind;
+ }
+
+ /* ok, grab options from hal.. iterate through all properties
+ * and lets see if any of them are options that we can add */
+ set = libhal_device_get_all_properties(hal_ctx, udi, &error);
+
+ if (!set) {
+ LogMessage(X_ERROR, "config/hal: couldn't get property list for %s: %s (%s)\n",
+ udi, error.name, error.message);
+ goto unwind;
+ }
+
+ libhal_psi_init(&set_iter,set);
+ while (libhal_psi_has_more(&set_iter)) {
+ /* we are looking for supported keys.. extract and add to options */
+ psi_key = libhal_psi_get_key(&set_iter);
+
+ if (psi_key){
+
+ /* normal options first (input.x11_options.<propname>) */
+ if (!strncasecmp(psi_key, LIBHAL_PROP_KEY, sizeof(LIBHAL_PROP_KEY)-1)){
+ char* tmp;
+
+ /* only support strings for all values */
+ tmp_val = get_prop_string(hal_ctx, udi, psi_key);
+
+ if (tmp_val){
+
+ /* xkb needs special handling. HAL specs include
+ * input.xkb.xyz options, but the x11-input.fdi specifies
+ * input.x11_options.Xkbxyz options. By default, we use
+ * the former, unless the specific X11 ones are specified.
+ * Since we can't predict the order in which the keys
+ * arrive, we need to store them.
+ */
+ if ((tmp = strcasestr(psi_key, "xkb")) && strlen(tmp) >= 4)
+ {
+ if (!strcasecmp(&tmp[3], "layout"))
+ {
+ if (xkb_opts.layout)
+ xfree(xkb_opts.layout);
+ xkb_opts.layout = strdup(tmp_val);
+ } else if (!strcasecmp(&tmp[3], "model"))
+ {
+ if (xkb_opts.model)
+ xfree(xkb_opts.model);
+ xkb_opts.model = strdup(tmp_val);
+ } else if (!strcasecmp(&tmp[3], "rules"))
+ {
+ if (xkb_opts.rules)
+ xfree(xkb_opts.rules);
+ xkb_opts.rules = strdup(tmp_val);
+ } else if (!strcasecmp(&tmp[3], "variant"))
+ {
+ if (xkb_opts.variant)
+ xfree(xkb_opts.variant);
+ xkb_opts.variant = strdup(tmp_val);
+ } else if (!strcasecmp(&tmp[3], "options"))
+ {
+ if (xkb_opts.options)
+ xfree(xkb_opts.options);
+ xkb_opts.options = strdup(tmp_val);
+ }
+ } else
+ {
+ /* all others */
+ add_option(&options, psi_key + sizeof(LIBHAL_PROP_KEY)-1, tmp_val);
+ xfree(tmp_val);
+ }
+ } else
+ {
+ /* server 1.4 had xkb_options as strlist. */
+ if ((tmp = strcasestr(psi_key, "xkb")) &&
+ (strlen(tmp) >= 4) &&
+ (!strcasecmp(&tmp[3], "options")) &&
+ (tmp_val = get_prop_string_array(hal_ctx, udi, psi_key)))
+ {
+ if (xkb_opts.options)
+ xfree(xkb_opts.options);
+ xkb_opts.options = strdup(tmp_val);
+ }
+ }
+ } else if (!strncasecmp(psi_key, LIBHAL_XKB_PROP_KEY, sizeof(LIBHAL_XKB_PROP_KEY)-1)){
+ char* tmp;
+
+ /* only support strings for all values */
+ tmp_val = get_prop_string(hal_ctx, udi, psi_key);
+
+ if (tmp_val && strlen(psi_key) >= sizeof(LIBHAL_XKB_PROP_KEY)) {
+
+ tmp = &psi_key[sizeof(LIBHAL_XKB_PROP_KEY) - 1];
+
+ if (!strcasecmp(tmp, "layout"))
+ {
+ if (!xkb_opts.layout)
+ xkb_opts.layout = strdup(tmp_val);
+ } else if (!strcasecmp(tmp, "rules"))
+ {
+ if (!xkb_opts.rules)
+ xkb_opts.rules = strdup(tmp_val);
+ } else if (!strcasecmp(tmp, "variant"))
+ {
+ if (!xkb_opts.variant)
+ xkb_opts.variant = strdup(tmp_val);
+ } else if (!strcasecmp(tmp, "model"))
+ {
+ if (!xkb_opts.model)
+ xkb_opts.model = strdup(tmp_val);
+ } else if (!strcasecmp(tmp, "options"))
+ {
+ if (!xkb_opts.options)
+ xkb_opts.options = strdup(tmp_val);
+ }
+ xfree(tmp_val);
+ } else
+ {
+ /* server 1.4 had xkb options as strlist */
+ tmp_val = get_prop_string_array(hal_ctx, udi, psi_key);
+ if (tmp_val && strlen(psi_key) >= sizeof(LIBHAL_XKB_PROP_KEY))
+ {
+ tmp = &psi_key[sizeof(LIBHAL_XKB_PROP_KEY) - 1];
+ if (!strcasecmp(tmp, ".options") && (!xkb_opts.options))
+ xkb_opts.options = strdup(tmp_val);
+ }
+ }
+ }
+ }
+
+ /* psi_key doesn't need to be freed */
+ libhal_psi_next(&set_iter);
+ }
+
+
+ /* Now add xkb options */
+ if (xkb_opts.layout)
+ add_option(&options, "xkb_layout", xkb_opts.layout);
+ if (xkb_opts.rules)
+ add_option(&options, "xkb_rules", xkb_opts.rules);
+ if (xkb_opts.variant)
+ add_option(&options, "xkb_variant", xkb_opts.variant);
+ if (xkb_opts.model)
+ add_option(&options, "xkb_model", xkb_opts.model);
+ if (xkb_opts.options)
+ add_option(&options, "xkb_options", xkb_opts.options);
+
+ /* 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 (NewInputDeviceRequest(options, &dev) != Success) {
+ LogMessage(X_ERROR, "config/hal: NewInputDeviceRequest failed\n");
+ dev = NULL;
+ goto unwind;
+ }
+
+ for (; dev; dev = dev->next){
+ if (dev->config_info)
+ xfree(dev->config_info);
+ dev->config_info = xstrdup(config_info);
+ }
+
+unwind:
+ if (set)
+ libhal_free_property_set(set);
+ if (path)
+ xfree(path);
+ if (driver)
+ xfree(driver);
+ if (name)
+ xfree(name);
+ if (config_info)
+ xfree(config_info);
+ while (!dev && (tmpo = options)) {
+ options = tmpo->next;
+ xfree(tmpo->key);
+ xfree(tmpo->value);
+ xfree(tmpo);
+ }
+
+ if (xkb_opts.layout)
+ xfree(xkb_opts.layout);
+ if (xkb_opts.rules)
+ xfree(xkb_opts.rules);
+ if (xkb_opts.model)
+ xfree(xkb_opts.model);
+ if (xkb_opts.variant)
+ xfree(xkb_opts.variant);
+ if (xkb_opts.options)
+ xfree(xkb_opts.options);
+
+ dbus_error_free(&error);
+
+ return;
+}
+
+static void
+disconnect_hook(void *data)
+{
+ DBusError error;
+ struct config_hal_info *info = data;
+
+ if (info->hal_ctx) {
+ if (dbus_connection_get_is_connected(info->system_bus)) {
+ dbus_error_init(&error);
+ if (!libhal_ctx_shutdown(info->hal_ctx, &error))
+ LogMessage(X_WARNING, "config/hal: disconnect_hook couldn't shut down context: %s (%s)\n",
+ error.name, error.message);
+ dbus_error_free(&error);
+ }
+ libhal_ctx_free(info->hal_ctx);
+ }
+
+ info->hal_ctx = NULL;
+ info->system_bus = NULL;
+}
+
+static void
+connect_hook(DBusConnection *connection, void *data)
+{
+ DBusError error;
+ struct config_hal_info *info = data;
+ char **devices;
+ int num_devices, i;
+
+ info->system_bus = connection;
+
+ dbus_error_init(&error);
+
+ if (!info->hal_ctx)
+ info->hal_ctx = libhal_ctx_new();
+ if (!info->hal_ctx) {
+ LogMessage(X_ERROR, "config/hal: couldn't create HAL context\n");
+ goto out_err;
+ }
+
+ if (!libhal_ctx_set_dbus_connection(info->hal_ctx, info->system_bus)) {
+ LogMessage(X_ERROR, "config/hal: couldn't associate HAL context with bus\n");
+ goto out_ctx;
+ }
+ if (!libhal_ctx_init(info->hal_ctx, &error)) {
+ LogMessage(X_ERROR, "config/hal: couldn't initialise context: %s (%s)\n",
+ error.name, error.message);
+ goto out_ctx;
+ }
+ if (!libhal_device_property_watch_all(info->hal_ctx, &error)) {
+ LogMessage(X_ERROR, "config/hal: couldn't watch all properties: %s (%s)\n",
+ error.name, error.message);
+ goto out_ctx2;
+ }
+ libhal_ctx_set_device_added(info->hal_ctx, device_added);
+ libhal_ctx_set_device_removed(info->hal_ctx, device_removed);
+
+ devices = libhal_find_device_by_capability(info->hal_ctx, "input",
+ &num_devices, &error);
+ /* FIXME: Get default devices if error is set. */
+ for (i = 0; i < num_devices; i++)
+ device_added(info->hal_ctx, devices[i]);
+ libhal_free_string_array(devices);
+
+ dbus_error_free(&error);
+
+ return;
+
+out_ctx2:
+ if (!libhal_ctx_shutdown(info->hal_ctx, &error))
+ LogMessage(X_WARNING, "config/hal: couldn't shut down context: %s (%s)\n",
+ error.name, error.message);
+out_ctx:
+ libhal_ctx_free(info->hal_ctx);
+out_err:
+ dbus_error_free(&error);
+
+ info->hal_ctx = NULL;
+ info->system_bus = NULL;
+
+ return;
+}
+
+static struct config_hal_info hal_info;
+static struct config_dbus_core_hook hook = {
+ .connect = connect_hook,
+ .disconnect = disconnect_hook,
+ .data = &hal_info,
+};
+
+int
+config_hal_init(void)
+{
+ memset(&hal_info, 0, sizeof(hal_info));
+ hal_info.system_bus = NULL;
+ hal_info.hal_ctx = NULL;
+
+ if (!config_dbus_core_add_hook(&hook)) {
+ LogMessage(X_ERROR, "config/hal: failed to add D-Bus hook\n");
+ return 0;
+ }
+
+ /* verbose message */
+ LogMessageVerb(X_INFO,7,"config/hal: initialized");
+
+ return 1;
+}
+
+void
+config_hal_fini(void)
+{
+ config_dbus_core_remove_hook(&hook);
+}
diff --git a/xorg-server/config/x11-input.fdi b/xorg-server/config/x11-input.fdi
new file mode 100644
index 000000000..f2e2d50ab
--- /dev/null
+++ b/xorg-server/config/x11-input.fdi
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deviceinfo version="0.2">
+ <device>
+
+ <!-- The way this works:
+
+ Match against some input device (see the HAL specification for more
+ information), and then merge in keys, which you can use to specify
+ the configuration similar to the way you would in xorg.conf. You will
+ need to restart HAL after making changes. If you are having issues,
+ starting X with the -logverbose 7 flag may yield useful information.
+
+ Keys Supported:
+
+ Key "input.x11_driver" (string)
+ This specifies the driver to use. You MUST specify this option,
+ or a driver will not be loaded and the rest will be ignored by
+ Xorg
+
+ Key "input.x11_options.<option name>" (string)
+ This allows you to specify arbitrary options to pass to the driver.
+ Anything you would normally specify in xorg.conf goes here. So, for
+ option "Mode" in xorg.conf, you would specify the key name of
+ "input.x11_options.Mode".
+
+ Do not specify "input.x11_options.Device" since "input.device"
+ will be used automatically.
+
+ Legacy Keys
+ "input.xkb.rules"
+ "input.xkb.model"
+ "input.xkb.layout"
+ "input.xkb.variant"
+ "input.xkb.options"
+
+ These keys are deprecated. Use these instead:
+ "input.x11_options.XkbRules"
+ "input.x11_options.XkbModel"
+ "input.x11_options.XkbLayout"
+ "input.x11_options.XkbVariant"
+ "input.x11_options.XkbOptions"
+
+ See the evdev documentation for more information.
+
+ You will probably want to add the following option to the ServerFlags of
+ your xorg.conf:
+
+ Option "AllowEmptyInput" "True"
+
+ FIXME: Support tablets too.
+ TODO: I think its fixed, can't test
+
+ -->
+
+ <match key="info.capabilities" contains="input.mouse">
+ <merge key="input.x11_driver" type="string">mouse</merge>
+ <match key="/org/freedesktop/Hal/devices/computer:system.kernel.name"
+ string="Linux">
+ <merge key="input.x11_driver" type="string">evdev</merge>
+ </match>
+ </match>
+
+ <match key="info.capabilities" contains="input.keys">
+ <merge key="input.x11_options.XkbRules" type="string">base</merge>
+
+ <!-- If we're using Linux, we use evdev by default (falling back to
+ keyboard otherwise). -->
+ <merge key="input.x11_driver" type="string">keyboard</merge>
+ <merge key="input.x11_options.XkbModel" type="string">pc105</merge>
+ <match key="/org/freedesktop/Hal/devices/computer:system.kernel.name"
+ string="Linux">
+ <merge key="input.x11_driver" type="string">evdev</merge>
+ <merge key="input.x11_options.XkbModel" type="string">evdev</merge>
+ </match>
+
+ <merge key="input.x11_options.XkbLayout" type="string">us</merge>
+
+ <merge key="input.x11_options.XkbVariant" type="string" />
+ </match>
+ </device>
+</deviceinfo>
diff --git a/xorg-server/config/xorg-server.conf b/xorg-server/config/xorg-server.conf
new file mode 100644
index 000000000..47a9a7824
--- /dev/null
+++ b/xorg-server/config/xorg-server.conf
@@ -0,0 +1,13 @@
+<!DOCTYPE busconfig PUBLIC
+ "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+<busconfig>
+ <policy context="default">
+ <allow own="org.x.config.display0"/>
+ <allow send_destination="org.x.config.display0"/>
+ <allow send_interface="org.x.config.display0"/>
+ <allow own="org.x.config.display1"/>
+ <allow send_destination="org.x.config.display1"/>
+ <allow send_interface="org.x.config.display1"/>
+ </policy>
+</busconfig>