aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/config
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-03-23 10:05:55 +0100
committermarha <marha@users.sourceforge.net>2012-03-23 10:05:55 +0100
commit0f834b91a4768673833ab4917e87d86c237bb1a6 (patch)
tree363489504ed4b2d360259b8de4c9e392918e5d02 /xorg-server/config
parentfc72edebf875378459368c5383d9023730cbca54 (diff)
downloadvcxsrv-0f834b91a4768673833ab4917e87d86c237bb1a6.tar.gz
vcxsrv-0f834b91a4768673833ab4917e87d86c237bb1a6.tar.bz2
vcxsrv-0f834b91a4768673833ab4917e87d86c237bb1a6.zip
libX11 xserver fontconfig mesa pixman xkbcomp xkeyboard-config git update
23 Mar 2012
Diffstat (limited to 'xorg-server/config')
-rw-r--r--xorg-server/config/config.c31
-rw-r--r--xorg-server/config/dbus-core.c19
-rw-r--r--xorg-server/config/dbus.c38
-rw-r--r--xorg-server/config/hal.c263
-rw-r--r--xorg-server/config/udev.c58
-rw-r--r--xorg-server/config/wscons.c334
6 files changed, 382 insertions, 361 deletions
diff --git a/xorg-server/config/config.c b/xorg-server/config/config.c
index 0dae3ad68..2b96dbb74 100644
--- a/xorg-server/config/config.c
+++ b/xorg-server/config/config.c
@@ -40,21 +40,21 @@ config_init(void)
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
+#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
+#endif
}
else {
- ErrorF("[config] failed to initialise D-Bus core\n");
+ ErrorF("[config] failed to initialise D-Bus core\n");
}
#elif defined(CONFIG_WSCONS)
if (!config_wscons_init())
- ErrorF("[config] failed to initialise wscons\n");
+ ErrorF("[config] failed to initialise wscons\n");
#endif
}
@@ -64,12 +64,12 @@ config_fini(void)
#if defined(CONFIG_UDEV)
config_udev_fini();
#elif defined(CONFIG_NEED_DBUS)
-# ifdef CONFIG_HAL
+#ifdef CONFIG_HAL
config_hal_fini();
-# endif
-# ifdef CONFIG_DBUS_API
+#endif
+#ifdef CONFIG_DBUS_API
config_dbus_fini();
-# endif
+#endif
config_dbus_core_fini();
#elif defined(CONFIG_WSCONS)
config_wscons_fini();
@@ -112,18 +112,15 @@ device_is_duplicate(const char *config_info)
{
DeviceIntPtr dev;
- for (dev = inputInfo.devices; dev; dev = dev->next)
- {
+ for (dev = inputInfo.devices; dev; dev = dev->next) {
if (dev->config_info && (strcmp(dev->config_info, config_info) == 0))
return TRUE;
}
- for (dev = inputInfo.off_devices; dev; dev = dev->next)
- {
+ for (dev = inputInfo.off_devices; dev; dev = dev->next) {
if (dev->config_info && (strcmp(dev->config_info, config_info) == 0))
return TRUE;
}
return FALSE;
}
-
diff --git a/xorg-server/config/dbus-core.c b/xorg-server/config/dbus-core.c
index 4c5e10f51..324258718 100644
--- a/xorg-server/config/dbus-core.c
+++ b/xorg-server/config/dbus-core.c
@@ -35,7 +35,7 @@
#include "os.h"
/* How often to attempt reconnecting when we get booted off the bus. */
-#define RECONNECT_DELAY (10 * 1000) /* in ms */
+#define RECONNECT_DELAY (10 * 1000) /* in ms */
struct dbus_core_info {
int fd;
@@ -57,7 +57,8 @@ wakeup_handler(pointer data, int err, pointer read_mask)
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);
+ dbus_connection_get_dispatch_status(info->connection) ==
+ DBUS_DISPATCH_DATA_REMAINS);
}
}
@@ -105,13 +106,12 @@ teardown(void)
* careful to ignore anything we don't want to deal with here.
*/
static DBusHandlerResult
-message_filter(DBusConnection *connection, DBusMessage *message, void *data)
+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")) {
+ if (dbus_message_is_signal(message, DBUS_INTERFACE_LOCAL, "Disconnected")) {
DebugF("[config/dbus-core] disconnected from bus\n");
bus_info.connection = NULL;
teardown();
@@ -173,12 +173,12 @@ connect_to_bus(void)
return 1;
-err_fd:
+ err_fd:
bus_info.fd = -1;
-err_unref:
+ err_unref:
dbus_connection_unref(bus_info.connection);
bus_info.connection = NULL;
-err_begin:
+ err_begin:
dbus_error_free(&error);
return 0;
@@ -202,8 +202,7 @@ 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)
- ;
+ for (prev = &bus_info.hooks; *prev; prev = &(*prev)->next);
hook->next = NULL;
*prev = hook;
diff --git a/xorg-server/config/dbus.c b/xorg-server/config/dbus.c
index f0fc5686e..99a1537e1 100644
--- a/xorg-server/config/dbus.c
+++ b/xorg-server/config/dbus.c
@@ -33,7 +33,7 @@
#include <X11/X.h>
#include "config-backends.h"
-#include "opaque.h" /* for 'display': there should be a better way. */
+#include "opaque.h" /* for 'display': there should be a better way. */
#include "input.h"
#include "inputstr.h"
@@ -65,7 +65,7 @@ reset_info(struct connection_info *info)
}
static int
-add_device(DBusMessage *message, DBusMessage *reply, DBusError *error)
+add_device(DBusMessage * message, DBusMessage * reply, DBusError * error)
{
DBusMessageIter iter, reply_iter, subiter;
InputOption *input_options = NULL;
@@ -89,6 +89,7 @@ add_device(DBusMessage *message, DBusMessage *reply, DBusError *error)
/* 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)
@@ -145,7 +146,7 @@ add_device(DBusMessage *message, DBusMessage *reply, DBusError *error)
}
}
-unwind:
+ unwind:
if (ret != Success) {
if (dev)
RemoveDevice(dev, TRUE);
@@ -160,7 +161,7 @@ unwind:
}
static int
-remove_device(DBusMessage *message, DBusMessage *reply, DBusError *error)
+remove_device(DBusMessage * message, DBusMessage * reply, DBusError * error)
{
int deviceid, ret, err;
DeviceIntPtr dev;
@@ -196,7 +197,7 @@ remove_device(DBusMessage *message, DBusMessage *reply, DBusError *error)
ret = Success;
-unwind:
+ unwind:
err = (ret == Success) ? ret : -ret;
dbus_message_iter_append_basic(&reply_iter, DBUS_TYPE_INT32, &err);
@@ -204,7 +205,7 @@ unwind:
}
static int
-list_devices(DBusMessage *message, DBusMessage *reply, DBusError *error)
+list_devices(DBusMessage * message, DBusMessage * reply, DBusError * error)
{
DeviceIntPtr dev;
DBusMessageIter iter, subiter;
@@ -237,7 +238,7 @@ list_devices(DBusMessage *message, DBusMessage *reply, DBusError *error)
}
static int
-get_version(DBusMessage *message, DBusMessage *reply, DBusError *error)
+get_version(DBusMessage * message, DBusMessage * reply, DBusError * error)
{
DBusMessageIter iter;
unsigned int version = API_VERSION;
@@ -252,7 +253,7 @@ get_version(DBusMessage *message, DBusMessage *reply, DBusError *error)
}
static DBusHandlerResult
-message_handler(DBusConnection *connection, DBusMessage *message, void *data)
+message_handler(DBusConnection * connection, DBusMessage * message, void *data)
{
DBusError error;
DBusMessage *reply;
@@ -301,19 +302,19 @@ message_handler(DBusConnection *connection, DBusMessage *message, void *data)
ret = DBUS_HANDLER_RESULT_HANDLED;
-err_reply:
+ err_reply:
dbus_message_unref(reply);
-err_start:
+ err_start:
dbus_error_free(&error);
return ret;
}
static void
-connect_hook(DBusConnection *connection, void *data)
+connect_hook(DBusConnection * connection, void *data)
{
DBusError error;
- DBusObjectPathVTable vtable = { .message_function = message_handler, };
+ DBusObjectPathVTable vtable = {.message_function = message_handler, };
struct connection_info *info = data;
info->connection = connection;
@@ -336,8 +337,7 @@ connect_hook(DBusConnection *connection, void *data)
}
if (!dbus_connection_register_object_path(info->connection,
- info->busobject, &vtable,
- info)) {
+ info->busobject, &vtable, info)) {
ErrorF("[config/dbus] couldn't register object path\n");
goto err_match;
}
@@ -348,11 +348,11 @@ connect_hook(DBusConnection *connection, void *data)
return;
-err_match:
+ err_match:
dbus_bus_remove_match(info->connection, MATCH_RULE, &error);
-err_name:
+ err_name:
dbus_bus_release_name(info->connection, info->busname, &error);
-err_start:
+ err_start:
dbus_error_free(&error);
reset_info(info);
@@ -372,8 +372,7 @@ pre_disconnect_hook(void)
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_remove_match(connection_data->connection, MATCH_RULE, &error);
dbus_bus_release_name(connection_data->connection,
connection_data->busname, &error);
dbus_error_free(&error);
@@ -381,6 +380,7 @@ pre_disconnect_hook(void)
#endif
static struct connection_info connection_data;
+
static struct config_dbus_core_hook core_hook = {
.connect = connect_hook,
.disconnect = disconnect_hook,
diff --git a/xorg-server/config/hal.c b/xorg-server/config/hal.c
index 088c9939d..2ead556b0 100644
--- a/xorg-server/config/hal.c
+++ b/xorg-server/config/hal.c
@@ -39,11 +39,9 @@
#include "config-backends.h"
#include "os.h"
-
#define LIBHAL_PROP_KEY "input.x11_options."
#define LIBHAL_XKB_PROP_KEY "input.xkb."
-
struct config_hal_info {
DBusConnection *system_bus;
LibHalContext *hal_ctx;
@@ -51,19 +49,19 @@ struct config_hal_info {
/* Used for special handling of xkb options. */
struct xkb_options {
- char* layout;
- char* model;
- char* rules;
- char* variant;
- char* options;
+ char *layout;
+ char *model;
+ char *rules;
+ char *variant;
+ char *options;
};
static void
-device_removed(LibHalContext *ctx, const char *udi)
+device_removed(LibHalContext * ctx, const char *udi)
{
char *value;
- if (asprintf (&value, "hal:%s", udi) == -1)
+ if (asprintf(&value, "hal:%s", udi) == -1)
return;
remove_devices("hal", value);
@@ -72,12 +70,13 @@ device_removed(LibHalContext *ctx, const char *udi)
}
static char *
-get_prop_string(LibHalContext *hal_ctx, const char *udi, const char *name)
+get_prop_string(LibHalContext * hal_ctx, const char *udi, const char *name)
{
char *prop, *ret;
prop = libhal_device_get_property_string(hal_ctx, udi, name, NULL);
- LogMessageVerb(X_INFO, 10, "config/hal: getting %s on %s returned %s\n", name, udi, prop ? prop : "(null)");
+ LogMessageVerb(X_INFO, 10, "config/hal: getting %s on %s returned %s\n",
+ name, udi, prop ? prop : "(null)");
if (prop) {
ret = strdup(prop);
libhal_free_string(prop);
@@ -90,7 +89,8 @@ get_prop_string(LibHalContext *hal_ctx, const char *udi, const char *name)
}
static char *
-get_prop_string_array(LibHalContext *hal_ctx, const char *udi, const char *prop)
+get_prop_string_array(LibHalContext * hal_ctx, const char *udi,
+ const char *prop)
{
char **props, *ret, *str;
int i, len = 0;
@@ -100,7 +100,7 @@ get_prop_string_array(LibHalContext *hal_ctx, const char *udi, const char *prop)
for (i = 0; props[i]; i++)
len += strlen(props[i]);
- ret = calloc(sizeof(char), len + i); /* i - 1 commas, 1 NULL */
+ ret = calloc(sizeof(char), len + i); /* i - 1 commas, 1 NULL */
if (!ret) {
libhal_free_string_array(props);
return NULL;
@@ -112,7 +112,7 @@ get_prop_string_array(LibHalContext *hal_ctx, const char *udi, const char *prop)
str += strlen(props[i]);
*str++ = ',';
}
- *(str-1) = '\0';
+ *(str - 1) = '\0';
libhal_free_string_array(props);
}
@@ -124,34 +124,35 @@ get_prop_string_array(LibHalContext *hal_ctx, const char *udi, const char *prop)
}
static void
-device_added(LibHalContext *hal_ctx, const char *udi)
+device_added(LibHalContext * hal_ctx, const char *udi)
{
char *path = NULL, *driver = NULL, *name = NULL, *config_info = NULL;
char *hal_tags, *parent;
InputOption *input_options = NULL;
- InputAttributes attrs = {0};
+ InputAttributes attrs = { 0 };
DeviceIntPtr dev = NULL;
DBusError error;
- struct xkb_options xkb_opts = {0};
+ struct xkb_options xkb_opts = { 0 };
int rc;
LibHalPropertySet *set = NULL;
- LibHalPropertySetIterator set_iter;
+ LibHalPropertySetIterator set_iter;
char *psi_key = NULL, *tmp_val;
-
dbus_error_init(&error);
driver = get_prop_string(hal_ctx, udi, "input.x11_driver");
- if (!driver){
+ 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);
+ LogMessageVerb(X_INFO, 7,
+ "config/hal: no driver specified for device %s\n", udi);
goto unwind;
}
path = get_prop_string(hal_ctx, udi, "input.device");
if (!path) {
- LogMessage(X_WARNING,"config/hal: no driver or path specified for %s\n", udi);
+ LogMessage(X_WARNING,
+ "config/hal: no driver or path specified for %s\n", udi);
goto unwind;
}
attrs.device = strdup(path);
@@ -199,15 +200,16 @@ device_added(LibHalContext *hal_ctx, const char *udi)
"returned %04x\n", parent, usb_product);
if (usb_vendor && usb_product)
if (asprintf(&attrs.usb_id, "%04x:%04x", usb_vendor, usb_product)
- == -1)
- attrs.usb_id = NULL;
+ == -1)
+ attrs.usb_id = NULL;
free(parent);
}
input_options = input_option_new(NULL, "_source", "server/hal");
if (!input_options) {
- LogMessage(X_ERROR, "config/hal: couldn't allocate first key/value pair\n");
+ LogMessage(X_ERROR,
+ "config/hal: couldn't allocate first key/value pair\n");
goto unwind;
}
@@ -219,44 +221,46 @@ device_added(LibHalContext *hal_ctx, const char *udi)
input_options = input_option_new(input_options, "driver", driver);
input_options = input_option_new(input_options, "name", name);
- if (asprintf (&config_info, "hal:%s", udi) == -1) {
+ if (asprintf(&config_info, "hal:%s", udi) == -1) {
config_info = NULL;
LogMessage(X_ERROR, "config/hal: couldn't allocate name\n");
goto unwind;
}
/* Check for duplicate devices */
- if (device_is_duplicate(config_info))
- {
- LogMessage(X_WARNING, "config/hal: device %s already added. Ignoring.\n", name);
+ if (device_is_duplicate(config_info)) {
+ LogMessage(X_WARNING,
+ "config/hal: device %s already added. Ignoring.\n", name);
goto unwind;
}
/* ok, grab options from hal.. iterate through all properties
- * and lets see if any of them are options that we can add */
+ * 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);
+ 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);
+ 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){
+ if (psi_key) {
/* normal options first (input.x11_options.<propname>) */
- if (!strncasecmp(psi_key, LIBHAL_PROP_KEY, sizeof(LIBHAL_PROP_KEY)-1)){
- char* tmp;
+ 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){
+ if (tmp_val) {
/* xkb needs special handling. HAL specs include
* input.xkb.xyz options, but the x11-input.fdi specifies
@@ -265,49 +269,53 @@ device_added(LibHalContext *hal_ctx, const char *udi)
* 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 ((tmp = strcasestr(psi_key, "xkb")) && strlen(tmp) >= 4) {
+ if (!strcasecmp(&tmp[3], "layout")) {
free(xkb_opts.layout);
xkb_opts.layout = strdup(tmp_val);
- } else if (!strcasecmp(&tmp[3], "model"))
- {
+ }
+ else if (!strcasecmp(&tmp[3], "model")) {
free(xkb_opts.model);
xkb_opts.model = strdup(tmp_val);
- } else if (!strcasecmp(&tmp[3], "rules"))
- {
+ }
+ else if (!strcasecmp(&tmp[3], "rules")) {
free(xkb_opts.rules);
xkb_opts.rules = strdup(tmp_val);
- } else if (!strcasecmp(&tmp[3], "variant"))
- {
+ }
+ else if (!strcasecmp(&tmp[3], "variant")) {
free(xkb_opts.variant);
xkb_opts.variant = strdup(tmp_val);
- } else if (!strcasecmp(&tmp[3], "options"))
- {
+ }
+ else if (!strcasecmp(&tmp[3], "options")) {
free(xkb_opts.options);
xkb_opts.options = strdup(tmp_val);
}
- } else
- {
+ }
+ else {
/* all others */
- input_options = input_option_new(input_options, psi_key + sizeof(LIBHAL_PROP_KEY)-1, tmp_val);
+ input_options =
+ input_option_new(input_options,
+ psi_key + sizeof(LIBHAL_PROP_KEY) -
+ 1, tmp_val);
free(tmp_val);
}
- } else
- {
+ }
+ 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)))
- {
+ (tmp_val =
+ get_prop_string_array(hal_ctx, udi, psi_key))) {
free(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;
+ }
+ 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);
@@ -316,34 +324,33 @@ device_added(LibHalContext *hal_ctx, const char *udi)
tmp = &psi_key[sizeof(LIBHAL_XKB_PROP_KEY) - 1];
- if (!strcasecmp(tmp, "layout"))
- {
+ if (!strcasecmp(tmp, "layout")) {
if (!xkb_opts.layout)
xkb_opts.layout = strdup(tmp_val);
- } else if (!strcasecmp(tmp, "rules"))
- {
+ }
+ else if (!strcasecmp(tmp, "rules")) {
if (!xkb_opts.rules)
xkb_opts.rules = strdup(tmp_val);
- } else if (!strcasecmp(tmp, "variant"))
- {
+ }
+ else if (!strcasecmp(tmp, "variant")) {
if (!xkb_opts.variant)
xkb_opts.variant = strdup(tmp_val);
- } else if (!strcasecmp(tmp, "model"))
- {
+ }
+ else if (!strcasecmp(tmp, "model")) {
if (!xkb_opts.model)
xkb_opts.model = strdup(tmp_val);
- } else if (!strcasecmp(tmp, "options"))
- {
+ }
+ else if (!strcasecmp(tmp, "options")) {
if (!xkb_opts.options)
xkb_opts.options = strdup(tmp_val);
}
free(tmp_val);
- } else
- {
+ }
+ 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))
- {
+ 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);
@@ -357,29 +364,34 @@ device_added(LibHalContext *hal_ctx, const char *udi)
libhal_psi_next(&set_iter);
}
-
/* Now add xkb options */
if (xkb_opts.layout)
- input_options = input_option_new(input_options, "xkb_layout", xkb_opts.layout);
+ input_options =
+ input_option_new(input_options, "xkb_layout", xkb_opts.layout);
if (xkb_opts.rules)
- input_options = input_option_new(input_options, "xkb_rules", xkb_opts.rules);
+ input_options =
+ input_option_new(input_options, "xkb_rules", xkb_opts.rules);
if (xkb_opts.variant)
- input_options = input_option_new(input_options, "xkb_variant", xkb_opts.variant);
+ input_options =
+ input_option_new(input_options, "xkb_variant", xkb_opts.variant);
if (xkb_opts.model)
- input_options = input_option_new(input_options, "xkb_model", xkb_opts.model);
+ input_options =
+ input_option_new(input_options, "xkb_model", xkb_opts.model);
if (xkb_opts.options)
- input_options = input_option_new(input_options, "xkb_options", xkb_opts.options);
+ input_options =
+ input_option_new(input_options, "xkb_options", xkb_opts.options);
input_options = input_option_new(input_options, "config_info", config_info);
/* 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 ((rc = NewInputDeviceRequest(input_options, &attrs, &dev)) != Success) {
- LogMessage(X_ERROR, "config/hal: NewInputDeviceRequest failed (%d)\n", rc);
+ LogMessage(X_ERROR, "config/hal: NewInputDeviceRequest failed (%d)\n",
+ rc);
dev = NULL;
goto unwind;
}
-unwind:
+ unwind:
if (set)
libhal_free_property_set(set);
free(path);
@@ -395,6 +407,7 @@ unwind:
free(attrs.usb_id);
if (attrs.tags) {
char **tag = attrs.tags;
+
while (*tag) {
free(*tag);
tag++;
@@ -423,8 +436,9 @@ disconnect_hook(void *data)
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);
+ 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);
@@ -435,14 +449,14 @@ disconnect_hook(void *data)
}
static BOOL
-connect_and_register(DBusConnection *connection, struct config_hal_info *info)
+connect_and_register(DBusConnection * connection, struct config_hal_info *info)
{
DBusError error;
char **devices;
int num_devices, i;
if (info->hal_ctx)
- return TRUE; /* already registered, pretend we did something */
+ return TRUE; /* already registered, pretend we did something */
info->system_bus = connection;
@@ -455,19 +469,22 @@ connect_and_register(DBusConnection *connection, struct config_hal_info *info)
}
if (!libhal_ctx_set_dbus_connection(info->hal_ctx, info->system_bus)) {
- LogMessage(X_ERROR, "config/hal: couldn't associate HAL context with bus\n");
+ LogMessage(X_ERROR,
+ "config/hal: couldn't associate HAL context with bus\n");
goto out_err;
}
if (!libhal_ctx_init(info->hal_ctx, &error)) {
- LogMessage(X_ERROR, "config/hal: couldn't initialise context: %s (%s)\n",
- error.name ? error.name : "unknown error",
- error.message ? error.message : "null");
+ LogMessage(X_ERROR,
+ "config/hal: couldn't initialise context: %s (%s)\n",
+ error.name ? error.name : "unknown error",
+ error.message ? error.message : "null");
goto out_err;
}
if (!libhal_device_property_watch_all(info->hal_ctx, &error)) {
- LogMessage(X_ERROR, "config/hal: couldn't watch all properties: %s (%s)\n",
- error.name ? error.name : "unknown error",
- error.message ? error.message : "null");
+ LogMessage(X_ERROR,
+ "config/hal: couldn't watch all properties: %s (%s)\n",
+ error.name ? error.name : "unknown error",
+ error.message ? error.message : "null");
goto out_ctx;
}
libhal_ctx_set_device_added(info->hal_ctx, device_added);
@@ -478,8 +495,8 @@ connect_and_register(DBusConnection *connection, struct config_hal_info *info)
/* FIXME: Get default devices if error is set. */
if (dbus_error_is_set(&error)) {
LogMessage(X_ERROR, "config/hal: couldn't find input device: %s (%s)\n",
- error.name ? error.name : "unknown error",
- error.message ? error.message : "null");
+ error.name ? error.name : "unknown error",
+ error.message ? error.message : "null");
goto out_ctx;
}
for (i = 0; i < num_devices; i++)
@@ -490,17 +507,18 @@ connect_and_register(DBusConnection *connection, struct config_hal_info *info)
return TRUE;
-out_ctx:
+ out_ctx:
dbus_error_free(&error);
if (!libhal_ctx_shutdown(info->hal_ctx, &error)) {
- LogMessage(X_WARNING, "config/hal: couldn't shut down context: %s (%s)\n",
- error.name ? error.name : "unknown error",
- error.message ? error.message : "null");
+ LogMessage(X_WARNING,
+ "config/hal: couldn't shut down context: %s (%s)\n",
+ error.name ? error.name : "unknown error",
+ error.message ? error.message : "null");
dbus_error_free(&error);
}
-out_err:
+ out_err:
dbus_error_free(&error);
if (info->hal_ctx) {
@@ -513,7 +531,6 @@ out_err:
return FALSE;
}
-
/**
* Handle NewOwnerChanged signals to deal with HAL startup at X server runtime.
*
@@ -523,13 +540,13 @@ out_err:
* owner.
*/
static DBusHandlerResult
-ownerchanged_handler(DBusConnection *connection, DBusMessage *message, void *data)
+ownerchanged_handler(DBusConnection * connection, DBusMessage * message,
+ void *data)
{
int ret = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
if (dbus_message_is_signal(message,
- "org.freedesktop.DBus",
- "NameOwnerChanged")) {
+ "org.freedesktop.DBus", "NameOwnerChanged")) {
DBusError error;
char *name, *old_owner, *new_owner;
@@ -537,19 +554,21 @@ ownerchanged_handler(DBusConnection *connection, DBusMessage *message, void *dat
dbus_message_get_args(message, &error,
DBUS_TYPE_STRING, &name,
DBUS_TYPE_STRING, &old_owner,
- DBUS_TYPE_STRING, &new_owner,
- DBUS_TYPE_INVALID);
+ DBUS_TYPE_STRING, &new_owner, DBUS_TYPE_INVALID);
if (dbus_error_is_set(&error)) {
- ErrorF("[config/hal] failed to get NameOwnerChanged args: %s (%s)\n",
- error.name, error.message);
- } else if (name && strcmp(name, "org.freedesktop.Hal") == 0) {
+ ErrorF
+ ("[config/hal] failed to get NameOwnerChanged args: %s (%s)\n",
+ error.name, error.message);
+ }
+ else if (name && strcmp(name, "org.freedesktop.Hal") == 0) {
if (!old_owner || !strlen(old_owner)) {
DebugF("[config/hal] HAL startup detected.\n");
- if (connect_and_register(connection, (struct config_hal_info*)data))
+ if (connect_and_register
+ (connection, (struct config_hal_info *) data))
dbus_connection_unregister_object_path(connection,
- "/org/freedesktop/DBus");
+ "/org/freedesktop/DBus");
else
ErrorF("[config/hal] Failed to connect to HAL bus.\n");
}
@@ -566,30 +585,29 @@ ownerchanged_handler(DBusConnection *connection, DBusMessage *message, void *dat
* Register a handler for the NameOwnerChanged signal.
*/
static BOOL
-listen_for_startup(DBusConnection *connection, void *data)
+listen_for_startup(DBusConnection * connection, void *data)
{
- DBusObjectPathVTable vtable = { .message_function = ownerchanged_handler, };
+ DBusObjectPathVTable vtable = {.message_function = ownerchanged_handler, };
DBusError error;
const char MATCH_RULE[] = "sender='org.freedesktop.DBus',"
- "interface='org.freedesktop.DBus',"
- "type='signal',"
- "path='/org/freedesktop/DBus',"
- "member='NameOwnerChanged'";
+ "interface='org.freedesktop.DBus',"
+ "type='signal',"
+ "path='/org/freedesktop/DBus'," "member='NameOwnerChanged'";
int rc = FALSE;
dbus_error_init(&error);
dbus_bus_add_match(connection, MATCH_RULE, &error);
if (!dbus_error_is_set(&error)) {
if (dbus_connection_register_object_path(connection,
- "/org/freedesktop/DBus",
- &vtable,
- data))
+ "/org/freedesktop/DBus",
+ &vtable, data))
rc = TRUE;
else
ErrorF("[config/hal] cannot register object path.\n");
- } else {
+ }
+ else {
ErrorF("[config/hal] couldn't add match rule: %s (%s)\n", error.name,
- error.message);
+ error.message);
ErrorF("[config/hal] cannot detect a HAL startup.\n");
}
@@ -599,7 +617,7 @@ listen_for_startup(DBusConnection *connection, void *data)
}
static void
-connect_hook(DBusConnection *connection, void *data)
+connect_hook(DBusConnection * connection, void *data)
{
struct config_hal_info *info = data;
@@ -612,6 +630,7 @@ connect_hook(DBusConnection *connection, void *data)
}
static struct config_hal_info hal_info;
+
static struct config_dbus_core_hook hook = {
.connect = connect_hook,
.disconnect = disconnect_hook,
@@ -631,7 +650,7 @@ config_hal_init(void)
}
/* verbose message */
- LogMessageVerb(X_INFO,7,"config/hal: initialized\n");
+ LogMessageVerb(X_INFO, 7, "config/hal: initialized\n");
return 1;
}
diff --git a/xorg-server/config/udev.c b/xorg-server/config/udev.c
index e2b3726cc..8b3ca0475 100644
--- a/xorg-server/config/udev.c
+++ b/xorg-server/config/udev.c
@@ -61,7 +61,7 @@ device_added(struct udev_device *udev_device)
const char *tags_prop;
const char *key, *value, *tmp;
InputOption *input_options;
- InputAttributes attrs = {};
+ InputAttributes attrs = { };
DeviceIntPtr dev = NULL;
struct udev_list_entry *set, *entry;
struct udev_device *parent;
@@ -88,8 +88,7 @@ device_added(struct udev_device *udev_device)
if (!udev_device_get_property_value(udev_device, "ID_INPUT")) {
LogMessageVerb(X_INFO, 10,
"config/udev: ignoring device %s without "
- "property ID_INPUT set\n",
- path);
+ "property ID_INPUT set\n", path);
return;
}
@@ -116,7 +115,8 @@ device_added(struct udev_device *udev_device)
LOG_SYSATTR(ppath, "id", pnp_id);
/* construct USB ID in lowercase hex - "0000:ffff" */
- if (product && sscanf(product, "%*x/%4x/%4x/%*x", &usb_vendor, &usb_model) == 2) {
+ if (product &&
+ sscanf(product, "%*x/%4x/%4x/%*x", &usb_vendor, &usb_model) == 2) {
if (asprintf(&attrs.usb_id, "%04x:%04x", usb_vendor, usb_model)
== -1)
attrs.usb_id = NULL;
@@ -145,7 +145,7 @@ device_added(struct udev_device *udev_device)
if (device_is_duplicate(config_info)) {
LogMessage(X_WARNING, "config/udev: device %s already added. "
- "Ignoring.\n", name);
+ "Ignoring.\n", name);
goto unwind;
}
@@ -155,39 +155,50 @@ device_added(struct udev_device *udev_device)
if (!key)
continue;
value = udev_list_entry_get_value(entry);
- if (!strncasecmp(key, UDEV_XKB_PROP_KEY,
- sizeof(UDEV_XKB_PROP_KEY) - 1)) {
+ if (!strncasecmp(key, UDEV_XKB_PROP_KEY, sizeof(UDEV_XKB_PROP_KEY) - 1)) {
LOG_PROPERTY(path, key, value);
tmp = key + sizeof(UDEV_XKB_PROP_KEY) - 1;
if (!strcasecmp(tmp, "rules"))
- input_options = input_option_new(input_options, "xkb_rules", value);
+ input_options =
+ input_option_new(input_options, "xkb_rules", value);
else if (!strcasecmp(tmp, "layout"))
- input_options = input_option_new(input_options, "xkb_layout", value);
+ input_options =
+ input_option_new(input_options, "xkb_layout", value);
else if (!strcasecmp(tmp, "variant"))
- input_options = input_option_new(input_options, "xkb_variant", value);
+ input_options =
+ input_option_new(input_options, "xkb_variant", value);
else if (!strcasecmp(tmp, "model"))
- input_options = input_option_new(input_options, "xkb_model", value);
+ input_options =
+ input_option_new(input_options, "xkb_model", value);
else if (!strcasecmp(tmp, "options"))
- input_options = input_option_new(input_options, "xkb_options", value);
- } else if (!strcmp(key, "ID_VENDOR")) {
+ input_options =
+ input_option_new(input_options, "xkb_options", value);
+ }
+ else if (!strcmp(key, "ID_VENDOR")) {
LOG_PROPERTY(path, key, value);
attrs.vendor = strdup(value);
- } else if (!strcmp(key, "ID_INPUT_KEY")) {
+ }
+ else if (!strcmp(key, "ID_INPUT_KEY")) {
LOG_PROPERTY(path, key, value);
attrs.flags |= ATTR_KEYBOARD;
- } else if (!strcmp(key, "ID_INPUT_MOUSE")) {
+ }
+ else if (!strcmp(key, "ID_INPUT_MOUSE")) {
LOG_PROPERTY(path, key, value);
attrs.flags |= ATTR_POINTER;
- } else if (!strcmp(key, "ID_INPUT_JOYSTICK")) {
+ }
+ else if (!strcmp(key, "ID_INPUT_JOYSTICK")) {
LOG_PROPERTY(path, key, value);
attrs.flags |= ATTR_JOYSTICK;
- } else if (!strcmp(key, "ID_INPUT_TABLET")) {
+ }
+ else if (!strcmp(key, "ID_INPUT_TABLET")) {
LOG_PROPERTY(path, key, value);
attrs.flags |= ATTR_TABLET;
- } else if (!strcmp(key, "ID_INPUT_TOUCHPAD")) {
+ }
+ else if (!strcmp(key, "ID_INPUT_TOUCHPAD")) {
LOG_PROPERTY(path, key, value);
attrs.flags |= ATTR_TOUCHPAD;
- } else if (!strcmp(key, "ID_INPUT_TOUCHSCREEN")) {
+ }
+ else if (!strcmp(key, "ID_INPUT_TOUCHSCREEN")) {
LOG_PROPERTY(path, key, value);
attrs.flags |= ATTR_TOUCHSCREEN;
}
@@ -212,6 +223,7 @@ device_added(struct udev_device *udev_device)
free(attrs.vendor);
if (attrs.tags) {
char **tag = attrs.tags;
+
while (*tag) {
free(*tag);
tag++;
@@ -246,7 +258,7 @@ wakeup_handler(pointer data, int err, pointer read_mask)
if (err < 0)
return;
- if (FD_ISSET(udev_fd, (fd_set *)read_mask)) {
+ if (FD_ISSET(udev_fd, (fd_set *) read_mask)) {
udev_device = udev_monitor_receive_device(udev_monitor);
if (!udev_device)
return;
@@ -282,7 +294,8 @@ config_udev_init(void)
if (!udev_monitor)
return 0;
- udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "input", NULL);
+ udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "input",
+ NULL);
udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "tty", NULL); /* For Wacom serial devices */
#ifdef HAVE_UDEV_MONITOR_FILTER_ADD_MATCH_TAG
@@ -311,7 +324,8 @@ config_udev_init(void)
devices = udev_enumerate_get_list_entry(enumerate);
udev_list_entry_foreach(device, devices) {
const char *syspath = udev_list_entry_get_name(device);
- struct udev_device *udev_device = udev_device_new_from_syspath(udev, syspath);
+ struct udev_device *udev_device =
+ udev_device_new_from_syspath(udev, syspath);
/* Device might be gone by the time we try to open it */
if (!udev_device)
diff --git a/xorg-server/config/wscons.c b/xorg-server/config/wscons.c
index 27c1f6348..7a5e8cc10 100644
--- a/xorg-server/config/wscons.c
+++ b/xorg-server/config/wscons.c
@@ -50,219 +50,211 @@
{ KB_CF, "ca" }
struct nameint {
- int val;
- char *name;
-} kbdenc[] = { KB_OVRENC, KB_ENCTAB, { 0 } };
+ int val;
+ char *name;
+} kbdenc[] = {
+ KB_OVRENC, KB_ENCTAB, {
+0}};
struct nameint kbdvar[] = {
- { KB_NODEAD | KB_SG, "de_nodeadkeys" },
- { KB_NODEAD | KB_SF, "fr_nodeadkeys" },
- { KB_SF, "fr" },
- { KB_DVORAK | KB_CF, "fr-dvorak" },
- { KB_DVORAK | KB_FR, "bepo" },
- { KB_DVORAK, "dvorak" },
- { KB_CF, "fr-legacy" },
- { KB_NODEAD, "nodeadkeys" },
- { 0 }
+ {KB_NODEAD | KB_SG, "de_nodeadkeys"},
+ {KB_NODEAD | KB_SF, "fr_nodeadkeys"},
+ {KB_SF, "fr"},
+ {KB_DVORAK | KB_CF, "fr-dvorak"},
+ {KB_DVORAK | KB_FR, "bepo"},
+ {KB_DVORAK, "dvorak"},
+ {KB_CF, "fr-legacy"},
+ {KB_NODEAD, "nodeadkeys"},
+ {0}
};
struct nameint kbdopt[] = {
- { KB_SWAPCTRLCAPS, "ctrl:swapcaps" },
- { 0 }
+ {KB_SWAPCTRLCAPS, "ctrl:swapcaps"},
+ {0}
};
struct nameint kbdmodel[] = {
- { WSKBD_TYPE_ZAURUS, "zaurus" },
- { 0 }
+ {WSKBD_TYPE_ZAURUS, "zaurus"},
+ {0}
};
static void
wscons_add_keyboard(void)
{
- InputAttributes attrs = {};
- DeviceIntPtr dev = NULL;
- InputOption *input_options = NULL;
- char *config_info = NULL;
- int fd, i, rc;
- unsigned int type;
- kbd_t wsenc = 0;
+ InputAttributes attrs = { };
+ DeviceIntPtr dev = NULL;
+ InputOption *input_options = NULL;
+ char *config_info = NULL;
+ int fd, i, rc;
+ unsigned int type;
+ kbd_t wsenc = 0;
- /* Find keyboard configuration */
- fd = open(WSCONS_KBD_DEVICE, O_RDWR | O_NONBLOCK | O_EXCL);
- if (fd == -1) {
- LogMessage(X_ERROR, "wskbd: open %s: %s\n",
- WSCONS_KBD_DEVICE, strerror(errno));
- return;
- }
- if (ioctl(fd, WSKBDIO_GETENCODING, &wsenc) == -1) {
- LogMessage(X_WARNING, "wskbd: ioctl(WSKBDIO_GETENCODING) "
- "failed: %s\n", strerror(errno));
- close(fd);
- return;
- }
- if (ioctl(fd, WSKBDIO_GTYPE, &type) == -1) {
- LogMessage(X_WARNING, "wskbd: ioctl(WSKBDIO_GTYPE) "
- "failed: %s\n", strerror(errno));
- close(fd);
- return;
- }
- close (fd);
+ /* Find keyboard configuration */
+ fd = open(WSCONS_KBD_DEVICE, O_RDWR | O_NONBLOCK | O_EXCL);
+ if (fd == -1) {
+ LogMessage(X_ERROR, "wskbd: open %s: %s\n",
+ WSCONS_KBD_DEVICE, strerror(errno));
+ return;
+ }
+ if (ioctl(fd, WSKBDIO_GETENCODING, &wsenc) == -1) {
+ LogMessage(X_WARNING, "wskbd: ioctl(WSKBDIO_GETENCODING) "
+ "failed: %s\n", strerror(errno));
+ close(fd);
+ return;
+ }
+ if (ioctl(fd, WSKBDIO_GTYPE, &type) == -1) {
+ LogMessage(X_WARNING, "wskbd: ioctl(WSKBDIO_GTYPE) "
+ "failed: %s\n", strerror(errno));
+ close(fd);
+ return;
+ }
+ close(fd);
- input_options = input_option_new(input_options, "_source",
- "server/wscons");
- if (input_options == NULL)
- return;
+ input_options = input_option_new(input_options, "_source", "server/wscons");
+ if (input_options == NULL)
+ return;
- LogMessage(X_INFO, "config/wscons: checking input device %s\n",
- WSCONS_KBD_DEVICE);
- input_options = input_option_new(input_options, "name",
- WSCONS_KBD_DEVICE);
- input_options = input_option_new(input_options, "driver", "kbd");
+ LogMessage(X_INFO, "config/wscons: checking input device %s\n",
+ WSCONS_KBD_DEVICE);
+ input_options = input_option_new(input_options, "name", WSCONS_KBD_DEVICE);
+ input_options = input_option_new(input_options, "driver", "kbd");
- config_info = Xprintf("wscons:%s", WSCONS_KBD_DEVICE);
- if (!config_info)
- goto unwind;
- if (KB_ENCODING(wsenc) == KB_USER) {
- /* Ignore wscons "user" layout */
- LogMessageVerb(X_INFO, 3, "wskbd: ignoring \"user\" layout\n");
- goto kbd_config_done;
- }
- for (i = 0; kbdenc[i].val; i++)
- if(KB_ENCODING(wsenc) == kbdenc[i].val) {
- LogMessageVerb(X_INFO, 3, "wskbd: using layout %s\n",
- kbdenc[i].name);
- input_options = input_option_new(input_options,
- "xkb_layout", kbdenc[i].name);
- break;
- }
- for (i = 0; kbdvar[i].val; i++)
- if (wsenc == kbdvar[i].val ||
- KB_VARIANT(wsenc) == kbdvar[i].val) {
- LogMessageVerb(X_INFO, 3, "wskbd: using variant %s\n",
- kbdvar[i].name);
- input_options = input_option_new(input_options,
- "xkb_variant", kbdvar[i].name);
- break;
- }
- for (i = 0; kbdopt[i].val; i++)
- if (KB_VARIANT(wsenc) == kbdopt[i].val) {
- LogMessageVerb(X_INFO, 3, "wskbd: using option %s\n",
- kbdopt[i].name);
- input_options = input_option_new(input_options,
- "xkb_options", kbdopt[i].name);
- break;
- }
- for (i = 0; kbdmodel[i].val; i++)
- if (type == kbdmodel[i].val) {
- LogMessageVerb(X_INFO, 3, "wskbd: using model %s\n",
- kbdmodel[i].name);
- input_options = input_option_new(input_options,
- "xkb_model", kbdmodel[i].name);
- break;
- }
+ config_info = Xprintf("wscons:%s", WSCONS_KBD_DEVICE);
+ if (!config_info)
+ goto unwind;
+ if (KB_ENCODING(wsenc) == KB_USER) {
+ /* Ignore wscons "user" layout */
+ LogMessageVerb(X_INFO, 3, "wskbd: ignoring \"user\" layout\n");
+ goto kbd_config_done;
+ }
+ for (i = 0; kbdenc[i].val; i++)
+ if (KB_ENCODING(wsenc) == kbdenc[i].val) {
+ LogMessageVerb(X_INFO, 3, "wskbd: using layout %s\n",
+ kbdenc[i].name);
+ input_options = input_option_new(input_options,
+ "xkb_layout", kbdenc[i].name);
+ break;
+ }
+ for (i = 0; kbdvar[i].val; i++)
+ if (wsenc == kbdvar[i].val || KB_VARIANT(wsenc) == kbdvar[i].val) {
+ LogMessageVerb(X_INFO, 3, "wskbd: using variant %s\n",
+ kbdvar[i].name);
+ input_options = input_option_new(input_options,
+ "xkb_variant", kbdvar[i].name);
+ break;
+ }
+ for (i = 0; kbdopt[i].val; i++)
+ if (KB_VARIANT(wsenc) == kbdopt[i].val) {
+ LogMessageVerb(X_INFO, 3, "wskbd: using option %s\n",
+ kbdopt[i].name);
+ input_options = input_option_new(input_options,
+ "xkb_options", kbdopt[i].name);
+ break;
+ }
+ for (i = 0; kbdmodel[i].val; i++)
+ if (type == kbdmodel[i].val) {
+ LogMessageVerb(X_INFO, 3, "wskbd: using model %s\n",
+ kbdmodel[i].name);
+ input_options = input_option_new(input_options,
+ "xkb_model", kbdmodel[i].name);
+ break;
+ }
-kbd_config_done:
- attrs.flags |= ATTR_KEYBOARD;
- rc = NewInputDeviceRequest(input_options, &attrs, &dev);
- if (rc != Success)
- goto unwind;
+ kbd_config_done:
+ attrs.flags |= ATTR_KEYBOARD;
+ rc = NewInputDeviceRequest(input_options, &attrs, &dev);
+ if (rc != Success)
+ goto unwind;
- for (; dev; dev = dev->next) {
- free(dev->config_info);
- dev->config_info = strdup(config_info);
- }
-unwind:
- input_option_free_list(&input_options);
+ for (; dev; dev = dev->next) {
+ free(dev->config_info);
+ dev->config_info = strdup(config_info);
+ }
+ unwind:
+ input_option_free_list(&input_options);
}
static void
wscons_add_pointer(const char *path, const char *driver, int flags)
{
- InputAttributes attrs = {};
- DeviceIntPtr dev = NULL;
- InputOption *input_options = NULL;
- char *config_info = NULL;
- int rc;
+ InputAttributes attrs = { };
+ DeviceIntPtr dev = NULL;
+ InputOption *input_options = NULL;
+ char *config_info = NULL;
+ int rc;
- config_info = Xprintf("wscons:%s", path);
- if (!config_info)
- return;
+ config_info = Xprintf("wscons:%s", path);
+ if (!config_info)
+ return;
- input_options = input_option_new(input_options, "_source",
- "server/wscons");
- if (input_options == NULL)
- return;
+ input_options = input_option_new(input_options, "_source", "server/wscons");
+ if (input_options == NULL)
+ return;
- input_options = input_option_new(input_options, "name",
- strdup(path));
- input_options = input_option_new(input_options, "driver",
- strdup(driver));
- input_options = input_option_new(input_options, "device",
- strdup(path));
- LogMessage(X_INFO, "config/wscons: checking input device %s\n", path);
- attrs.flags |= flags;
- rc = NewInputDeviceRequest(input_options, &attrs, &dev);
- if (rc != Success)
- goto unwind;
+ input_options = input_option_new(input_options, "name", strdup(path));
+ input_options = input_option_new(input_options, "driver", strdup(driver));
+ input_options = input_option_new(input_options, "device", strdup(path));
+ LogMessage(X_INFO, "config/wscons: checking input device %s\n", path);
+ attrs.flags |= flags;
+ rc = NewInputDeviceRequest(input_options, &attrs, &dev);
+ if (rc != Success)
+ goto unwind;
- for (; dev; dev = dev->next) {
- free(dev->config_info);
- dev->config_info = strdup(config_info);
- }
-unwind:
- input_option_free_list(&input_options);
+ for (; dev; dev = dev->next) {
+ free(dev->config_info);
+ dev->config_info = strdup(config_info);
+ }
+ unwind:
+ input_option_free_list(&input_options);
}
static void
wscons_add_pointers(void)
{
- char devname[256];
- int fd, i, wsmouse_type;
+ char devname[256];
+ int fd, i, wsmouse_type;
- /* Check pointing devices */
- for (i = 0; i < 4; i++) {
- snprintf(devname, sizeof(devname), "%s%d",
- WSCONS_MOUSE_PREFIX, i);
- LogMessageVerb(X_INFO, 10, "wsmouse: checking %s\n", devname);
- fd = open_device(devnamem O_RDWR | O_NONBLOCK | O_EXCL);
- if (fd == -1) {
- LogMessageVerb(X_WARNING, 10, "%s: %s\n", devname,
- strerror(errno));
- continue;
- }
- if (ioctl(fd, WSMOUSEIO_GTYPE, &wsmouse_type) != 0) {
- LogMessageVerb(X_WARNING, 10,
- "%s: WSMOUSEIO_GTYPE failed\n", devname);
- close(fd);
- continue;
- }
- close(fd);
- switch (wsmouse_type) {
- case WSMOUSE_TYPE_SYNAPTICS:
- wscons_add_pointer(devname, "synaptics",
- ATTR_TOUCHPAD);
- break;
- case WSMOUSE_TYPE_TPANEL:
- wscons_add_pointer(devname, "ws", ATTR_TOUCHSCREEN);
- break;
- default:
- break;
- }
- }
- /* Add a default entry catching all other mux elements as "mouse" */
- wscons_add_pointer(WSCONS_MOUSE_PREFIX, "mouse", ATTR_POINTER);
+ /* Check pointing devices */
+ for (i = 0; i < 4; i++) {
+ snprintf(devname, sizeof(devname), "%s%d", WSCONS_MOUSE_PREFIX, i);
+ LogMessageVerb(X_INFO, 10, "wsmouse: checking %s\n", devname);
+ fd = open_device(devnamem O_RDWR | O_NONBLOCK | O_EXCL);
+ if (fd == -1) {
+ LogMessageVerb(X_WARNING, 10, "%s: %s\n", devname, strerror(errno));
+ continue;
+ }
+ if (ioctl(fd, WSMOUSEIO_GTYPE, &wsmouse_type) != 0) {
+ LogMessageVerb(X_WARNING, 10,
+ "%s: WSMOUSEIO_GTYPE failed\n", devname);
+ close(fd);
+ continue;
+ }
+ close(fd);
+ switch (wsmouse_type) {
+ case WSMOUSE_TYPE_SYNAPTICS:
+ wscons_add_pointer(devname, "synaptics", ATTR_TOUCHPAD);
+ break;
+ case WSMOUSE_TYPE_TPANEL:
+ wscons_add_pointer(devname, "ws", ATTR_TOUCHSCREEN);
+ break;
+ default:
+ break;
+ }
+ }
+ /* Add a default entry catching all other mux elements as "mouse" */
+ wscons_add_pointer(WSCONS_MOUSE_PREFIX, "mouse", ATTR_POINTER);
}
int
config_wscons_init(void)
{
- wscons_add_keyboard();
- wscons_add_pointers();
- return 1;
+ wscons_add_keyboard();
+ wscons_add_pointers();
+ return 1;
}
void
config_wscons_fini(void)
{
- /* Not much to do ? */
+ /* Not much to do ? */
}