summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSeth Forshee <seth.forshee@canonical.com>2011-03-27 07:53:34 +0200
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2011-03-29 08:34:52 +0200
commit170531bae648c0ef8d56b44dc5bd8d67717b0db9 (patch)
tree192747c6e6a7a44f1e0c11513552ff3ec0ba529c
parentInput: sparse-keymap - report scancodes with key events (diff)
downloadlinux-170531bae648c0ef8d56b44dc5bd8d67717b0db9.tar.xz
linux-170531bae648c0ef8d56b44dc5bd8d67717b0db9.zip
Input: sparse-keymap - report KEY_UNKNOWN for unknown scan codes
This allows for debugging non-functional keys easily from userspace. Signed-off-by: Seth Forshee <seth.forshee@canonical.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
-rw-r--r--drivers/input/sparse-keymap.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/input/sparse-keymap.c b/drivers/input/sparse-keymap.c
index 74bca5d2f6dc..fdb6a3976f94 100644
--- a/drivers/input/sparse-keymap.c
+++ b/drivers/input/sparse-keymap.c
@@ -209,6 +209,7 @@ int sparse_keymap_setup(struct input_dev *dev,
}
if (test_bit(EV_KEY, dev->evbit)) {
+ __set_bit(KEY_UNKNOWN, dev->keybit);
__set_bit(EV_MSC, dev->evbit);
__set_bit(MSC_SCAN, dev->mscbit);
}
@@ -311,12 +312,19 @@ bool sparse_keymap_report_event(struct input_dev *dev, unsigned int code,
{
const struct key_entry *ke =
sparse_keymap_entry_from_scancode(dev, code);
+ struct key_entry unknown_ke;
if (ke) {
sparse_keymap_report_entry(dev, ke, value, autorelease);
return true;
}
+ /* Report an unknown key event as a debugging aid */
+ unknown_ke.type = KE_KEY;
+ unknown_ke.code = code;
+ unknown_ke.keycode = KEY_UNKNOWN;
+ sparse_keymap_report_entry(dev, &unknown_ke, value, true);
+
return false;
}
EXPORT_SYMBOL(sparse_keymap_report_event);