From: Seth Forshee <seth.forshee@canonical.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 2/2] Input: sparse-keymap - report KEY_UNKNOWN for unknown scan codes
Date: Fri, 25 Mar 2011 08:40:03 -0500 [thread overview]
Message-ID: <1301060403-19229-3-git-send-email-seth.forshee@canonical.com> (raw)
In-Reply-To: <1301060403-19229-1-git-send-email-seth.forshee@canonical.com>
This allows for debugging non-functional keys easily from
userspace.
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
---
drivers/input/sparse-keymap.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/drivers/input/sparse-keymap.c b/drivers/input/sparse-keymap.c
index 74bca5d..fdb6a39 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);
--
1.7.4.1
prev parent reply other threads:[~2011-03-25 13:40 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-23 21:13 [PATCH 0/2] sparse-keymap: Emit events useful for key debugging Seth Forshee
2011-03-23 21:13 ` [PATCH 1/2] Input: sparse-keymap - report scancodes with key events Seth Forshee
2011-03-23 21:13 ` [PATCH 2/2] Input: sparse-keymap - report KEY_UNKNOWN for unknown scan codes Seth Forshee
2011-03-25 7:35 ` Dmitry Torokhov
2011-03-25 13:40 ` Seth Forshee
2011-03-25 13:40 ` [PATCH v2 1/2] Input: sparse-keymap - report scancodes with key events Seth Forshee
2011-03-25 13:40 ` Seth Forshee [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1301060403-19229-3-git-send-email-seth.forshee@canonical.com \
--to=seth.forshee@canonical.com \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).