Commit 170531ba authored by Seth Forshee's avatar Seth Forshee Committed by Dmitry Torokhov

Input: sparse-keymap - report KEY_UNKNOWN for unknown scan codes

This allows for debugging non-functional keys easily from
userspace.
Signed-off-by: default avatarSeth Forshee <seth.forshee@canonical.com>
Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
parent f3cf5c4f
...@@ -209,6 +209,7 @@ int sparse_keymap_setup(struct input_dev *dev, ...@@ -209,6 +209,7 @@ int sparse_keymap_setup(struct input_dev *dev,
} }
if (test_bit(EV_KEY, dev->evbit)) { if (test_bit(EV_KEY, dev->evbit)) {
__set_bit(KEY_UNKNOWN, dev->keybit);
__set_bit(EV_MSC, dev->evbit); __set_bit(EV_MSC, dev->evbit);
__set_bit(MSC_SCAN, dev->mscbit); __set_bit(MSC_SCAN, dev->mscbit);
} }
...@@ -311,12 +312,19 @@ bool sparse_keymap_report_event(struct input_dev *dev, unsigned int code, ...@@ -311,12 +312,19 @@ bool sparse_keymap_report_event(struct input_dev *dev, unsigned int code,
{ {
const struct key_entry *ke = const struct key_entry *ke =
sparse_keymap_entry_from_scancode(dev, code); sparse_keymap_entry_from_scancode(dev, code);
struct key_entry unknown_ke;
if (ke) { if (ke) {
sparse_keymap_report_entry(dev, ke, value, autorelease); sparse_keymap_report_entry(dev, ke, value, autorelease);
return true; 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; return false;
} }
EXPORT_SYMBOL(sparse_keymap_report_event); EXPORT_SYMBOL(sparse_keymap_report_event);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment