From cd8b0d0de3fcb53f6d3ece8ce26d97aaab2c0914 Mon Sep 17 00:00:00 2001 From: marha Date: Wed, 12 Mar 2014 16:40:50 +0100 Subject: mesa xserver xkbcomp git update 12 Mar 2014 xserver commit 81a4952d3dcab9ca3a1ee399c773f5ac352036c4 xkbcomp commit d4e02a09258063c6d024c3ccd42d6b22212e6e18 mesa commit 2c886eba7820f7e3e965dd16b786b0a412d8ef11 --- xorg-server/config/config.c | 34 +++++++++++++++++++++++----------- xorg-server/config/hal.c | 16 +++++++++++++--- xorg-server/config/udev.c | 15 +++++++++++---- 3 files changed, 47 insertions(+), 18 deletions(-) (limited to 'xorg-server/config') diff --git a/xorg-server/config/config.c b/xorg-server/config/config.c index 7971b8740..46f2532ec 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)"; -- cgit v1.2.3