aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/sparse-keymap.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input/sparse-keymap.c')
-rw-r--r--drivers/input/sparse-keymap.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/input/sparse-keymap.c b/drivers/input/sparse-keymap.c
index 337bf51bc984..fdb6a3976f94 100644
--- a/drivers/input/sparse-keymap.c
+++ b/drivers/input/sparse-keymap.c
@@ -208,6 +208,12 @@ int sparse_keymap_setup(struct input_dev *dev,
208 } 208 }
209 } 209 }
210 210
211 if (test_bit(EV_KEY, dev->evbit)) {
212 __set_bit(KEY_UNKNOWN, dev->keybit);
213 __set_bit(EV_MSC, dev->evbit);
214 __set_bit(MSC_SCAN, dev->mscbit);
215 }
216
211 dev->keycode = map; 217 dev->keycode = map;
212 dev->keycodemax = map_size; 218 dev->keycodemax = map_size;
213 dev->getkeycode = sparse_keymap_getkeycode; 219 dev->getkeycode = sparse_keymap_getkeycode;
@@ -268,6 +274,7 @@ void sparse_keymap_report_entry(struct input_dev *dev, const struct key_entry *k
268{ 274{
269 switch (ke->type) { 275 switch (ke->type) {
270 case KE_KEY: 276 case KE_KEY:
277 input_event(dev, EV_MSC, MSC_SCAN, ke->code);
271 input_report_key(dev, ke->keycode, value); 278 input_report_key(dev, ke->keycode, value);
272 input_sync(dev); 279 input_sync(dev);
273 if (value && autorelease) { 280 if (value && autorelease) {
@@ -305,12 +312,19 @@ bool sparse_keymap_report_event(struct input_dev *dev, unsigned int code,
305{ 312{
306 const struct key_entry *ke = 313 const struct key_entry *ke =
307 sparse_keymap_entry_from_scancode(dev, code); 314 sparse_keymap_entry_from_scancode(dev, code);
315 struct key_entry unknown_ke;
308 316
309 if (ke) { 317 if (ke) {
310 sparse_keymap_report_entry(dev, ke, value, autorelease); 318 sparse_keymap_report_entry(dev, ke, value, autorelease);
311 return true; 319 return true;
312 } 320 }
313 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
314 return false; 328 return false;
315} 329}
316EXPORT_SYMBOL(sparse_keymap_report_event); 330EXPORT_SYMBOL(sparse_keymap_report_event);