diff options
author | marha <marha@users.sourceforge.net> | 2014-03-12 16:45:42 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2014-03-12 16:45:42 +0100 |
commit | cc6db22a772cc52ead6a5c11d7d02e7364f6326c (patch) | |
tree | d80b42172d703ec20ccd99c68a067505e2706899 /xorg-server/config | |
parent | 2112b7dec49833ba872bd3ebcd7288930fec0796 (diff) | |
parent | cd8b0d0de3fcb53f6d3ece8ce26d97aaab2c0914 (diff) | |
download | vcxsrv-cc6db22a772cc52ead6a5c11d7d02e7364f6326c.tar.gz vcxsrv-cc6db22a772cc52ead6a5c11d7d02e7364f6326c.tar.bz2 vcxsrv-cc6db22a772cc52ead6a5c11d7d02e7364f6326c.zip |
Merge remote-tracking branch 'origin/released'
* origin/released:
mesa xserver xkbcomp git update 12 Mar 2014
Diffstat (limited to 'xorg-server/config')
-rw-r--r-- | xorg-server/config/config.c | 34 | ||||
-rw-r--r-- | xorg-server/config/hal.c | 16 | ||||
-rw-r--r-- | xorg-server/config/udev.c | 15 |
3 files changed, 47 insertions, 18 deletions
diff --git a/xorg-server/config/config.c b/xorg-server/config/config.c index 732670038..883402bb5 100644 --- a/xorg-server/config/config.c +++ b/xorg-server/config/config.c @@ -159,23 +159,38 @@ config_odev_find_attribute(struct OdevAttributes *attribs, int attrib_id) return NULL; } +static struct OdevAttribute * +config_odev_find_or_add_attribute(struct OdevAttributes *attribs, int attrib) +{ + struct OdevAttribute *oa; + + oa = config_odev_find_attribute(attribs, attrib); + if (oa) + return oa; + + oa = calloc(1, sizeof(struct OdevAttribute)); + if (!oa) + return oa; + + oa->attrib_id = attrib; + xorg_list_append(&oa->member, &attribs->list); + + return oa; +} + Bool config_odev_add_attribute(struct OdevAttributes *attribs, int attrib, const char *attrib_name) { struct OdevAttribute *oa; - oa = config_odev_find_attribute(attribs, attrib); - if (!oa) - oa = calloc(1, sizeof(struct OdevAttribute)); + oa = config_odev_find_or_add_attribute(attribs, attrib); if (!oa) return FALSE; - oa->attrib_id = attrib; free(oa->attrib_name); oa->attrib_name = strdup(attrib_name); oa->attrib_type = ODEV_ATTRIB_STRING; - xorg_list_append(&oa->member, &attribs->list); return TRUE; } @@ -185,16 +200,12 @@ config_odev_add_int_attribute(struct OdevAttributes *attribs, int attrib, { struct OdevAttribute *oa; - oa = config_odev_find_attribute(attribs, attrib); - if (!oa) - oa = calloc(1, sizeof(struct OdevAttribute)); + oa = config_odev_find_or_add_attribute(attribs, attrib); if (!oa) return FALSE; - oa->attrib_id = attrib; oa->attrib_value = attrib_value; oa->attrib_type = ODEV_ATTRIB_INT; - xorg_list_append(&oa->member, &attribs->list); return TRUE; } @@ -246,7 +257,8 @@ config_odev_free_attributes(struct OdevAttributes *attribs) case ODEV_ATTRIB_FD: fd = iter->attrib_value; break; } xorg_list_del(&iter->member); - free(iter->attrib_name); + if (iter->attrib_type == ODEV_ATTRIB_STRING) + free(iter->attrib_name); free(iter); } diff --git a/xorg-server/config/hal.c b/xorg-server/config/hal.c index 94cb6e7cd..ea574ca52 100644 --- a/xorg-server/config/hal.c +++ b/xorg-server/config/hal.c @@ -185,8 +185,7 @@ device_added(LibHalContext * hal_ctx, const char *udi) parent = get_prop_string(hal_ctx, udi, "info.parent"); if (parent) { int usb_vendor, usb_product; - - attrs.pnp_id = get_prop_string(hal_ctx, parent, "pnp.id"); + char *old_parent; /* construct USB ID in lowercase - "0000:ffff" */ usb_vendor = libhal_device_get_property_int(hal_ctx, parent, @@ -204,7 +203,18 @@ device_added(LibHalContext * hal_ctx, const char *udi) == -1) attrs.usb_id = NULL; - free(parent); + attrs.pnp_id = get_prop_string(hal_ctx, parent, "pnp.id"); + old_parent = parent; + + while (!attrs.pnp_id && + (parent = get_prop_string(hal_ctx, parent, "info.parent"))) { + attrs.pnp_id = get_prop_string(hal_ctx, parent, "pnp.id"); + + free(old_parent); + old_parent = parent; + } + + free(old_parent); } input_options = input_option_new(NULL, "_source", "server/hal"); diff --git a/xorg-server/config/udev.c b/xorg-server/config/udev.c index d70eeb48c..d88abaaa1 100644 --- a/xorg-server/config/udev.c +++ b/xorg-server/config/udev.c @@ -149,10 +149,6 @@ device_added(struct udev_device *udev_device) LOG_PROPERTY(ppath, "NAME", name); } - 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) { @@ -164,6 +160,17 @@ device_added(struct udev_device *udev_device) LOG_PROPERTY(ppath, "PRODUCT", product); attrs.usb_id = usb_id; } + + while (!pnp_id && (parent = udev_device_get_parent(parent))) { + pnp_id = udev_device_get_sysattr_value(parent, "id"); + if (!pnp_id) + continue; + + attrs.pnp_id = strdup(pnp_id); + ppath = udev_device_get_devnode(parent); + LOG_SYSATTR(ppath, "id", pnp_id); + } + } if (!name) name = "(unnamed)"; |