8666eea
From c5714d2d77e872344d0ef8b4665f50cd43e467d8 Mon Sep 17 00:00:00 2001
49a6852
From: Adam Jackson <ajax@redhat.com>
49a6852
Date: Fri, 12 Sep 2008 10:12:55 -0400
982c1d5
Subject: [PATCH] config: disable evdev for keyboards
0414809
8666eea
If we ignore evdev keyboards, then we must have AEI off by default to allow
8666eea
for kbd to start if no xorg.conf is present.
0414809
---
8666eea
 config/hal.c                   |   28 ++++++++++++++++++++++++++++
8666eea
 hw/xfree86/common/xf86Config.c |    5 +++--
8666eea
 2 files changed, 31 insertions(+), 2 deletions(-)
0414809
0414809
diff --git a/config/hal.c b/config/hal.c
49a6852
index 0e0505b..76e8c45 100644
0414809
--- a/config/hal.c
0414809
+++ b/config/hal.c
49a6852
@@ -166,6 +166,31 @@ get_prop_string_array(LibHalContext *hal_ctx, const char *udi, const char *prop)
49a6852
     return ret;
982c1d5
 }
982c1d5
 
982c1d5
+static Bool
982c1d5
+get_device_is_keyboard(LibHalContext *hal_ctx, const char *udi, DBusError *error_p)
982c1d5
+{
982c1d5
+    char **props;
982c1d5
+    int i;
982c1d5
+    Bool ret = FALSE;
982c1d5
+
982c1d5
+    props = libhal_device_get_property_strlist(hal_ctx, udi,
982c1d5
+					"info.capabilities", error_p);
982c1d5
+    if (!props) {
982c1d5
+	return FALSE;
982c1d5
+    }
cd76076
+    for (i = 0; props[i]; i++) {
982c1d5
+	if (strcmp(props[i], "input.keys") == 0 ||
982c1d5
+            strcmp(props[i], "input.keyboard") == 0) {
982c1d5
+		ret = TRUE;
982c1d5
+		goto out_error;
982c1d5
+	}
cd76076
+    }
982c1d5
+
982c1d5
+out_error:
982c1d5
+    libhal_free_string_array(props);
982c1d5
+    return ret;
982c1d5
+}
982c1d5
+
982c1d5
 static void
982c1d5
 device_added(LibHalContext *hal_ctx, const char *udi)
982c1d5
 {
49a6852
@@ -182,6 +207,9 @@ device_added(LibHalContext *hal_ctx, const char *udi)
982c1d5
 
982c1d5
     dbus_error_init(&error);
cd76076
 
982c1d5
+    if (get_device_is_keyboard(hal_ctx, udi, &error))
982c1d5
+	goto unwind;
982c1d5
+
982c1d5
     driver = get_prop_string(hal_ctx, udi, "input.x11_driver");
982c1d5
     if (!driver){
982c1d5
         /* verbose, don't tell the user unless they _want_ to see it */
8666eea
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
8666eea
index a1c2e34..67cc783 100644
8666eea
--- a/hw/xfree86/common/xf86Config.c
8666eea
+++ b/hw/xfree86/common/xf86Config.c
8666eea
@@ -1088,8 +1088,9 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
8666eea
     }
8666eea
 #endif
8666eea
 
8666eea
-    /* AllowEmptyInput is automatically true if we're hotplugging */
8666eea
-    xf86Info.allowEmptyInput = (xf86Info.autoAddDevices && xf86Info.autoEnableDevices);
8666eea
+    /* Disable AEI by default, so setups with no config file force the kbd
8666eea
+     * driver */
8666eea
+    xf86Info.allowEmptyInput = FALSE;
8666eea
     xf86GetOptValBool(FlagOptions, FLAG_ALLOW_EMPTY_INPUT, &xf86Info.allowEmptyInput);
8666eea
 
8666eea
     xf86Info.useDefaultFontPath = TRUE;
0414809
-- 
8666eea
1.5.5.2
0414809