commit 210eeef495770c1883c842ff003c28ce25f279d4 Author: Peter Hutterer Date: Sat Jan 26 09:39:54 2008 +1030 config: don't reset connection info on disconnect. If dbus is restarted, we try to connect again and this is difficult if the busname and/or busobject is not set. diff --git a/config/dbus.c b/config/dbus.c index f6ac4c1..0be42af 100644 --- a/config/dbus.c +++ b/config/dbus.c @@ -396,9 +396,6 @@ err_start: static void disconnect_hook(void *data) { - struct connection_info *info = data; - - reset_info(info); } #if 0 @@ -440,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'; } commit d23266522390a4ef7203ae7c062b2b920e45f9d7 Author: Peter Hutterer Date: Fri Jan 25 13:54:47 2008 +1030 config: check connection != NULL before getting dbus' dispatch status. diff --git a/config/dbus-core.c b/config/dbus-core.c index 9cf1530..b349c6e 100644 --- a/config/dbus-core.c +++ b/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); } } commit fb07fab2c07e7b0834724541dc47bfba02ba8574 Author: Peter Hutterer Date: Fri Jan 25 13:45:22 2008 +1030 config: only shutdown libhal if the connection is valid. Thanks to libdbus' extensive use of assert we won't just get an error, it'll bring the whole server down for us. diff --git a/config/hal.c b/config/hal.c index 52a0113..1575422 100644 --- a/config/hal.c +++ b/config/hal.c @@ -283,12 +283,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)) + DebugF("[config/hal] 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; commit 7732898aaa70e076000f6e6aa9420482896ed996 Author: Peter Hutterer Date: Fri Jan 25 11:48:13 2008 +1030 config: add a debug message, fix a whitespace error. diff --git a/config/hal.c b/config/hal.c index 4ab2961..52a0113 100644 --- a/config/hal.c +++ b/config/hal.c @@ -105,7 +105,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); + DebugF("[config/hal] getting %s on %s returned %s\n", name, udi, prop); if (prop) { ret = xstrdup(prop); libhal_free_string(prop); @@ -234,8 +234,9 @@ device_added(LibHalContext *hal_ctx, const char *udi) if (xkb_options) add_option(&options, "xkb_options", xkb_options); + DebugF("[config/hal] Adding device %s\n", name); if (NewInputDeviceRequest(options, &dev) != Success) { - DebugF("[config/hal] NewInputDeviceRequest failed\n"); + ErrorF("[config/hal] NewInputDeviceRequest failed\n"); dev = NULL; goto unwind; }