[PATCH 1/2] config: Prefer ID_MODEL over the parent's NAME

Peter Hutterer peter.hutterer at who-t.net
Tue Jul 19 23:08:00 PDT 2011


NAME is the kernel-space value, ID_MODEL the userspace value. Prefer that
if available, otherwise fall back to NAME.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 config/udev.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/config/udev.c b/config/udev.c
index 9ac34ee..5cc071c 100644
--- a/config/udev.c
+++ b/config/udev.c
@@ -90,6 +90,9 @@ device_added(struct udev_device *udev_device)
     if (!options->key || !options->value)
         goto unwind;
 
+    name = udev_device_get_property_value(parent, "ID_MODEL");
+    LOG_SYSATTR(path, "ID_MODEL", name);
+
     parent = udev_device_get_parent(udev_device);
     if (parent) {
         const char *ppath = udev_device_get_devnode(parent);
@@ -97,11 +100,13 @@ device_added(struct udev_device *udev_device)
         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");
-        LOG_SYSATTR(ppath, "name", name);
         if (!name) {
-            name = udev_device_get_property_value(parent, "NAME");
-            LOG_PROPERTY(ppath, "NAME", name);
+            name = udev_device_get_sysattr_value(parent, "name");
+            LOG_SYSATTR(ppath, "name", name);
+            if (!name) {
+                name = udev_device_get_property_value(parent, "NAME");
+                LOG_PROPERTY(ppath, "NAME", name);
+            }
         }
 
         if (pnp_id)
-- 
1.7.6


--mYCpIKhGyMATD0i+
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="0002-config-construct-the-USB-ID-from-ID_MODEL_ID-and-ID_.patch"



More information about the xorg-devel mailing list