6a8b653
From d70615e602361be7204552327f1fd5fa6d170cd0 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
0414809
---
6a8b653
 config/hal.c |   28 ++++++++++++++++++++++++++++
6a8b653
 1 files changed, 28 insertions(+), 0 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 */
0414809
-- 
6a8b653
1.6.0.1
0414809