forked from pool/xorg-x11-server
124 lines
4.7 KiB
Diff
124 lines
4.7 KiB
Diff
|
From daa6d2d58f65b9301b1b1f3c6df07719ecb5c03d Mon Sep 17 00:00:00 2001
|
||
|
From: =?UTF-8?q?La=C3=A9rcio=20de=20Sousa?=
|
||
|
<laerciosousa@sme-mogidascruzes.sp.gov.br>
|
||
|
Date: Fri, 12 Feb 2016 14:18:02 -0200
|
||
|
Subject: [PATCH 56/56] config/udev: distinguish between real keyboards and
|
||
|
other key devices
|
||
|
MIME-Version: 1.0
|
||
|
Content-Type: text/plain; charset=UTF-8
|
||
|
Content-Transfer-Encoding: 8bit
|
||
|
|
||
|
This patch introduces a new flag ATTR_KEY for hotplugged input devices,
|
||
|
so we can better distinguish between real keyboards (i.e. devices with
|
||
|
udev property ID_INPUT_KEYBOARD="1") and other key input devices like
|
||
|
lid switches, power buttons, etc.
|
||
|
|
||
|
All supported hotplug backends (udev, hal, and wscons) will set both
|
||
|
flags ATTR_KEY and ATTR_KEYBOARD for real keyboards, but udev backend
|
||
|
will set ATTR_KEY, but not ATTR_KEYBOARD, for non-keyboard key input
|
||
|
devices (hal and wscons will set both flags in any case). With this
|
||
|
distinction, kdrive input hotplugging mechanism will be allowed to only
|
||
|
grab real keyboards, as other key input devices are currently not
|
||
|
supported.
|
||
|
|
||
|
In order to don't break current behaviour, this patch will replace all
|
||
|
ATTR_KEYBOARD occurrences with ATTR_KEY in hw/xfree86/common/xf86Xinput.c.
|
||
|
|
||
|
[ajax: Just add ATTR_KEY, don't re-number the other attributes]
|
||
|
|
||
|
Reviewed-by: Adam Jackson <ajax@redhat.com>
|
||
|
Signed-off-by: Laércio de Sousa <laerciosousa@sme-mogidascruzes.sp.gov.br>
|
||
|
---
|
||
|
config/hal.c | 2 +-
|
||
|
config/udev.c | 4 ++++
|
||
|
config/wscons.c | 2 +-
|
||
|
hw/kdrive/src/kinput.c | 4 +++-
|
||
|
hw/xfree86/common/xf86Xinput.c | 2 +-
|
||
|
include/input.h | 1 +
|
||
|
6 files changed, 11 insertions(+), 4 deletions(-)
|
||
|
|
||
|
diff --git a/config/hal.c b/config/hal.c
|
||
|
index ea574ca..c76eced 100644
|
||
|
--- a/config/hal.c
|
||
|
+++ b/config/hal.c
|
||
|
@@ -170,7 +170,7 @@ device_added(LibHalContext * hal_ctx, const char *udi)
|
||
|
free(hal_tags);
|
||
|
|
||
|
if (libhal_device_query_capability(hal_ctx, udi, "input.keys", NULL))
|
||
|
- attrs.flags |= ATTR_KEYBOARD;
|
||
|
+ attrs.flags |= ATTR_KEY | ATTR_KEYBOARD;
|
||
|
if (libhal_device_query_capability(hal_ctx, udi, "input.mouse", NULL))
|
||
|
attrs.flags |= ATTR_POINTER;
|
||
|
if (libhal_device_query_capability(hal_ctx, udi, "input.joystick", NULL))
|
||
|
diff --git a/config/udev.c b/config/udev.c
|
||
|
index 08a954b..1a6e82a 100644
|
||
|
--- a/config/udev.c
|
||
|
+++ b/config/udev.c
|
||
|
@@ -240,6 +240,10 @@ device_added(struct udev_device *udev_device)
|
||
|
}
|
||
|
else if (!strcmp(key, "ID_INPUT_KEY")) {
|
||
|
LOG_PROPERTY(path, key, value);
|
||
|
+ attrs.flags |= ATTR_KEY;
|
||
|
+ }
|
||
|
+ else if (!strcmp(key, "ID_INPUT_KEYBOARD")) {
|
||
|
+ LOG_PROPERTY(path, key, value);
|
||
|
attrs.flags |= ATTR_KEYBOARD;
|
||
|
}
|
||
|
else if (!strcmp(key, "ID_INPUT_MOUSE")) {
|
||
|
diff --git a/config/wscons.c b/config/wscons.c
|
||
|
index fb114bd..ee45675 100644
|
||
|
--- a/config/wscons.c
|
||
|
+++ b/config/wscons.c
|
||
|
@@ -163,7 +163,7 @@ wscons_add_keyboard(void)
|
||
|
}
|
||
|
|
||
|
kbd_config_done:
|
||
|
- attrs.flags |= ATTR_KEYBOARD;
|
||
|
+ attrs.flags |= ATTR_KEY | ATTR_KEYBOARD;
|
||
|
rc = NewInputDeviceRequest(input_options, &attrs, &dev);
|
||
|
if (rc != Success)
|
||
|
goto unwind;
|
||
|
diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
|
||
|
index 836db79..ae19a9d 100644
|
||
|
--- a/hw/kdrive/src/kinput.c
|
||
|
+++ b/hw/kdrive/src/kinput.c
|
||
|
@@ -2343,7 +2343,9 @@ NewInputDeviceRequest(InputOption *options, InputAttributes * attrs,
|
||
|
*pdev = ki->dixdev;
|
||
|
}
|
||
|
else {
|
||
|
- ErrorF("unrecognised device identifier!\n");
|
||
|
+ ErrorF("unrecognised device identifier: %s\n",
|
||
|
+ input_option_get_value(input_option_find(optionsdup,
|
||
|
+ "device")));
|
||
|
input_option_free_list(&optionsdup);
|
||
|
return BadValue;
|
||
|
}
|
||
|
diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
|
||
|
index a9ce62a..4f2e6c8 100644
|
||
|
--- a/hw/xfree86/common/xf86Xinput.c
|
||
|
+++ b/hw/xfree86/common/xf86Xinput.c
|
||
|
@@ -635,7 +635,7 @@ InputClassMatches(const XF86ConfInputClassPtr iclass, const InputInfoPtr idev,
|
||
|
|
||
|
/* MatchIs* booleans */
|
||
|
if (iclass->is_keyboard.set &&
|
||
|
- iclass->is_keyboard.val != ! !(attrs->flags & ATTR_KEYBOARD))
|
||
|
+ iclass->is_keyboard.val != ! !(attrs->flags & ATTR_KEY))
|
||
|
return FALSE;
|
||
|
if (iclass->is_pointer.set &&
|
||
|
iclass->is_pointer.val != ! !(attrs->flags & ATTR_POINTER))
|
||
|
diff --git a/include/input.h b/include/input.h
|
||
|
index d8bd9c6..9662123 100644
|
||
|
--- a/include/input.h
|
||
|
+++ b/include/input.h
|
||
|
@@ -236,6 +236,7 @@ typedef struct _InputAttributes {
|
||
|
#define ATTR_TABLET (1<<3)
|
||
|
#define ATTR_TOUCHPAD (1<<4)
|
||
|
#define ATTR_TOUCHSCREEN (1<<5)
|
||
|
+#define ATTR_KEY (1<<6)
|
||
|
|
||
|
/* Key/Button has been run through all input processing and events sent to clients. */
|
||
|
#define KEY_PROCESSED 1
|
||
|
--
|
||
|
2.6.2
|
||
|
|