summaryrefslogtreecommitdiff
path: root/xserver/config
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2008-11-02 15:26:35 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2008-11-02 15:26:35 +0000
commitdbca69c8a4f3e2d1ccb4f89152213b2861b33af6 (patch)
treef8963ef73903a7b4374adc2354dffbaa905112ac /xserver/config
parent33b2029f322f3c238b7ba528083195ad8dde33e1 (diff)
xserver 1.5.2. tested by ckuethe@, oga@, and others.
Diffstat (limited to 'xserver/config')
-rw-r--r--xserver/config/Makefile.in70
-rw-r--r--xserver/config/dbus-api40
-rw-r--r--xserver/config/dbus-core.c5
-rw-r--r--xserver/config/dbus.c29
-rw-r--r--xserver/config/hal.c298
-rw-r--r--xserver/config/x11-input.fdi62
6 files changed, 386 insertions, 118 deletions
diff --git a/xserver/config/Makefile.in b/xserver/config/Makefile.in
index 5982ff22c..5c1d11778 100644
--- a/xserver/config/Makefile.in
+++ b/xserver/config/Makefile.in
@@ -133,8 +133,6 @@ BSD_KQUEUE_APM_FALSE = @BSD_KQUEUE_APM_FALSE@
BSD_KQUEUE_APM_TRUE = @BSD_KQUEUE_APM_TRUE@
BUILDDOCS_FALSE = @BUILDDOCS_FALSE@
BUILDDOCS_TRUE = @BUILDDOCS_TRUE@
-BUILD_DARWIN_FALSE = @BUILD_DARWIN_FALSE@
-BUILD_DARWIN_TRUE = @BUILD_DARWIN_TRUE@
BUILD_DATE = @BUILD_DATE@
BUILD_IOPORT_FALSE = @BUILD_IOPORT_FALSE@
BUILD_IOPORT_TRUE = @BUILD_IOPORT_TRUE@
@@ -206,6 +204,10 @@ DMX_FALSE = @DMX_FALSE@
DMX_TRUE = @DMX_TRUE@
DPMSExtension_FALSE = @DPMSExtension_FALSE@
DPMSExtension_TRUE = @DPMSExtension_TRUE@
+DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
+DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
+DRI2_FALSE = @DRI2_FALSE@
+DRI2_TRUE = @DRI2_TRUE@
DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
DRIPROTO_LIBS = @DRIPROTO_LIBS@
DRIVER_MAN_DIR = @DRIVER_MAN_DIR@
@@ -235,7 +237,7 @@ FREEBSD_KLDLOAD_FALSE = @FREEBSD_KLDLOAD_FALSE@
FREEBSD_KLDLOAD_TRUE = @FREEBSD_KLDLOAD_TRUE@
FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
FREETYPE_LIBS = @FREETYPE_LIBS@
-FREETYPE_REQUIRES = @FREETYPE_REQUIRES@
+GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
GLX_DEFINES = @GLX_DEFINES@
GLX_FALSE = @GLX_FALSE@
GLX_TRUE = @GLX_TRUE@
@@ -249,8 +251,8 @@ HAVE_AGL_FRAMEWORK_FALSE = @HAVE_AGL_FRAMEWORK_FALSE@
HAVE_AGL_FRAMEWORK_TRUE = @HAVE_AGL_FRAMEWORK_TRUE@
HAVE_DBUS_FALSE = @HAVE_DBUS_FALSE@
HAVE_DBUS_TRUE = @HAVE_DBUS_TRUE@
-HAVE_X_PLUGIN_FALSE = @HAVE_X_PLUGIN_FALSE@
-HAVE_X_PLUGIN_TRUE = @HAVE_X_PLUGIN_TRUE@
+HAVE_XPLUGIN_FALSE = @HAVE_XPLUGIN_FALSE@
+HAVE_XPLUGIN_TRUE = @HAVE_XPLUGIN_TRUE@
HP300_VIDEO_FALSE = @HP300_VIDEO_FALSE@
HP300_VIDEO_TRUE = @HP300_VIDEO_TRUE@
HPPA_VIDEO_FALSE = @HPPA_VIDEO_FALSE@
@@ -291,6 +293,9 @@ KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
KDRIVE_TRUE = @KDRIVE_TRUE@
+LAUNCHD = @LAUNCHD@
+LAUNCHD_FALSE = @LAUNCHD_FALSE@
+LAUNCHD_TRUE = @LAUNCHD_TRUE@
LDFLAGS = @LDFLAGS@
LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
LEX = @LEX@
@@ -345,6 +350,8 @@ 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@
@@ -352,12 +359,11 @@ 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@
-PIXMAN_CFLAGS = @PIXMAN_CFLAGS@
-PIXMAN_LIBS = @PIXMAN_LIBS@
PKG_CONFIG = @PKG_CONFIG@
-PLIST_VENDOR_WEB = @PLIST_VENDOR_WEB@
-PLIST_VERSION_STRING = @PLIST_VERSION_STRING@
PPC_VIDEO_FALSE = @PPC_VIDEO_FALSE@
PPC_VIDEO_TRUE = @PPC_VIDEO_TRUE@
PROJECTROOT = @PROJECTROOT@
@@ -369,13 +375,12 @@ RECORD_FALSE = @RECORD_FALSE@
RECORD_TRUE = @RECORD_TRUE@
RES_FALSE = @RES_FALSE@
RES_TRUE = @RES_TRUE@
-RGB_DB = @RGB_DB@
SCREENSAVER_FALSE = @SCREENSAVER_FALSE@
SCREENSAVER_TRUE = @SCREENSAVER_TRUE@
SECURE_RPC_FALSE = @SECURE_RPC_FALSE@
SECURE_RPC_TRUE = @SECURE_RPC_TRUE@
SED = @SED@
-SERVERCONFIGdir = @SERVERCONFIGdir@
+SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@
SET_MAKE = @SET_MAKE@
SGI_VIDEO_FALSE = @SGI_VIDEO_FALSE@
SGI_VIDEO_TRUE = @SGI_VIDEO_TRUE@
@@ -391,20 +396,21 @@ SPARC64_VIDEO_TRUE = @SPARC64_VIDEO_TRUE@
STRIP = @STRIP@
SUN_KBD_MODE_FALSE = @SUN_KBD_MODE_FALSE@
SUN_KBD_MODE_TRUE = @SUN_KBD_MODE_TRUE@
-SYS_LIBS = @SYS_LIBS@
TSLIB_CFLAGS = @TSLIB_CFLAGS@
TSLIB_FALSE = @TSLIB_FALSE@
TSLIB_LIBS = @TSLIB_LIBS@
TSLIB_TRUE = @TSLIB_TRUE@
USE_CURSES_FALSE = @USE_CURSES_FALSE@
USE_CURSES_TRUE = @USE_CURSES_TRUE@
-USE_RGB_BUILTIN_FALSE = @USE_RGB_BUILTIN_FALSE@
-USE_RGB_BUILTIN_TRUE = @USE_RGB_BUILTIN_TRUE@
+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@
+X11APP_FALSE = @X11APP_FALSE@
+X11APP_TRUE = @X11APP_TRUE@
X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
XACE_FALSE = @XACE_FALSE@
@@ -421,18 +427,22 @@ XDMCP_LIBS = @XDMCP_LIBS@
XDMCP_TRUE = @XDMCP_TRUE@
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@
-XEGLMODULES_LIBS = @XEGLMODULES_LIBS@
XEGL_FALSE = @XEGL_FALSE@
XEGL_LIBS = @XEGL_LIBS@
+XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
XEGL_TRUE = @XEGL_TRUE@
XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
+XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
XEPHYR_FALSE = @XEPHYR_FALSE@
+XEPHYR_HAS_DRI_FALSE = @XEPHYR_HAS_DRI_FALSE@
+XEPHYR_HAS_DRI_TRUE = @XEPHYR_HAS_DRI_TRUE@
XEPHYR_INCS = @XEPHYR_INCS@
XEPHYR_LIBS = @XEPHYR_LIBS@
XEPHYR_TRUE = @XEPHYR_TRUE@
-XERRORDB_PATH = @XERRORDB_PATH@
XEVIE_FALSE = @XEVIE_FALSE@
XEVIE_TRUE = @XEVIE_TRUE@
XF86BIGFONT_FALSE = @XF86BIGFONT_FALSE@
@@ -456,10 +466,12 @@ XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
XGLX_FALSE = @XGLX_FALSE@
XGLX_LIBS = @XGLX_LIBS@
+XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
XGLX_TRUE = @XGLX_TRUE@
XGL_FALSE = @XGL_FALSE@
XGL_LIBS = @XGL_LIBS@
XGL_MODULE_PATH = @XGL_MODULE_PATH@
+XGL_SYS_LIBS = @XGL_SYS_LIBS@
XGL_TRUE = @XGL_TRUE@
XINERAMA_FALSE = @XINERAMA_FALSE@
XINERAMA_TRUE = @XINERAMA_TRUE@
@@ -473,19 +485,18 @@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
XNEST_FALSE = @XNEST_FALSE@
XNEST_LIBS = @XNEST_LIBS@
+XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
XNEST_TRUE = @XNEST_TRUE@
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_BUS_FREEBSDPCI_FALSE = @XORG_BUS_FREEBSDPCI_FALSE@
-XORG_BUS_FREEBSDPCI_TRUE = @XORG_BUS_FREEBSDPCI_TRUE@
+XORG_BUS_BSDPCI_FALSE = @XORG_BUS_BSDPCI_FALSE@
+XORG_BUS_BSDPCI_TRUE = @XORG_BUS_BSDPCI_TRUE@
XORG_BUS_IX86PCI_FALSE = @XORG_BUS_IX86PCI_FALSE@
XORG_BUS_IX86PCI_TRUE = @XORG_BUS_IX86PCI_TRUE@
XORG_BUS_LINUXPCI_FALSE = @XORG_BUS_LINUXPCI_FALSE@
XORG_BUS_LINUXPCI_TRUE = @XORG_BUS_LINUXPCI_TRUE@
-XORG_BUS_NETBSDPCI_FALSE = @XORG_BUS_NETBSDPCI_FALSE@
-XORG_BUS_NETBSDPCI_TRUE = @XORG_BUS_NETBSDPCI_TRUE@
XORG_BUS_PPCPCI_FALSE = @XORG_BUS_PPCPCI_FALSE@
XORG_BUS_PPCPCI_TRUE = @XORG_BUS_PPCPCI_TRUE@
XORG_BUS_SPARCPCI_FALSE = @XORG_BUS_SPARCPCI_FALSE@
@@ -493,7 +504,6 @@ XORG_BUS_SPARCPCI_TRUE = @XORG_BUS_SPARCPCI_TRUE@
XORG_BUS_SPARC_FALSE = @XORG_BUS_SPARC_FALSE@
XORG_BUS_SPARC_TRUE = @XORG_BUS_SPARC_TRUE@
XORG_CFLAGS = @XORG_CFLAGS@
-XORG_CORE_LIBS = @XORG_CORE_LIBS@
XORG_FALSE = @XORG_FALSE@
XORG_INCS = @XORG_INCS@
XORG_LIBS = @XORG_LIBS@
@@ -503,23 +513,31 @@ 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@
XORG_TRUE = @XORG_TRUE@
+XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
+XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
XPRINT_CFLAGS = @XPRINT_CFLAGS@
XPRINT_FALSE = @XPRINT_FALSE@
XPRINT_LIBS = @XPRINT_LIBS@
+XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
XPRINT_TRUE = @XPRINT_TRUE@
XP_USE_FREETYPE_FALSE = @XP_USE_FREETYPE_FALSE@
XP_USE_FREETYPE_TRUE = @XP_USE_FREETYPE_TRUE@
XQUARTZ_FALSE = @XQUARTZ_FALSE@
XQUARTZ_TRUE = @XQUARTZ_TRUE@
+XREGISTRY_FALSE = @XREGISTRY_FALSE@
+XREGISTRY_TRUE = @XREGISTRY_TRUE@
XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
XSDLSERVER_FALSE = @XSDLSERVER_FALSE@
XSDLSERVER_TRUE = @XSDLSERVER_TRUE@
XSDL_INCS = @XSDL_INCS@
XSDL_LIBS = @XSDL_LIBS@
+XSELINUX_FALSE = @XSELINUX_FALSE@
+XSELINUX_TRUE = @XSELINUX_TRUE@
XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@
XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@
XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@
@@ -527,12 +545,14 @@ XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@
XSERVER_DTRACE_FALSE = @XSERVER_DTRACE_FALSE@
XSERVER_DTRACE_TRUE = @XSERVER_DTRACE_TRUE@
XSERVER_LIBS = @XSERVER_LIBS@
+XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@
XTRAP_FALSE = @XTRAP_FALSE@
XTRAP_TRUE = @XTRAP_TRUE@
XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@
XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@
XVFB_FALSE = @XVFB_FALSE@
XVFB_LIBS = @XVFB_LIBS@
+XVFB_SYS_LIBS = @XVFB_SYS_LIBS@
XVFB_TRUE = @XVFB_TRUE@
XVMC_FALSE = @XVMC_FALSE@
XVMC_TRUE = @XVMC_TRUE@
@@ -557,7 +577,7 @@ XWIN_PRIMARYFB_TRUE = @XWIN_PRIMARYFB_TRUE@
XWIN_RANDR_FALSE = @XWIN_RANDR_FALSE@
XWIN_RANDR_TRUE = @XWIN_RANDR_TRUE@
XWIN_SERVER_NAME = @XWIN_SERVER_NAME@
-XWIN_SYSTEM_LIBS = @XWIN_SYSTEM_LIBS@
+XWIN_SYS_LIBS = @XWIN_SYS_LIBS@
XWIN_TRUE = @XWIN_TRUE@
XWIN_XV_FALSE = @XWIN_XV_FALSE@
XWIN_XV_TRUE = @XWIN_XV_TRUE@
@@ -565,6 +585,11 @@ X_PRIVSEP_FALSE = @X_PRIVSEP_FALSE@
X_PRIVSEP_TRUE = @X_PRIVSEP_TRUE@
YACC = @YACC@
__XCONFIGFILE__ = @__XCONFIGFILE__@
+abi_ansic = @abi_ansic@
+abi_extension = @abi_extension@
+abi_font = @abi_font@
+abi_videodrv = @abi_videodrv@
+abi_xinput = @abi_xinput@
ac_ct_AR = @ac_ct_AR@
ac_ct_AS = @ac_ct_AS@
ac_ct_CC = @ac_ct_CC@
@@ -607,6 +632,7 @@ host_vendor = @host_vendor@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
+launchagentsdir = @launchagentsdir@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
diff --git a/xserver/config/dbus-api b/xserver/config/dbus-api
new file mode 100644
index 000000000..018e98657
--- /dev/null
+++ b/xserver/config/dbus-api
@@ -0,0 +1,40 @@
+D-BUS Configuration API v2
+----------------------------
+
+The X server will register the bus name org.x.config.displayN, and the
+object /org/x/config/N, where N is the display number.
+
+Currently only hotplugging of input devices is supported.
+
+org.x.config.input:
+ org.x.config.input.version:
+ Returns one unsigned int32, which is the API version.
+
+ org.x.config.input.add:
+ Takes an argument of key/value option pairs in arrays, e.g.:
+ [ss][ss][ss][ss]
+ is the signature for four options. These options will be passed
+ to the input driver as with any others.
+ Option names beginning with _ are not allowed; they are reserved
+ for internal use.
+
+ Returns a number of signed int32s. Positive integers are the
+ device IDs of new devices; negative numbers are X error codes,
+ as defined in X.h. BadMatch will be returned if the options
+ given do not match any device. BadValue is returned for a malformed
+ message. (Example: 8 is new device ID 8; -8 is BadMatch.)
+
+ Notably, BadAlloc is never returned: the server internally signals
+ to D-BUS that the attempt failed for lack of memory.
+
+ org.x.config.input.remove:
+ Takes one uint32 argument, which is the device ID to remove, i.e.:
+ u
+ is the signature.
+
+ Returns one signed int32 which represents an X status as defined in
+ X.h. See org.x.config.input.add. Error codes are negative numbers.
+
+ org.x.config.input.listDevices:
+ Lists the currently active devices. No argument.
+ Return value is sequence of [<id> <name>] [<id> <name>] ..., i.e. [us].
diff --git a/xserver/config/dbus-core.c b/xserver/config/dbus-core.c
index 9cf153076..b349c6e3c 100644
--- a/xserver/config/dbus-core.c
+++ b/xserver/config/dbus-core.c
@@ -56,8 +56,9 @@ wakeup_handler(pointer data, int err, pointer read_mask)
if (info->connection && FD_ISSET(info->fd, (fd_set *) read_mask)) {
do {
dbus_connection_read_write_dispatch(info->connection, 0);
- } while (dbus_connection_get_dispatch_status(info->connection) ==
- DBUS_DISPATCH_DATA_REMAINS);
+ } while (info->connection &&
+ dbus_connection_get_is_connected(info->connection) &&
+ dbus_connection_get_dispatch_status(info->connection) == DBUS_DISPATCH_DATA_REMAINS);
}
}
diff --git a/xserver/config/dbus.c b/xserver/config/dbus.c
index c6f4af0d5..cef8ed5db 100644
--- a/xserver/config/dbus.c
+++ b/xserver/config/dbus.c
@@ -74,11 +74,12 @@ add_device(DBusMessage *message, DBusMessage *reply, DBusError *error)
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");
- return BadAlloc;
+ MALFORMED_MESSAGE();
}
- dbus_message_iter_init_append(reply, &reply_iter);
options = xcalloc(sizeof(*options), 1);
if (!options) {
@@ -138,7 +139,7 @@ add_device(DBusMessage *message, DBusMessage *reply, DBusError *error)
MALFORMED_MESSAGE();
options->value = xstrdup(tmp);
if (!options->value) {
- ErrorF("[config] couldn't duplicate option!\n");
+ ErrorF("[config/dbus] couldn't duplicate option!\n");
ret = BadAlloc;
goto unwind;
}
@@ -200,25 +201,26 @@ remove_device(DBusMessage *message, DBusMessage *reply, DBusError *error)
DeviceIntPtr dev;
DBusMessageIter iter, reply_iter;
+ dbus_message_iter_init_append(reply, &reply_iter);
+
if (!dbus_message_iter_init(message, &iter)) {
- ErrorF("[config] failed to init iterator\n");
- return BadAlloc;
+ ErrorF("[config/dbus] failed to init iterator\n");
+ MALFORMED_MESSAGE();
}
- dbus_message_iter_init_append(reply, &reply_iter);
if (!dbus_message_get_args(message, error, DBUS_TYPE_UINT32,
&deviceid, DBUS_TYPE_INVALID)) {
MALFORMED_MESSAGE_ERROR();
}
- dev = LookupDeviceIntRec(deviceid);
+ dixLookupDevice(&dev, deviceid, serverClient, DixDestroyAccess);
if (!dev) {
- DebugF("[config] bogus device id %d given\n", deviceid);
+ DebugF("[config/dbus] bogus device id %d given\n", deviceid);
ret = BadMatch;
goto unwind;
}
- DebugF("[config] removing device %s (id %d)\n", dev->name, deviceid);
+ 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. */
@@ -353,8 +355,8 @@ connect_hook(DBusConnection *connection, void *data)
dbus_error_init(&error);
- if (!dbus_bus_request_name(info->connection, info->busname,
- 0, &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;
@@ -394,9 +396,6 @@ err_start:
static void
disconnect_hook(void *data)
{
- struct connection_info *info = data;
-
- reset_info(info);
}
#if 0
@@ -438,4 +437,6 @@ 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 bdf7d6c13..0e0505b66 100644
--- a/xserver/config/hal.c
+++ b/xserver/config/hal.c
@@ -1,5 +1,6 @@
/*
* 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"),
@@ -38,19 +39,31 @@
#include "config-backends.h"
#include "os.h"
-#define TYPE_NONE 0
-#define TYPE_KEYS 1
-#define TYPE_POINTER 2
+
+#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)
{
- DebugF("[config/hal] removing device %s\n", dev->name);
+ /* 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. */
@@ -107,7 +120,7 @@ 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);
- DebugF(" [config/hal] getting %s on %s returned %s\n", name, udi, prop);
+ 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);
@@ -156,108 +169,230 @@ get_prop_string_array(LibHalContext *hal_ctx, const char *udi, const char *prop)
static void
device_added(LibHalContext *hal_ctx, const char *udi)
{
- char **props;
- char *path = NULL, *driver = NULL, *name = NULL, *xkb_rules = NULL;
- char *xkb_model = NULL, *xkb_layout = NULL, *xkb_variant = NULL;
- char *xkb_options = NULL, *config_info = NULL;
+ char *path = NULL, *driver = NULL, *name = NULL, *config_info = NULL;
InputOption *options = NULL, *tmpo = NULL;
DeviceIntPtr dev;
DBusError error;
- int type = TYPE_NONE;
- int i;
+ struct xkb_options xkb_opts = {0};
- dbus_error_init(&error);
+ LibHalPropertySet *set = NULL;
+ LibHalPropertySetIterator set_iter;
+ char *psi_key = NULL, *tmp_val;
- props = libhal_device_get_property_strlist(hal_ctx, udi,
- "info.capabilities", &error);
- if (!props) {
- DebugF("[config/hal] couldn't get capabilities for %s: %s (%s)\n",
- udi, error.name, error.message);
- goto out_error;
- }
- for (i = 0; props[i]; i++) {
- /* input.keys is the new, of which input.keyboard is a subset, but
- * input.keyboard is the old 'we have keys', so we have to keep it
- * around. */
- if (strcmp(props[i], "input.keys") == 0 ||
- strcmp(props[i], "input.keyboard") == 0)
- type |= TYPE_KEYS;
- if (strcmp(props[i], "input.mouse") == 0 ||
- strcmp(props[i], "input.touchpad") == 0)
- type |= TYPE_POINTER;
- }
- libhal_free_string_array(props);
- if (type == TYPE_NONE)
- goto out_error;
+ 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 (!driver || !path) {
- DebugF("[config/hal] no driver or path specified for %s\n", udi);
+ 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)");
- if (type & TYPE_KEYS) {
- xkb_rules = get_prop_string(hal_ctx, udi, "input.xkb.rules");
- xkb_model = get_prop_string(hal_ctx, udi, "input.xkb.model");
- xkb_layout = get_prop_string(hal_ctx, udi, "input.xkb.layout");
- xkb_variant = get_prop_string(hal_ctx, udi, "input.xkb.variant");
- xkb_options = get_prop_string_array(hal_ctx, udi, "input.xkb.options");
+ options = xcalloc(sizeof(*options), 1);
+ if (!options){
+ LogMessage(X_ERROR, "config/hal: couldn't allocate space for input options!\n");
+ goto unwind;
}
- options = xcalloc(sizeof(*options), 1);
options->key = xstrdup("_source");
options->value = xstrdup("server/hal");
if (!options->key || !options->value) {
- ErrorF("[config] couldn't allocate first key/value pair\n");
+ 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)
+ if (!config_info) {
+ LogMessage(X_ERROR, "config/hal: couldn't allocate name\n");
goto unwind;
+ }
sprintf(config_info, "hal:%s", udi);
- if (xkb_model)
- add_option(&options, "xkb_model", xkb_model);
- if (xkb_layout)
- add_option(&options, "xkb_layout", xkb_layout);
- if (xkb_variant)
- add_option(&options, "xkb_variant", xkb_variant);
- if (xkb_options)
- add_option(&options, "xkb_options", xkb_options);
+ /* 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) {
- DebugF("[config/hal] NewInputDeviceRequest failed\n");
+ LogMessage(X_ERROR, "config/hal: NewInputDeviceRequest failed\n");
dev = NULL;
goto unwind;
}
- for (; dev; dev = dev->next)
+ 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 (xkb_rules)
- xfree(xkb_rules);
- if (xkb_model)
- xfree(xkb_model);
- if (xkb_layout)
- xfree(xkb_layout);
- if (xkb_options)
- xfree(xkb_options);
if (config_info)
xfree(config_info);
while (!dev && (tmpo = options)) {
@@ -267,7 +402,17 @@ unwind:
xfree(tmpo);
}
-out_error:
+ 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;
@@ -280,12 +425,14 @@ disconnect_hook(void *data)
struct config_hal_info *info = data;
if (info->hal_ctx) {
- dbus_error_init(&error);
- if (!libhal_ctx_shutdown(info->hal_ctx, &error))
- DebugF("[config/hal] couldn't shut down context: %s (%s)\n",
- error.name, error.message);
+ 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);
- dbus_error_free(&error);
}
info->hal_ctx = NULL;
@@ -307,21 +454,21 @@ connect_hook(DBusConnection *connection, void *data)
if (!info->hal_ctx)
info->hal_ctx = libhal_ctx_new();
if (!info->hal_ctx) {
- ErrorF("[config/hal] couldn't create HAL context\n");
+ 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)) {
- ErrorF("[config/hal] couldn't associate HAL context with bus\n");
+ LogMessage(X_ERROR, "config/hal: couldn't associate HAL context with bus\n");
goto out_ctx;
}
if (!libhal_ctx_init(info->hal_ctx, &error)) {
- ErrorF("[config/hal] couldn't initialise context: %s (%s)\n",
+ 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)) {
- ErrorF("[config/hal] couldn't watch all properties: %s (%s)\n",
+ LogMessage(X_ERROR, "config/hal: couldn't watch all properties: %s (%s)\n",
error.name, error.message);
goto out_ctx2;
}
@@ -341,7 +488,7 @@ connect_hook(DBusConnection *connection, void *data)
out_ctx2:
if (!libhal_ctx_shutdown(info->hal_ctx, &error))
- DebugF("[config/hal] couldn't shut down context: %s (%s)\n",
+ 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);
@@ -369,10 +516,13 @@ config_hal_init(void)
hal_info.hal_ctx = NULL;
if (!config_dbus_core_add_hook(&hook)) {
- ErrorF("[config/hal] failed to add D-Bus hook\n");
+ 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;
}
diff --git a/xserver/config/x11-input.fdi b/xserver/config/x11-input.fdi
index c390706fb..f2e2d50ab 100644
--- a/xserver/config/x11-input.fdi
+++ b/xserver/config/x11-input.fdi
@@ -1,7 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<deviceinfo version="0.2">
<device>
- <!-- FIXME: Support tablets too. -->
+
+ <!-- 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"
@@ -11,21 +61,21 @@
</match>
<match key="info.capabilities" contains="input.keys">
- <merge key="input.xkb.rules" type="string">base</merge>
+ <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.xkb.model" type="string">pc105</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.xkb.model" type="string">evdev</merge>
+ <merge key="input.x11_options.XkbModel" type="string">evdev</merge>
</match>
- <merge key="input.xkb.layout" type="string">us</merge>
+ <merge key="input.x11_options.XkbLayout" type="string">us</merge>
- <merge key="input.xkb.variant" type="string" />
+ <merge key="input.x11_options.XkbVariant" type="string" />
</match>
</device>
</deviceinfo>