xserver: Branch 'master' - 2 commits

Peter Hutterer whot at kemper.freedesktop.org
Tue Oct 28 18:44:20 PDT 2008


 config/hal.c                         |   27 ++++++++++++++++++++++++
 hw/xfree86/common/xf86Config.c       |   39 +++++++++++++++++++++++++++++++++--
 hw/xfree86/doc/man/xorg.conf.man.pre |    1 
 3 files changed, 65 insertions(+), 2 deletions(-)

New commits:
commit c264826da96ad1859dd112b17eb8aa9e5278478f
Author: Peter Hutterer <peter.hutterer at redhat.com>
Date:   Thu Oct 16 11:22:29 2008 +1030

    xfree86: If AEI is on, disable "kbd" and "mouse" devices.
    
    This consists of two parts:
    In the implicit server layout, ignore those drivers when looking for a core
    device.
    
    And after finishing the server layout, run through the list of devices and
    remove any that use mouse or kbd.
    
    AEI is mutually exclusive with the kbd and mouse drivers, so pick either - or.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at redhat.com>

diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index 536b53c..0466c63 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -1282,7 +1282,7 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
     }
 
     /* 4. First pointer with 'mouse' as the driver. */
-    if (!foundPointer && (!xf86Info.allowEmptyInput || implicitLayout)) {
+    if (!foundPointer && !xf86Info.allowEmptyInput) {
 	confInput = xf86findInput(CONF_IMPLICIT_POINTER,
 				  xf86configptr->conf_input_lst);
 	if (!confInput) {
@@ -1422,7 +1422,7 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
     }
 
     /* 4. First keyboard with 'keyboard' or 'kbd' as the driver. */
-    if (!foundKeyboard && (!xf86Info.allowEmptyInput || implicitLayout)) {
+    if (!foundKeyboard && !xf86Info.allowEmptyInput) {
 	confInput = xf86findInput(CONF_IMPLICIT_KEYBOARD,
 				  xf86configptr->conf_input_lst);
 	if (!confInput) {
@@ -2445,6 +2445,41 @@ addDefaultModes(MonPtr monitorp)
 static void
 checkInput(serverLayoutPtr layout, Bool implicit_layout) {
     checkCoreInputDevices(layout, implicit_layout);
+
+    /* AllowEmptyInput and the "kbd" and "mouse" drivers are mutually
+     * exclusive. Trawl the list for mouse/kbd devices and disable them.
+     */
+    if (xf86Info.allowEmptyInput && layout->inputs)
+    {
+        IDevPtr *dev = layout->inputs;
+        BOOL warned = FALSE;
+
+        while(*dev)
+        {
+            if (strcmp((*dev)->driver, "kbd") == 0 ||
+                strcmp((*dev)->driver, "mouse") == 0)
+            {
+                IDevPtr *current;
+                if (!warned)
+                {
+                    xf86Msg(X_WARNING, "AllowEmptyInput is on, devices using "
+                            "drivers 'kbd' or 'mouse' will be disabled.\n");
+                    warned = TRUE;
+                }
+
+                xf86Msg(X_WARNING, "Disabling %s\n", (*dev)->identifier);
+
+                current = dev;
+                xfree(*dev);
+
+                do {
+                    *current = *(current + 1);
+                    current++;
+                } while(*current);
+            } else
+                dev++;
+        }
+    }
 }
 
 /*
diff --git a/hw/xfree86/doc/man/xorg.conf.man.pre b/hw/xfree86/doc/man/xorg.conf.man.pre
index 76ce108..3baa7fb 100644
--- a/hw/xfree86/doc/man/xorg.conf.man.pre
+++ b/hw/xfree86/doc/man/xorg.conf.man.pre
@@ -696,6 +696,7 @@ the X server to load. Disabled by default.
 If enabled, don't add the standard keyboard and mouse drivers, if there are no
 input devices in the config file.  Enabled by default if AutoAddDevices and
 AutoEnableDevices is enabled, otherwise disabled.
+If AllowEmptyInput is on, devices using the kbd or mouse driver are ignored.
 .TP 7
 .BI "Option \*qAutoAddDevices\*q \*q" boolean \*q
 If this option is disabled, then no devices will be added from HAL events.
commit 6c451859552e1fc78f6589617482f9ff96d7ed8a
Author: Peter Hutterer <peter.hutterer at redhat.com>
Date:   Mon Oct 20 12:19:55 2008 +1030

    config: don't add duplicate devices through HAL.
    
    If HAL is restarted, the device list is sent to the server again, leading
    first to duplicate devices (and thus duplicate events), and later to a
    FatalError "Too many input devices."
    
    dev->config_info contains the UDI for the device. If the UDI of a new devices
    is equal to one we already have in the device list, just ignore it.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at redhat.com>

diff --git a/config/hal.c b/config/hal.c
index 6573efe..c29a573 100644
--- a/config/hal.c
+++ b/config/hal.c
@@ -166,6 +166,26 @@ get_prop_string_array(LibHalContext *hal_ctx, const char *udi, const char *prop)
     return ret;
 }
 
+static BOOL
+device_is_duplicate(char *config_info)
+{
+    DeviceIntPtr dev;
+
+    for (dev = inputInfo.devices; dev; dev = dev->next)
+    {
+        if (dev->config_info && (strcmp(dev->config_info, config_info) == 0))
+            return TRUE;
+    }
+
+    for (dev = inputInfo.off_devices; dev; dev = dev->next)
+    {
+        if (dev->config_info && (strcmp(dev->config_info, config_info) == 0))
+            return TRUE;
+    }
+
+    return FALSE;
+}
+
 static void
 device_added(LibHalContext *hal_ctx, const char *udi)
 {
@@ -228,6 +248,13 @@ device_added(LibHalContext *hal_ctx, const char *udi)
     }
     sprintf(config_info, "hal:%s", udi);
 
+    /* Check for duplicate devices */
+    if (device_is_duplicate(config_info))
+    {
+        LogMessage(X_WARNING, "config/hal: device %s already added. Ignoring.\n", name);
+        goto unwind;
+    }
+
     /* ok, grab options from hal.. iterate through all properties
     * and lets see if any of them are options that we can add */
     set = libhal_device_get_all_properties(hal_ctx, udi, &error);


More information about the xorg-commit mailing list