summaryrefslogtreecommitdiff
path: root/xserver/config
diff options
context:
space:
mode:
Diffstat (limited to 'xserver/config')
-rw-r--r--xserver/config/10-quirks.conf16
-rw-r--r--xserver/config/Makefile.am26
-rw-r--r--xserver/config/Makefile.in123
-rw-r--r--xserver/config/config-backends.h35
-rw-r--r--xserver/config/config.c158
-rw-r--r--xserver/config/dbus-core.c42
-rw-r--r--xserver/config/dbus.c407
-rw-r--r--xserver/config/hal.c7
-rw-r--r--xserver/config/non-seat0.conf.multi-seat18
-rw-r--r--xserver/config/udev.c69
-rw-r--r--xserver/config/wscons.c8
-rw-r--r--xserver/config/xorg-server.conf13
12 files changed, 263 insertions, 659 deletions
diff --git a/xserver/config/10-quirks.conf b/xserver/config/10-quirks.conf
index c9b823ceb..47907d82d 100644
--- a/xserver/config/10-quirks.conf
+++ b/xserver/config/10-quirks.conf
@@ -19,22 +19,6 @@ Section "InputClass"
Option "IgnoreRelativeAxes" "off"
EndSection
-# https://bugzilla.redhat.com/show_bug.cgi?id=612140
-# please make Evoluent VerticalMouse 3 work out of the box
-# Button mapping on this mouse is quirky
-Section "InputClass"
- Identifier "Evoluent VerticalMouse 3"
- MatchProduct "Evoluent VerticalMouse 3"
- # Sets following configuration:
- # top button: left
- # middle button: middle
- # bottom button: right
- # wheel click: middle
- # thumb button: 8 (back)
- Option "ButtonMapping" "1 2 2 4 5 6 7 3 8"
-EndSection
-
-
# https://bugs.freedesktop.org/show_bug.cgi?id=55867
# Bug 55867 - Doesn't know how to tag XI_TRACKBALL
Section "InputClass"
diff --git a/xserver/config/Makefile.am b/xserver/config/Makefile.am
index 327d07e7c..0e20e8b3d 100644
--- a/xserver/config/Makefile.am
+++ b/xserver/config/Makefile.am
@@ -2,12 +2,19 @@ AM_CFLAGS = $(DIX_CFLAGS)
noinst_LTLIBRARIES = libconfig.la
libconfig_la_SOURCES = config.c config-backends.h
+libconfig_la_LIBADD =
+
+if NEED_DBUS
+AM_CFLAGS += $(DBUS_CFLAGS)
+libconfig_la_SOURCES += dbus-core.c
+libconfig_la_LIBADD += $(DBUS_LIBS)
+endif
if CONFIG_UDEV
AM_CFLAGS += $(UDEV_CFLAGS)
libconfig_la_SOURCES += udev.c
-libconfig_la_LIBADD = $(UDEV_LIBS)
+libconfig_la_LIBADD += $(UDEV_LIBS)
if XORG
xorgconfddir = $(datadir)/X11/$(XF86CONFIGDIR)
@@ -16,23 +23,10 @@ endif
else
-if CONFIG_NEED_DBUS
-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_la_SOURCES += dbus.c
-endif
-
if CONFIG_HAL
AM_CFLAGS += $(HAL_CFLAGS)
libconfig_la_SOURCES += hal.c
libconfig_la_LIBADD += $(HAL_LIBS)
-endif
else
@@ -40,8 +34,8 @@ if CONFIG_WSCONS
libconfig_la_SOURCES += wscons.c
endif # CONFIG_WSCONS
-endif # CONFIG_NEED_DBUS
+endif # !CONFIG_HAL
endif # !CONFIG_UDEV
-EXTRA_DIST = xorg-server.conf x11-input.fdi 10-evdev.conf non-seat0.conf.multi-seat fdi2iclass.py 10-quirks.conf
+EXTRA_DIST = x11-input.fdi 10-evdev.conf fdi2iclass.py 10-quirks.conf
diff --git a/xserver/config/Makefile.in b/xserver/config/Makefile.in
index 5a2e0642f..6e2d1f45c 100644
--- a/xserver/config/Makefile.in
+++ b/xserver/config/Makefile.in
@@ -51,15 +51,16 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
-@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)
-@CONFIG_NEED_DBUS_FALSE@@CONFIG_UDEV_FALSE@@CONFIG_WSCONS_TRUE@am__append_9 = wscons.c
+@NEED_DBUS_TRUE@am__append_1 = $(DBUS_CFLAGS)
+@NEED_DBUS_TRUE@am__append_2 = dbus-core.c
+@NEED_DBUS_TRUE@am__append_3 = $(DBUS_LIBS)
+@CONFIG_UDEV_TRUE@am__append_4 = $(UDEV_CFLAGS)
+@CONFIG_UDEV_TRUE@am__append_5 = udev.c
+@CONFIG_UDEV_TRUE@am__append_6 = $(UDEV_LIBS)
+@CONFIG_HAL_TRUE@@CONFIG_UDEV_FALSE@am__append_7 = $(HAL_CFLAGS)
+@CONFIG_HAL_TRUE@@CONFIG_UDEV_FALSE@am__append_8 = hal.c
+@CONFIG_HAL_TRUE@@CONFIG_UDEV_FALSE@am__append_9 = $(HAL_LIBS)
+@CONFIG_HAL_FALSE@@CONFIG_UDEV_FALSE@@CONFIG_WSCONS_TRUE@am__append_10 = wscons.c
subdir = config
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(top_srcdir)/depcomp
@@ -84,21 +85,20 @@ CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
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 wscons.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
-@CONFIG_NEED_DBUS_FALSE@@CONFIG_UDEV_FALSE@@CONFIG_WSCONS_TRUE@am__objects_5 = wscons.lo
+@NEED_DBUS_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1)
+@CONFIG_UDEV_TRUE@am__DEPENDENCIES_3 = $(am__DEPENDENCIES_1)
+@CONFIG_HAL_TRUE@@CONFIG_UDEV_FALSE@am__DEPENDENCIES_4 = \
+@CONFIG_HAL_TRUE@@CONFIG_UDEV_FALSE@ $(am__DEPENDENCIES_1)
+libconfig_la_DEPENDENCIES = $(am__DEPENDENCIES_2) \
+ $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_4)
+am__libconfig_la_SOURCES_DIST = config.c config-backends.h dbus-core.c \
+ udev.c hal.c wscons.c
+@NEED_DBUS_TRUE@am__objects_1 = dbus-core.lo
+@CONFIG_UDEV_TRUE@am__objects_2 = udev.lo
+@CONFIG_HAL_TRUE@@CONFIG_UDEV_FALSE@am__objects_3 = hal.lo
+@CONFIG_HAL_FALSE@@CONFIG_UDEV_FALSE@@CONFIG_WSCONS_TRUE@am__objects_4 = wscons.lo
am_libconfig_la_OBJECTS = config.lo $(am__objects_1) $(am__objects_2) \
- $(am__objects_3) $(am__objects_4) $(am__objects_5)
+ $(am__objects_3) $(am__objects_4)
libconfig_la_OBJECTS = $(am_libconfig_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
@@ -172,9 +172,8 @@ am__uninstall_files_from_dir = { \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
-am__installdirs = "$(DESTDIR)$(dbusconfigdir)" \
- "$(DESTDIR)$(xorgconfddir)"
-DATA = $(dbusconfig_DATA) $(xorgconfd_DATA)
+am__installdirs = "$(DESTDIR)$(xorgconfddir)"
+DATA = $(xorgconfd_DATA)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -216,6 +215,8 @@ DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@
DEFAULT_LOGDIR = @DEFAULT_LOGDIR@
DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@
DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@
+DEFAULT_XDG_DATA_HOME = @DEFAULT_XDG_DATA_HOME@
+DEFAULT_XDG_DATA_HOME_LOGDIR = @DEFAULT_XDG_DATA_HOME_LOGDIR@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DGA_CFLAGS = @DGA_CFLAGS@
@@ -260,6 +261,10 @@ FONTROOTDIR = @FONTROOTDIR@
FONTTTFDIR = @FONTTTFDIR@
FONTTYPE1DIR = @FONTTYPE1DIR@
FOP = @FOP@
+GBM_CFLAGS = @GBM_CFLAGS@
+GBM_LIBS = @GBM_LIBS@
+GLAMOR_CFLAGS = @GLAMOR_CFLAGS@
+GLAMOR_LIBS = @GLAMOR_LIBS@
GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
GLX_DEFINES = @GLX_DEFINES@
GLX_SYS_LIBS = @GLX_SYS_LIBS@
@@ -362,7 +367,10 @@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@
STRICT_CFLAGS = @STRICT_CFLAGS@
STRIP = @STRIP@
STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@
+SUID_WRAPPER_DIR = @SUID_WRAPPER_DIR@
SYSCONFDIR = @SYSCONFDIR@
+SYSTEMD_DAEMON_CFLAGS = @SYSTEMD_DAEMON_CFLAGS@
+SYSTEMD_DAEMON_LIBS = @SYSTEMD_DAEMON_LIBS@
TRADITIONALCPPFLAGS = @TRADITIONALCPPFLAGS@
TSLIB_CFLAGS = @TSLIB_CFLAGS@
TSLIB_LIBS = @TSLIB_LIBS@
@@ -371,6 +379,7 @@ UDEV_LIBS = @UDEV_LIBS@
UTILS_SYS_LIBS = @UTILS_SYS_LIBS@
VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
VERSION = @VERSION@
+WAYLAND_SCANNER = @WAYLAND_SCANNER@
WINDOWSWM_CFLAGS = @WINDOWSWM_CFLAGS@
WINDOWSWM_LIBS = @WINDOWSWM_LIBS@
WINDRES = @WINDRES@
@@ -437,6 +446,10 @@ XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
XVFB_LIBS = @XVFB_LIBS@
XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
+XWAYLANDMODULES_CFLAGS = @XWAYLANDMODULES_CFLAGS@
+XWAYLANDMODULES_LIBS = @XWAYLANDMODULES_LIBS@
+XWAYLAND_LIBS = @XWAYLAND_LIBS@
+XWAYLAND_SYS_LIBS = @XWAYLAND_SYS_LIBS@
XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@
XWINMODULES_LIBS = @XWINMODULES_LIBS@
XWIN_LIBS = @XWIN_LIBS@
@@ -509,21 +522,15 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-AM_CFLAGS = $(DIX_CFLAGS) $(am__append_1) $(am__append_3) \
- $(am__append_6)
+AM_CFLAGS = $(DIX_CFLAGS) $(am__append_1) $(am__append_4) \
+ $(am__append_7)
noinst_LTLIBRARIES = libconfig.la
libconfig_la_SOURCES = config.c config-backends.h $(am__append_2) \
- $(am__append_4) $(am__append_5) $(am__append_7) \
- $(am__append_9)
-@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)
+ $(am__append_5) $(am__append_8) $(am__append_10)
+libconfig_la_LIBADD = $(am__append_3) $(am__append_6) $(am__append_9)
@CONFIG_UDEV_TRUE@@XORG_TRUE@xorgconfddir = $(datadir)/X11/$(XF86CONFIGDIR)
@CONFIG_UDEV_TRUE@@XORG_TRUE@xorgconfd_DATA = 10-evdev.conf 10-quirks.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 non-seat0.conf.multi-seat fdi2iclass.py 10-quirks.conf
+EXTRA_DIST = x11-input.fdi 10-evdev.conf fdi2iclass.py 10-quirks.conf
all: all-am
.SUFFIXES:
@@ -580,7 +587,6 @@ distclean-compile:
@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@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wscons.Plo@am__quote@
@@ -611,27 +617,6 @@ mostlyclean-libtool:
clean-libtool:
-rm -rf .libs _libs
-install-dbusconfigDATA: $(dbusconfig_DATA)
- @$(NORMAL_INSTALL)
- @list='$(dbusconfig_DATA)'; test -n "$(dbusconfigdir)" || list=; \
- if test -n "$$list"; then \
- echo " $(MKDIR_P) '$(DESTDIR)$(dbusconfigdir)'"; \
- $(MKDIR_P) "$(DESTDIR)$(dbusconfigdir)" || exit 1; \
- fi; \
- for p in $$list; do \
- if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
- echo "$$d$$p"; \
- done | $(am__base_list) | \
- while read files; do \
- echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(dbusconfigdir)'"; \
- $(INSTALL_DATA) $$files "$(DESTDIR)$(dbusconfigdir)" || exit $$?; \
- done
-
-uninstall-dbusconfigDATA:
- @$(NORMAL_UNINSTALL)
- @list='$(dbusconfig_DATA)'; test -n "$(dbusconfigdir)" || list=; \
- files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
- dir='$(DESTDIR)$(dbusconfigdir)'; $(am__uninstall_files_from_dir)
install-xorgconfdDATA: $(xorgconfd_DATA)
@$(NORMAL_INSTALL)
@list='$(xorgconfd_DATA)'; test -n "$(xorgconfddir)" || list=; \
@@ -754,7 +739,7 @@ check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES) $(DATA)
installdirs:
- for dir in "$(DESTDIR)$(dbusconfigdir)" "$(DESTDIR)$(xorgconfddir)"; do \
+ for dir in "$(DESTDIR)$(xorgconfddir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
@@ -810,7 +795,7 @@ info: info-am
info-am:
-install-data-am: install-dbusconfigDATA install-xorgconfdDATA
+install-data-am: install-xorgconfdDATA
install-dvi: install-dvi-am
@@ -856,7 +841,7 @@ ps: ps-am
ps-am:
-uninstall-am: uninstall-dbusconfigDATA uninstall-xorgconfdDATA
+uninstall-am: uninstall-xorgconfdDATA
.MAKE: install-am install-strip
@@ -865,16 +850,14 @@ uninstall-am: uninstall-dbusconfigDATA uninstall-xorgconfdDATA
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 install-xorgconfdDATA installcheck \
- installcheck-am installdirs maintainer-clean \
+ install-data-am 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 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-xorgconfdDATA
+ tags uninstall uninstall-am uninstall-xorgconfdDATA
# Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/xserver/config/config-backends.h b/xserver/config/config-backends.h
index 6423701fc..5f07557b7 100644
--- a/xserver/config/config-backends.h
+++ b/xserver/config/config-backends.h
@@ -37,41 +37,10 @@ int config_udev_pre_init(void);
int config_udev_init(void);
void config_udev_fini(void);
void config_udev_odev_probe(config_odev_probe_proc_ptr probe_callback);
-#else
-
-#ifdef CONFIG_NEED_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
+#elif defined(CONFIG_HAL)
int config_hal_init(void);
void config_hal_fini(void);
-#endif
-#endif
-
-#ifdef CONFIG_WSCONS
+#elif defined(CONFIG_WSCONS)
int config_wscons_init(void);
void config_wscons_fini(void);
#endif
diff --git a/xserver/config/config.c b/xserver/config/config.c
index d0889a394..a26d835e1 100644
--- a/xserver/config/config.c
+++ b/xserver/config/config.c
@@ -27,10 +27,12 @@
#include <dix-config.h>
#endif
+#include <unistd.h>
#include "os.h"
#include "inputstr.h"
#include "hotplug.h"
#include "config-backends.h"
+#include "systemd-logind.h"
void
config_pre_init(void)
@@ -47,20 +49,9 @@ config_init(void)
#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())
- 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");
- }
+#elif defined(CONFIG_HAL)
+ if (!config_hal_init())
+ ErrorF("[config] failed to initialise HAL\n");
#elif defined(CONFIG_WSCONS)
if (!config_wscons_init())
ErrorF("[config] failed to initialise wscons\n");
@@ -72,14 +63,8 @@ config_fini(void)
{
#if defined(CONFIG_UDEV)
config_udev_fini();
-#elif defined(CONFIG_NEED_DBUS)
-#ifdef CONFIG_HAL
+#elif defined(CONFIG_HAL)
config_hal_fini();
-#endif
-#ifdef CONFIG_DBUS_API
- config_dbus_fini();
-#endif
- config_dbus_core_fini();
#elif defined(CONFIG_WSCONS)
config_wscons_fini();
#endif
@@ -147,10 +132,7 @@ config_odev_allocate_attribute_list(void)
{
struct OdevAttributes *attriblist;
- attriblist = malloc(sizeof(struct OdevAttributes));
- if (!attriblist)
- return NULL;
-
+ attriblist = XNFalloc(sizeof(struct OdevAttributes));
xorg_list_init(&attriblist->list);
return attriblist;
}
@@ -162,30 +144,144 @@ config_odev_free_attribute_list(struct OdevAttributes *attribs)
free(attribs);
}
+static struct OdevAttribute *
+config_odev_find_attribute(struct OdevAttributes *attribs, int attrib_id)
+{
+ struct OdevAttribute *oa;
+
+ xorg_list_for_each_entry(oa, &attribs->list, member) {
+ if (oa->attrib_id == attrib_id)
+ return oa;
+ }
+ return NULL;
+}
+
+static struct OdevAttribute *
+config_odev_find_or_add_attribute(struct OdevAttributes *attribs, int attrib)
+{
+ struct OdevAttribute *oa;
+
+ oa = config_odev_find_attribute(attribs, attrib);
+ if (oa)
+ return oa;
+
+ oa = XNFcalloc(sizeof(struct OdevAttribute));
+ oa->attrib_id = attrib;
+ xorg_list_append(&oa->member, &attribs->list);
+
+ return oa;
+}
+
+static int config_odev_get_attribute_type(int attrib)
+{
+ switch (attrib) {
+ case ODEV_ATTRIB_PATH:
+ case ODEV_ATTRIB_SYSPATH:
+ case ODEV_ATTRIB_BUSID:
+ return ODEV_ATTRIB_STRING;
+ case ODEV_ATTRIB_FD:
+ case ODEV_ATTRIB_MAJOR:
+ case ODEV_ATTRIB_MINOR:
+ return ODEV_ATTRIB_INT;
+ case ODEV_ATTRIB_DRIVER:
+ return ODEV_ATTRIB_STRING;
+ default:
+ LogMessage(X_ERROR, "Error %s called for unknown attribute %d\n",
+ __func__, attrib);
+ return ODEV_ATTRIB_UNKNOWN;
+ }
+}
+
Bool
config_odev_add_attribute(struct OdevAttributes *attribs, int attrib,
const char *attrib_name)
{
struct OdevAttribute *oa;
- oa = malloc(sizeof(struct OdevAttribute));
- if (!oa)
+ if (config_odev_get_attribute_type(attrib) != ODEV_ATTRIB_STRING) {
+ LogMessage(X_ERROR, "Error %s called for non string attrib %d\n",
+ __func__, attrib);
return FALSE;
+ }
- oa->attrib_id = attrib;
- oa->attrib_name = strdup(attrib_name);
- xorg_list_append(&oa->member, &attribs->list);
+ oa = config_odev_find_or_add_attribute(attribs, attrib);
+ free(oa->attrib_name);
+ oa->attrib_name = XNFstrdup(attrib_name);
+ oa->attrib_type = ODEV_ATTRIB_STRING;
return TRUE;
}
+Bool
+config_odev_add_int_attribute(struct OdevAttributes *attribs, int attrib,
+ int attrib_value)
+{
+ struct OdevAttribute *oa;
+
+ if (config_odev_get_attribute_type(attrib) != ODEV_ATTRIB_INT) {
+ LogMessage(X_ERROR, "Error %s called for non integer attrib %d\n",
+ __func__, attrib);
+ return FALSE;
+ }
+
+ oa = config_odev_find_or_add_attribute(attribs, attrib);
+ oa->attrib_value = attrib_value;
+ oa->attrib_type = ODEV_ATTRIB_INT;
+ return TRUE;
+}
+
+char *
+config_odev_get_attribute(struct OdevAttributes *attribs, int attrib_id)
+{
+ struct OdevAttribute *oa;
+
+ oa = config_odev_find_attribute(attribs, attrib_id);
+ if (!oa)
+ return NULL;
+
+ if (oa->attrib_type != ODEV_ATTRIB_STRING) {
+ LogMessage(X_ERROR, "Error %s called for non string attrib %d\n",
+ __func__, attrib_id);
+ return NULL;
+ }
+ return oa->attrib_name;
+}
+
+int
+config_odev_get_int_attribute(struct OdevAttributes *attribs, int attrib_id, int def)
+{
+ struct OdevAttribute *oa;
+
+ oa = config_odev_find_attribute(attribs, attrib_id);
+ if (!oa)
+ return def;
+
+ if (oa->attrib_type != ODEV_ATTRIB_INT) {
+ LogMessage(X_ERROR, "Error %s called for non integer attrib %d\n",
+ __func__, attrib_id);
+ return def;
+ }
+
+ return oa->attrib_value;
+}
+
void
config_odev_free_attributes(struct OdevAttributes *attribs)
{
struct OdevAttribute *iter, *safe;
+ int major = 0, minor = 0, fd = -1;
xorg_list_for_each_entry_safe(iter, safe, &attribs->list, member) {
+ switch (iter->attrib_id) {
+ case ODEV_ATTRIB_MAJOR: major = iter->attrib_value; break;
+ case ODEV_ATTRIB_MINOR: minor = iter->attrib_value; break;
+ case ODEV_ATTRIB_FD: fd = iter->attrib_value; break;
+ }
xorg_list_del(&iter->member);
- free(iter->attrib_name);
+ if (iter->attrib_type == ODEV_ATTRIB_STRING)
+ free(iter->attrib_name);
free(iter);
}
+
+ if (fd != -1)
+ systemd_logind_release_fd(major, minor, fd);
}
diff --git a/xserver/config/dbus-core.c b/xserver/config/dbus-core.c
index 324258718..8351ea4b3 100644
--- a/xserver/config/dbus-core.c
+++ b/xserver/config/dbus-core.c
@@ -30,9 +30,9 @@
#include <dbus/dbus.h>
#include <sys/select.h>
-#include "config-backends.h"
#include "dix.h"
#include "os.h"
+#include "dbus-core.h"
/* How often to attempt reconnecting when we get booted off the bus. */
#define RECONNECT_DELAY (10 * 1000) /* in ms */
@@ -41,18 +41,18 @@ struct dbus_core_info {
int fd;
DBusConnection *connection;
OsTimerPtr timer;
- struct config_dbus_core_hook *hooks;
+ struct dbus_core_hook *hooks;
};
static struct dbus_core_info bus_info;
-static CARD32 reconnect_timer(OsTimerPtr timer, CARD32 time, pointer arg);
+static CARD32 reconnect_timer(OsTimerPtr timer, CARD32 time, void *arg);
static void
-wakeup_handler(pointer data, int err, pointer read_mask)
+wakeup_handler(void *data, int num_fds, void *read_mask)
{
struct dbus_core_info *info = data;
- if (info->connection && FD_ISSET(info->fd, (fd_set *) read_mask)) {
+ if (info->connection && num_fds > 0 && FD_ISSET(info->fd, (fd_set *) read_mask)) {
do {
dbus_connection_read_write_dispatch(info->connection, 0);
} while (info->connection &&
@@ -63,7 +63,7 @@ wakeup_handler(pointer data, int err, pointer read_mask)
}
static void
-block_handler(pointer data, struct timeval **tv, pointer read_mask)
+block_handler(void *data, struct timeval **tv, void *read_mask)
{
}
@@ -74,7 +74,7 @@ block_handler(pointer data, struct timeval **tv, pointer read_mask)
static void
teardown(void)
{
- struct config_dbus_core_hook *hook;
+ struct dbus_core_hook *hook;
if (bus_info.timer) {
TimerFree(bus_info.timer);
@@ -112,7 +112,7 @@ message_filter(DBusConnection * connection, DBusMessage * message, void *data)
* 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");
+ DebugF("[dbus-core] disconnected from bus\n");
bus_info.connection = NULL;
teardown();
@@ -136,12 +136,12 @@ static int
connect_to_bus(void)
{
DBusError error;
- struct config_dbus_core_hook *hook;
+ struct 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",
+ LogMessage(X_ERROR, "dbus-core: error connecting to system bus: %s (%s)\n",
error.name, error.message);
goto err_begin;
}
@@ -150,13 +150,13 @@ connect_to_bus(void)
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");
+ ErrorF("[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,
+ ErrorF("[dbus-core] couldn't add filter: %s (%s)\n", error.name,
error.message);
goto err_fd;
}
@@ -185,7 +185,7 @@ connect_to_bus(void)
}
static CARD32
-reconnect_timer(OsTimerPtr timer, CARD32 time, pointer arg)
+reconnect_timer(OsTimerPtr timer, CARD32 time, void *arg)
{
if (connect_to_bus()) {
TimerFree(bus_info.timer);
@@ -198,9 +198,9 @@ reconnect_timer(OsTimerPtr timer, CARD32 time, pointer arg)
}
int
-config_dbus_core_add_hook(struct config_dbus_core_hook *hook)
+dbus_core_add_hook(struct dbus_core_hook *hook)
{
- struct config_dbus_core_hook **prev;
+ struct dbus_core_hook **prev;
for (prev = &bus_info.hooks; *prev; prev = &(*prev)->next);
@@ -215,9 +215,9 @@ config_dbus_core_add_hook(struct config_dbus_core_hook *hook)
}
void
-config_dbus_core_remove_hook(struct config_dbus_core_hook *hook)
+dbus_core_remove_hook(struct dbus_core_hook *hook)
{
- struct config_dbus_core_hook **prev;
+ struct dbus_core_hook **prev;
for (prev = &bus_info.hooks; *prev; prev = &(*prev)->next) {
if (*prev == hook) {
@@ -228,19 +228,19 @@ config_dbus_core_remove_hook(struct config_dbus_core_hook *hook)
}
int
-config_dbus_core_init(void)
+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);
+ if (!connect_to_bus())
+ bus_info.timer = TimerSet(NULL, 0, 1, reconnect_timer, NULL);
return 1;
}
void
-config_dbus_core_fini(void)
+dbus_core_fini(void)
{
teardown();
}
diff --git a/xserver/config/dbus.c b/xserver/config/dbus.c
deleted file mode 100644
index 99a1537e1..000000000
--- a/xserver/config/dbus.c
+++ /dev/null
@@ -1,407 +0,0 @@
-/*
- * 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 <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 *input_options = 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();
- }
-
- input_options = input_option_new(input_options, "_source", "client/dbus");
- if (!input_options) {
- 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) {
- char *key, *value;
-
- 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, &key);
- if (!key)
- MALFORMED_MESSAGE();
- /* The _ prefix refers to internal settings, and may not be given by
- * the client. */
- if (key[0] == '_') {
- ErrorF("[config/dbus] attempted subterfuge: option name %s given\n",
- key);
- MALFORMED_MESSAGE();
- }
-
- 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, &value);
- if (!value)
- MALFORMED_MESSAGE();
-
- input_options = input_option_new(input_options, key, value);
-
- dbus_message_iter_next(&iter);
- }
-
- ret = NewInputDeviceRequest(input_options, NULL, &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, TRUE);
-
- err = -ret;
- dbus_message_iter_append_basic(&reply_iter, DBUS_TYPE_INT32, &err);
- }
-
- input_option_free_list(&input_options);
-
- 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/xserver/config/hal.c b/xserver/config/hal.c
index d8e8db7c2..ea574ca52 100644
--- a/xserver/config/hal.c
+++ b/xserver/config/hal.c
@@ -33,6 +33,7 @@
#include <string.h>
#include <sys/select.h>
+#include "dbus-core.h"
#include "input.h"
#include "inputstr.h"
#include "hotplug.h"
@@ -641,7 +642,7 @@ connect_hook(DBusConnection * connection, void *data)
static struct config_hal_info hal_info;
-static struct config_dbus_core_hook hook = {
+static struct dbus_core_hook hook = {
.connect = connect_hook,
.disconnect = disconnect_hook,
.data = &hal_info,
@@ -654,7 +655,7 @@ config_hal_init(void)
hal_info.system_bus = NULL;
hal_info.hal_ctx = NULL;
- if (!config_dbus_core_add_hook(&hook)) {
+ if (!dbus_core_add_hook(&hook)) {
LogMessage(X_ERROR, "config/hal: failed to add D-Bus hook\n");
return 0;
}
@@ -668,5 +669,5 @@ config_hal_init(void)
void
config_hal_fini(void)
{
- config_dbus_core_remove_hook(&hook);
+ dbus_core_remove_hook(&hook);
}
diff --git a/xserver/config/non-seat0.conf.multi-seat b/xserver/config/non-seat0.conf.multi-seat
deleted file mode 100644
index 34008ce50..000000000
--- a/xserver/config/non-seat0.conf.multi-seat
+++ /dev/null
@@ -1,18 +0,0 @@
-# This is the default configuration for servers on seat-1 and above.
-#
-# Start the server with -config non-seat0.conf.multi-seat, or alternatively
-# rename the file to end in .conf and put it in the standard config
-# directory (though it will apply to _all_ seats!).
-#
-# * Disable VT switching with Ctrl-Alt-F1
-# * Force a grab on all input devices to detach them from the VT subsystem
-# to avoid event leakage.
-
-Section "ServerFlags"
- Option "DontVTSwitch" "on"
-EndSection
-
-Section "InputClass"
- Identifier "Force input devices to seat"
- Option "GrabDevice" "on"
-EndSection
diff --git a/xserver/config/udev.c b/xserver/config/udev.c
index bcafbd9d8..a1b72c13b 100644
--- a/xserver/config/udev.c
+++ b/xserver/config/udev.c
@@ -29,6 +29,7 @@
#include <libudev.h>
#include <ctype.h>
+#include <unistd.h>
#include "input.h"
#include "inputstr.h"
@@ -36,6 +37,7 @@
#include "config-backends.h"
#include "os.h"
#include "globals.h"
+#include "systemd-logind.h"
#define UDEV_XKB_PROP_KEY "xkb"
@@ -53,11 +55,20 @@
static struct udev_monitor *udev_monitor;
#ifdef CONFIG_UDEV_KMS
-static Bool
+static void
config_udev_odev_setup_attribs(const char *path, const char *syspath,
+ int major, int minor,
config_odev_probe_proc_ptr probe_callback);
#endif
+static char itoa_buf[16];
+
+static const char *itoa(int i)
+{
+ snprintf(itoa_buf, sizeof(itoa_buf), "%d", i);
+ return itoa_buf;
+}
+
static void
device_added(struct udev_device *udev_device)
{
@@ -73,6 +84,7 @@ device_added(struct udev_device *udev_device)
struct udev_device *parent;
int rc;
const char *dev_seat;
+ dev_t devnum;
path = udev_device_get_devnode(udev_device);
@@ -91,6 +103,8 @@ device_added(struct udev_device *udev_device)
if (!SeatId && strcmp(dev_seat, "seat0"))
return;
+ devnum = udev_device_get_devnum(udev_device);
+
#ifdef CONFIG_UDEV_KMS
if (!strcmp(udev_device_get_subsystem(udev_device), "drm")) {
const char *sysname = udev_device_get_sysname(udev_device);
@@ -98,9 +112,14 @@ device_added(struct udev_device *udev_device)
if (strncmp(sysname, "card", 4) != 0)
return;
+ /* Check for devices already added through xf86platformProbe() */
+ if (xf86_find_platform_device_by_devnum(major(devnum), minor(devnum)))
+ return;
+
LogMessage(X_INFO, "config/udev: Adding drm device (%s)\n", path);
- config_udev_odev_setup_attribs(path, syspath, NewGPUDeviceRequest);
+ config_udev_odev_setup_attribs(path, syspath, major(devnum),
+ minor(devnum), NewGPUDeviceRequest);
return;
}
#endif
@@ -133,11 +152,13 @@ device_added(struct udev_device *udev_device)
/* construct USB ID in lowercase hex - "0000:ffff" */
if (product &&
sscanf(product, "%*x/%4x/%4x/%*x", &usb_vendor, &usb_model) == 2) {
- if (asprintf(&attrs.usb_id, "%04x:%04x", usb_vendor, usb_model)
+ char *usb_id;
+ if (asprintf(&usb_id, "%04x:%04x", usb_vendor, usb_model)
== -1)
- attrs.usb_id = NULL;
+ usb_id = NULL;
else
LOG_PROPERTY(ppath, "PRODUCT", product);
+ attrs.usb_id = usb_id;
}
while (!pnp_id && (parent = udev_device_get_parent(parent))) {
@@ -158,6 +179,8 @@ device_added(struct udev_device *udev_device)
input_options = input_option_new(input_options, "name", name);
input_options = input_option_new(input_options, "path", path);
input_options = input_option_new(input_options, "device", path);
+ input_options = input_option_new(input_options, "major", itoa(major(devnum)));
+ input_options = input_option_new(input_options, "minor", itoa(minor(devnum)));
if (path)
attrs.device = strdup(path);
@@ -275,6 +298,7 @@ device_removed(struct udev_device *device)
if (!strcmp(udev_device_get_subsystem(device), "drm")) {
const char *sysname = udev_device_get_sysname(device);
const char *path = udev_device_get_devnode(device);
+ dev_t devnum = udev_device_get_devnum(device);
if (strncmp(sysname,"card", 4) != 0)
return;
@@ -282,7 +306,10 @@ device_removed(struct udev_device *device)
if (!path)
return;
- config_udev_odev_setup_attribs(path, syspath, DeleteGPUDeviceRequest);
+ config_udev_odev_setup_attribs(path, syspath, major(devnum),
+ minor(devnum), DeleteGPUDeviceRequest);
+ /* Retry vtenter after a drm node removal */
+ systemd_logind_vtenter();
return;
}
#endif
@@ -296,7 +323,7 @@ device_removed(struct udev_device *device)
}
static void
-wakeup_handler(pointer data, int err, pointer read_mask)
+wakeup_handler(void *data, int err, void *read_mask)
{
int udev_fd = udev_monitor_get_fd(udev_monitor);
struct udev_device *udev_device;
@@ -329,7 +356,7 @@ wakeup_handler(pointer data, int err, pointer read_mask)
}
static void
-block_handler(pointer data, struct timeval **tv, pointer read_mask)
+block_handler(void *data, struct timeval **tv, void *read_mask)
{
}
@@ -430,31 +457,20 @@ config_udev_fini(void)
#ifdef CONFIG_UDEV_KMS
-static Bool
+static void
config_udev_odev_setup_attribs(const char *path, const char *syspath,
+ int major, int minor,
config_odev_probe_proc_ptr probe_callback)
{
struct OdevAttributes *attribs = config_odev_allocate_attribute_list();
- int ret;
- if (!attribs)
- return FALSE;
-
- ret = config_odev_add_attribute(attribs, ODEV_ATTRIB_PATH, path);
- if (ret == FALSE)
- goto fail;
-
- ret = config_odev_add_attribute(attribs, ODEV_ATTRIB_SYSPATH, syspath);
- if (ret == FALSE)
- goto fail;
+ config_odev_add_attribute(attribs, ODEV_ATTRIB_PATH, path);
+ config_odev_add_attribute(attribs, ODEV_ATTRIB_SYSPATH, syspath);
+ config_odev_add_int_attribute(attribs, ODEV_ATTRIB_MAJOR, major);
+ config_odev_add_int_attribute(attribs, ODEV_ATTRIB_MINOR, minor);
/* ownership of attribs is passed to probe layer */
probe_callback(attribs);
- return TRUE;
-fail:
- config_odev_free_attributes(attribs);
- free(attribs);
- return FALSE;
}
void
@@ -482,6 +498,7 @@ config_udev_odev_probe(config_odev_probe_proc_ptr probe_callback)
struct udev_device *udev_device = udev_device_new_from_syspath(udev, syspath);
const char *path = udev_device_get_devnode(udev_device);
const char *sysname = udev_device_get_sysname(udev_device);
+ dev_t devnum = udev_device_get_devnum(udev_device);
if (!path || !syspath)
goto no_probe;
@@ -490,8 +507,8 @@ config_udev_odev_probe(config_odev_probe_proc_ptr probe_callback)
else if (strncmp(sysname, "card", 4) != 0)
goto no_probe;
- config_udev_odev_setup_attribs(path, syspath, probe_callback);
-
+ config_udev_odev_setup_attribs(path, syspath, major(devnum),
+ minor(devnum), probe_callback);
no_probe:
udev_device_unref(udev_device);
}
diff --git a/xserver/config/wscons.c b/xserver/config/wscons.c
index 7f5f85e3b..686d6026c 100644
--- a/xserver/config/wscons.c
+++ b/xserver/config/wscons.c
@@ -111,7 +111,7 @@ wscons_add_keyboard(void)
close(fd);
return;
}
- close (fd);
+ close(fd);
input_options = input_option_new(input_options, "_source", "server/wscons");
if (input_options == NULL)
@@ -219,13 +219,11 @@ wscons_add_pointers(void)
/* Check pointing devices */
for (i = 0; i < 4; i++) {
- snprintf(devname, sizeof(devname), "%s%d",
- WSCONS_MOUSE_PREFIX, i);
+ snprintf(devname, sizeof(devname), "%s%d", WSCONS_MOUSE_PREFIX, i);
LogMessageVerb(X_INFO, 10, "wsmouse: checking %s\n", devname);
fd = priv_open_device(devname);
if (fd == -1) {
- LogMessageVerb(X_WARNING, 10, "%s: %s\n", devname,
- strerror(errno));
+ LogMessageVerb(X_WARNING, 10, "%s: %s\n", devname, strerror(errno));
continue;
}
if (ioctl(fd, WSMOUSEIO_GTYPE, &wsmouse_type) != 0) {
diff --git a/xserver/config/xorg-server.conf b/xserver/config/xorg-server.conf
deleted file mode 100644
index 47a9a7824..000000000
--- a/xserver/config/xorg-server.conf
+++ /dev/null
@@ -1,13 +0,0 @@
-<!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>