Blob Blame History Raw
From d70615e602361be7204552327f1fd5fa6d170cd0 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

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