With systemd-logind the dbus-core will be used for more then just config. This patch also makes the building of the dbus-core and udev no longer mutually exclusive and removes the config_ prefix from the dbus-core symbols.
Signed-off-by: Hans de Goede <[email protected]> --- config/Makefile.am | 12 +-- config/config-backends.h | 30 +----- config/config.c | 18 +--- config/dbus-core.c | 246 ------------------------------------------ config/hal.c | 7 +- configure.ac | 8 +- hw/xfree86/common/Makefile.am | 6 ++ hw/xfree86/common/dbus-core.c | 246 ++++++++++++++++++++++++++++++++++++++++++ hw/xfree86/common/xf86Init.c | 5 + include/Makefile.am | 2 +- include/dbus-core.h | 56 ++++++++++ include/dix-config.h.in | 4 +- 12 files changed, 333 insertions(+), 307 deletions(-) delete mode 100644 config/dbus-core.c create mode 100644 hw/xfree86/common/dbus-core.c create mode 100644 include/dbus-core.h diff --git a/config/Makefile.am b/config/Makefile.am index 0740e46..c5cd4fe 100644 --- a/config/Makefile.am +++ b/config/Makefile.am @@ -16,16 +16,10 @@ endif else -if CONFIG_NEED_DBUS -AM_CFLAGS += $(DBUS_CFLAGS) -libconfig_la_SOURCES += dbus-core.c -libconfig_la_LIBADD = $(DBUS_LIBS) - if CONFIG_HAL -AM_CFLAGS += $(HAL_CFLAGS) +AM_CFLAGS += $(DBUS_CFLAGS) $(HAL_CFLAGS) libconfig_la_SOURCES += hal.c -libconfig_la_LIBADD += $(HAL_LIBS) -endif +libconfig_la_LIBADD = $(HAL_LIBS) else @@ -33,7 +27,7 @@ if CONFIG_WSCONS libconfig_la_SOURCES += wscons.c endif # CONFIG_WSCONS -endif # CONFIG_NEED_DBUS +endif # !CONFIG_HAL endif # !CONFIG_UDEV diff --git a/config/config-backends.h b/config/config-backends.h index 5a715b3..5f07557 100644 --- a/config/config-backends.h +++ b/config/config-backends.h @@ -37,36 +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_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/config/config.c b/config/config.c index 554069f..760cf19 100644 --- a/config/config.c +++ b/config/config.c @@ -47,16 +47,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_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"); @@ -68,11 +61,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 - config_dbus_core_fini(); #elif defined(CONFIG_WSCONS) config_wscons_fini(); #endif diff --git a/config/dbus-core.c b/config/dbus-core.c deleted file mode 100644 index 768a984..0000000 --- a/config/dbus-core.c +++ /dev/null @@ -1,246 +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 <[email protected]> - */ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#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, void *arg); - -static void -wakeup_handler(void *data, int err, void *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(void *data, struct timeval **tv, void *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, void *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/config/hal.c b/config/hal.c index 2ead556..94cb6e7 100644 --- a/config/hal.c +++ b/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" @@ -631,7 +632,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, @@ -644,7 +645,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; } @@ -658,5 +659,5 @@ config_hal_init(void) void config_hal_fini(void) { - config_dbus_core_remove_hook(&hook); + dbus_core_remove_hook(&hook); } diff --git a/configure.ac b/configure.ac index 2ae09e0..c277593 100644 --- a/configure.ac +++ b/configure.ac @@ -898,14 +898,14 @@ if test "x$CONFIG_HAL" = xyes; then fi AC_DEFINE(CONFIG_HAL, 1, [Use the HAL hotplug API]) - CONFIG_NEED_DBUS="yes" + NEED_DBUS="yes" fi AM_CONDITIONAL(CONFIG_HAL, [test "x$CONFIG_HAL" = xyes]) -if test "x$CONFIG_NEED_DBUS" = xyes; then - AC_DEFINE(CONFIG_NEED_DBUS, 1, [Use D-Bus for input hotplug]) +if test "x$NEED_DBUS" = xyes; then + AC_DEFINE(NEED_DBUS, 1, [Enable D-Bus core]) fi -AM_CONDITIONAL(CONFIG_NEED_DBUS, [test "x$CONFIG_NEED_DBUS" = xyes]) +AM_CONDITIONAL(NEED_DBUS, [test "x$NEED_DBUS" = xyes]) if test "x$CONFIG_WSCONS" = xauto; then case $host_os in diff --git a/hw/xfree86/common/Makefile.am b/hw/xfree86/common/Makefile.am index 7a2b4bc..01a0047 100644 --- a/hw/xfree86/common/Makefile.am +++ b/hw/xfree86/common/Makefile.am @@ -104,3 +104,9 @@ XORG_CFLAGS += -DHAVE_ACPI endif AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) + +if NEED_DBUS +AM_CFLAGS += $(DBUS_CFLAGS) +libcommon_la_SOURCES += dbus-core.c +libcommon_la_LIBADD += $(DBUS_LIBS) +endif diff --git a/hw/xfree86/common/dbus-core.c b/hw/xfree86/common/dbus-core.c new file mode 100644 index 0000000..43d6281 --- /dev/null +++ b/hw/xfree86/common/dbus-core.c @@ -0,0 +1,246 @@ +/* + * 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 <[email protected]> + */ + +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#include <dbus/dbus.h> +#include <sys/select.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 */ + +struct dbus_core_info { + int fd; + DBusConnection *connection; + OsTimerPtr timer; + struct dbus_core_hook *hooks; +}; +static struct dbus_core_info bus_info; + +static CARD32 reconnect_timer(OsTimerPtr timer, CARD32 time, void *arg); + +static void +wakeup_handler(void *data, int err, void *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(void *data, struct timeval **tv, void *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 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("[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 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)) { + LogMessage(X_ERROR, "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("[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("[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, void *arg) +{ + if (connect_to_bus()) { + TimerFree(bus_info.timer); + bus_info.timer = NULL; + return 0; + } + else { + return RECONNECT_DELAY; + } +} + +int +dbus_core_add_hook(struct dbus_core_hook *hook) +{ + struct 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 +dbus_core_remove_hook(struct dbus_core_hook *hook) +{ + struct dbus_core_hook **prev; + + for (prev = &bus_info.hooks; *prev; prev = &(*prev)->next) { + if (*prev == hook) { + *prev = hook->next; + break; + } + } +} + +int +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 +dbus_core_fini(void) +{ + teardown(); +} diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c index c63fdcb..815f679 100644 --- a/hw/xfree86/common/xf86Init.c +++ b/hw/xfree86/common/xf86Init.c @@ -53,6 +53,7 @@ #include "scrnintstr.h" #include "site.h" #include "mi.h" +#include "dbus-core.h" #include "compiler.h" @@ -456,6 +457,8 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv) if (xf86DoShowOptions) DoShowOptions(); + dbus_core_init(); + /* Do a general bus probe. This will be a PCI probe for x86 platforms */ xf86BusProbe(); @@ -1059,6 +1062,8 @@ ddxGiveUp(enum ExitCode error) if (xorgHWOpenConsole) xf86CloseConsole(); + dbus_core_fini(); + xf86CloseLog(error); /* If an unexpected signal was caught, dump a core for debugging */ diff --git a/include/Makefile.am b/include/Makefile.am index 93d8616..fa6da00 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -68,7 +68,7 @@ endif AM_CFLAGS = $(DIX_CFLAGS) EXTRA_DIST = \ - busfault.h \ + busfault.h dbus-core.h \ dix-config-apple-verbatim.h \ dixfontstubs.h eventconvert.h eventstr.h inpututils.h \ protocol-versions.h \ diff --git a/include/dbus-core.h b/include/dbus-core.h new file mode 100644 index 0000000..b2d6d1b --- /dev/null +++ b/include/dbus-core.h @@ -0,0 +1,56 @@ +/* + * Copyright © 2013 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: Hans de Goede <[email protected]> + */ + +#ifndef DBUS_CORE_H +#define DBUS_CORE_H + +#ifdef NEED_DBUS +typedef struct DBusConnection DBusConnection; + +typedef void (*dbus_core_connect_hook) (DBusConnection * connection, + void *data); +typedef void (*dbus_core_disconnect_hook) (void *data); + +struct dbus_core_hook { + dbus_core_connect_hook connect; + dbus_core_disconnect_hook disconnect; + void *data; + + struct dbus_core_hook *next; +}; + +int dbus_core_init(void); +void dbus_core_fini(void); +int dbus_core_add_hook(struct dbus_core_hook *hook); +void dbus_core_remove_hook(struct dbus_core_hook *hook); + +#else + +#define dbus_core_init() +#define dbus_core_fini() + +#endif + +#endif diff --git a/include/dix-config.h.in b/include/dix-config.h.in index 774a787..caea9b2 100644 --- a/include/dix-config.h.in +++ b/include/dix-config.h.in @@ -414,8 +414,8 @@ /* Use udev_enumerate_add_match_tag() */ #undef HAVE_UDEV_ENUMERATE_ADD_MATCH_TAG -/* Use D-Bus for input hotplug */ -#undef CONFIG_NEED_DBUS +/* Enable D-Bus core */ +#undef NEED_DBUS /* Support HAL for hotplug */ #undef CONFIG_HAL -- 1.8.4.2 _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
