Blob Blame History Raw
From c5714d2d77e872344d0ef8b4665f50cd43e467d8 Mon Sep 17 00:00:00 2001
From: Adam Jackson <ajax@redhat.com>
Date: Fri, 12 Sep 2008 10:12:55 -0400
Subject: [PATCH] config: disable evdev for keyboards

If we ignore evdev keyboards, then we must have AEI off by default to allow
for kbd to start if no xorg.conf is present.
---
 config/hal.c                   |   28 ++++++++++++++++++++++++++++
 hw/xfree86/common/xf86Config.c |    5 +++--
 2 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/config/hal.c b/config/hal.c
index 0e0505b..76e8c45 100644
--- a/config/hal.c
+++ b/config/hal.c
@@ -166,6 +166,31 @@ get_prop_string_array(LibHalContext *hal_ctx, const char *udi, const char *prop)
     return ret;
 }
 
+static Bool
+get_device_is_keyboard(LibHalContext *hal_ctx, const char *udi, DBusError *error_p)
+{
+    char **props;
+    int i;
+    Bool ret = FALSE;
+
+    props = libhal_device_get_property_strlist(hal_ctx, udi,
+					"info.capabilities", error_p);
+    if (!props) {
+	return FALSE;
+    }
+    for (i = 0; props[i]; i++) {
+	if (strcmp(props[i], "input.keys") == 0 ||
+            strcmp(props[i], "input.keyboard") == 0) {
+		ret = TRUE;
+		goto out_error;
+	}
+    }
+
+out_error:
+    libhal_free_string_array(props);
+    return ret;
+}
+
 static void
 device_added(LibHalContext *hal_ctx, const char *udi)
 {
@@ -182,6 +207,9 @@ device_added(LibHalContext *hal_ctx, const char *udi)
 
     dbus_error_init(&error);
 
+    if (get_device_is_keyboard(hal_ctx, udi, &error))
+	goto unwind;
+
     driver = get_prop_string(hal_ctx, udi, "input.x11_driver");
     if (!driver){
         /* verbose, don't tell the user unless they _want_ to see it */
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index a1c2e34..67cc783 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -1088,8 +1088,9 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
     }
 #endif
 
-    /* AllowEmptyInput is automatically true if we're hotplugging */
-    xf86Info.allowEmptyInput = (xf86Info.autoAddDevices && xf86Info.autoEnableDevices);
+    /* Disable AEI by default, so setups with no config file force the kbd
+     * driver */
+    xf86Info.allowEmptyInput = FALSE;
     xf86GetOptValBool(FlagOptions, FLAG_ALLOW_EMPTY_INPUT, &xf86Info.allowEmptyInput);
 
     xf86Info.useDefaultFontPath = TRUE;
-- 
1.5.5.2