diff options
author | Seth Forshee <seth.forshee@canonical.com> | 2011-03-27 01:53:34 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2011-03-29 02:34:52 -0400 |
commit | 170531bae648c0ef8d56b44dc5bd8d67717b0db9 (patch) | |
tree | 192747c6e6a7a44f1e0c11513552ff3ec0ba529c /drivers/input | |
parent | f3cf5c4fedbe13880cd80a9fa1aebae79ebef20e (diff) |
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>
Diffstat (limited to 'drivers/input')
-rw-r--r-- | 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 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, | |||
209 | } | 209 | } |
210 | 210 | ||
211 | if (test_bit(EV_KEY, dev->evbit)) { | 211 | if (test_bit(EV_KEY, dev->evbit)) { |
212 | __set_bit(KEY_UNKNOWN, dev->keybit); | ||
212 | __set_bit(EV_MSC, dev->evbit); | 213 | __set_bit(EV_MSC, dev->evbit); |
213 | __set_bit(MSC_SCAN, dev->mscbit); | 214 | __set_bit(MSC_SCAN, dev->mscbit); |
214 | } | 215 | } |
@@ -311,12 +312,19 @@ bool sparse_keymap_report_event(struct input_dev *dev, unsigned int code, | |||
311 | { | 312 | { |
312 | const struct key_entry *ke = | 313 | const struct key_entry *ke = |
313 | sparse_keymap_entry_from_scancode(dev, code); | 314 | sparse_keymap_entry_from_scancode(dev, code); |
315 | struct key_entry unknown_ke; | ||
314 | 316 | ||
315 | if (ke) { | 317 | if (ke) { |
316 | sparse_keymap_report_entry(dev, ke, value, autorelease); | 318 | sparse_keymap_report_entry(dev, ke, value, autorelease); |
317 | return true; | 319 | return true; |
318 | } | 320 | } |
319 | 321 | ||
322 | /* Report an unknown key event as a debugging aid */ | ||
323 | unknown_ke.type = KE_KEY; | ||
324 | unknown_ke.code = code; | ||
325 | unknown_ke.keycode = KEY_UNKNOWN; | ||
326 | sparse_keymap_report_entry(dev, &unknown_ke, value, true); | ||
327 | |||
320 | return false; | 328 | return false; |
321 | } | 329 | } |
322 | EXPORT_SYMBOL(sparse_keymap_report_event); | 330 | EXPORT_SYMBOL(sparse_keymap_report_event); |