summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorLaércio de Sousa <laerciosousa@sme-mogidascruzes.sp.gov.br>2016-02-12 14:18:02 -0200
committerAdam Jackson <ajax@redhat.com>2016-03-01 10:46:48 -0500
commitdaa6d2d58f65b9301b1b1f3c6df07719ecb5c03d (patch)
tree8d73d57fc4359ed5869c3a81301e0744a42d43f5 /config
parent851ff9ec04b73412c7dbad7b4911a1feac21f354 (diff)
config/udev: distinguish between real keyboards and other key devices
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>
Diffstat (limited to 'config')
-rw-r--r--config/hal.c2
-rw-r--r--config/udev.c4
-rw-r--r--config/wscons.c2
3 files changed, 6 insertions, 2 deletions
diff --git a/config/hal.c b/config/hal.c
index ea574ca52..c76eced4c 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 08a954bd0..1a6e82a3c 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 fb114bd71..ee4567590 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;