[PATCH 03/19] config: expose config_info as an input option.

Peter Hutterer peter.hutterer at who-t.net
Thu Jul 29 23:21:19 PDT 2010


config_info is the only reliable indicator we have in the server for
duplicate devices (drivers can test for maj/min on fds as well). Don't set
this after the device has been initialized but assume it's important enough
to set during NIDR.

This makes the option "config_info" available to the drivers as well.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 config/hal.c                   |    6 +-----
 config/udev.c                  |    7 ++-----
 hw/xfree86/common/xf86Xinput.c |    1 +
 3 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/config/hal.c b/config/hal.c
index b70488b..6e2850c 100644
--- a/config/hal.c
+++ b/config/hal.c
@@ -376,6 +376,7 @@ device_added(LibHalContext *hal_ctx, const char *udi)
         add_option(&options, "xkb_model", xkb_opts.model);
     if (xkb_opts.options)
         add_option(&options, "xkb_options", xkb_opts.options);
+    add_option(&options, "config_info", config_info);
 
     /* this isn't an error, but how else do you output something that the user can see? */
     LogMessage(X_INFO, "config/hal: Adding input device %s\n", name);
@@ -385,11 +386,6 @@ device_added(LibHalContext *hal_ctx, const char *udi)
         goto unwind;
     }
 
-    for (; dev; dev = dev->next){
-        free(dev->config_info);
-        dev->config_info = strdup(config_info);
-    }
-
 unwind:
     if (set)
         libhal_free_property_set(set);
diff --git a/config/udev.c b/config/udev.c
index 9934490..cd46eec 100644
--- a/config/udev.c
+++ b/config/udev.c
@@ -189,17 +189,14 @@ device_added(struct udev_device *udev_device)
         }
     }
 
+    add_option(&options, "config_info", config_info);
+
     LogMessage(X_INFO, "config/udev: Adding input device %s (%s)\n",
                name, path);
     rc = NewInputDeviceRequest(options, &attrs, &dev);
     if (rc != Success)
         goto unwind;
 
-    for (; dev; dev = dev->next) {
-        free(dev->config_info);
-        dev->config_info = strdup(config_info);
-    }
-
  unwind:
     free(config_info);
     while (!dev && (tmpo = options)) {
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index 7b7f70c..0cdaf03 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -357,6 +357,7 @@ xf86ActivateDevice(LocalDevicePtr local)
 
         dev->deviceGrab.ActivateGrab = ActivateKeyboardGrab;
         dev->deviceGrab.DeactivateGrab = DeactivateKeyboardGrab;
+        dev->config_info = xf86SetStrOption(local->options, "config_info", NULL);
 
         RegisterOtherDevice(dev);
         XkbSetExtension(dev, ProcessKeyboardEvent);
-- 
1.7.2



More information about the xorg-devel mailing list