The attribute 'name' might not exist (as in the case of serial wacom
devices) and it's impossible to set it in an udev rule, I believe, so we
should at least fall back to the NAME property if the attribute is not
available.

Tom

On 03/02/2010 05:47 PM, Dan Nicholson wrote:
> On Tue, Mar 02, 2010 at 05:57:04PM +0100, Simon Thum wrote:
> 
> Can you try the patch below that uses the name attribute instead of the
> value from the uevent? I ran it through a little test app, but not in X.
> 
> Dan
> 
> From c01a4e6dce7196a60b5247dde78054b27e004494 Mon Sep 17 00:00:00 2001
> From: Dan Nicholson <dbn.li...@gmail.com>
> Date: Tue, 2 Mar 2010 14:42:22 -0800
> Subject: [PATCH] config/udev: Get product name from attribute instead of 
> uevent
> 
> The input device product name in the kernel uevent has embedded quotes
> that aren't expected here. Use the sysfs name attribute instead, which
> does not suffer this problem.
> 
> Signed-off-by: Dan Nicholson <dbn.li...@gmail.com>
> ---
>  config/udev.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/config/udev.c b/config/udev.c
> index 69257e9..54306ef 100644
> --- a/config/udev.c
> +++ b/config/udev.c
> @@ -74,7 +74,7 @@ device_added(struct udev_device *udev_device)
>  
>      parent = udev_device_get_parent(udev_device);
>      if (parent)
> -        name = udev_device_get_property_value(parent, "NAME");
> +        name = udev_device_get_sysattr_value(parent, "name");
>      if (!name)
>          name = "(unnamed)";
>      else

>From 8e791dbd4ad96c64802e864ff100f6342734a40c Mon Sep 17 00:00:00 2001
From: Dan Nicholson <dbn.li...@gmail.com>
Date: Tue, 2 Mar 2010 14:42:22 -0800
Subject: [PATCH] config/udev: Get product name from attribute instead of uevent

The input device product name in the kernel uevent has embedded quotes
that aren't expected here. Use the sysfs name attribute instead, which
does not suffer this problem. Fall back to the NAME property if the
attribute is not available.

Signed-off-by: Thomas Jaeger <thjae...@gmail.com>
---
 config/udev.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/config/udev.c b/config/udev.c
index 69257e9..452fb5a 100644
--- a/config/udev.c
+++ b/config/udev.c
@@ -73,8 +73,11 @@ device_added(struct udev_device *udev_device)
         goto unwind;
 
     parent = udev_device_get_parent(udev_device);
-    if (parent)
-        name = udev_device_get_property_value(parent, "NAME");
+    if (parent) {
+        name = udev_device_get_sysattr_value(parent, "name");
+        if (!name)
+            name = udev_device_get_property_value(parent, "NAME");
+    }
     if (!name)
         name = "(unnamed)";
     else
-- 
1.7.0

_______________________________________________
xorg mailing list
xorg@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/xorg

Reply via email to