aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/config/udev.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-01-08 19:40:59 +0000
committermarha <marha@users.sourceforge.net>2011-01-08 19:40:59 +0000
commit432768f75da13ee5343957df6ce5cd316a62929f (patch)
treeb02a3961540984c3d2caf783a6f0854b9b00f92a /xorg-server/config/udev.c
parent43b6c9073b8aad1170536ae5c6a5a019617659f1 (diff)
downloadvcxsrv-432768f75da13ee5343957df6ce5cd316a62929f.tar.gz
vcxsrv-432768f75da13ee5343957df6ce5cd316a62929f.tar.bz2
vcxsrv-432768f75da13ee5343957df6ce5cd316a62929f.zip
xserver mesa libX11 xkbcomp pixman git update 8/1/2011
Diffstat (limited to 'xorg-server/config/udev.c')
-rw-r--r--xorg-server/config/udev.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/xorg-server/config/udev.c b/xorg-server/config/udev.c
index 43e653d2b..eeacff162 100644
--- a/xorg-server/config/udev.c
+++ b/xorg-server/config/udev.c
@@ -94,6 +94,7 @@ device_added(struct udev_device *udev_device)
if (parent) {
const char *ppath = udev_device_get_devnode(parent);
const char *product = udev_device_get_property_value(parent, "PRODUCT");
+ const char *pnp_id = udev_device_get_sysattr_value(parent, "id");
unsigned int usb_vendor, usb_model;
name = udev_device_get_sysattr_value(parent, "name");
@@ -103,8 +104,9 @@ device_added(struct udev_device *udev_device)
LOG_PROPERTY(ppath, "NAME", name);
}
- attrs.pnp_id = udev_device_get_sysattr_value(parent, "id");
- LOG_SYSATTR(ppath, "id", attrs.pnp_id);
+ if (pnp_id)
+ attrs.pnp_id = strdup(pnp_id);
+ 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) {
@@ -118,12 +120,13 @@ device_added(struct udev_device *udev_device)
if (!name)
name = "(unnamed)";
else
- attrs.product = name;
+ attrs.product = strdup(name);
add_option(&options, "name", name);
add_option(&options, "path", path);
add_option(&options, "device", path);
- attrs.device = path;
+ if (path)
+ attrs.device = strdup(path);
tags_prop = udev_device_get_property_value(udev_device, "ID_INPUT.tags");
LOG_PROPERTY(path, "ID_INPUT.tags", tags_prop);
@@ -162,7 +165,7 @@ device_added(struct udev_device *udev_device)
add_option(&options, "xkb_options", value);
} else if (!strcmp(key, "ID_VENDOR")) {
LOG_PROPERTY(path, key, value);
- attrs.vendor = value;
+ attrs.vendor = strdup(value);
} else if (!strcmp(key, "ID_INPUT_KEY")) {
LOG_PROPERTY(path, key, value);
attrs.flags |= ATTR_KEYBOARD;
@@ -202,6 +205,10 @@ device_added(struct udev_device *udev_device)
}
free(attrs.usb_id);
+ free(attrs.pnp_id);
+ free(attrs.product);
+ free(attrs.device);
+ free(attrs.vendor);
if (attrs.tags) {
char **tag = attrs.tags;
while (*tag) {
@@ -307,7 +314,7 @@ config_udev_fini(void)
udev = udev_monitor_get_udev(udev_monitor);
RemoveGeneralSocket(udev_monitor_get_fd(udev_monitor));
- RemoveBlockAndWakeupHandlers(block_handler, wakeup_handler, udev_monitor);
+ RemoveBlockAndWakeupHandlers(block_handler, wakeup_handler, NULL);
udev_monitor_unref(udev_monitor);
udev_monitor = NULL;
udev_unref(udev);