@@ -208,6 +208,12 @@ int sparse_keymap_setup(struct input_dev *dev,
208208 }
209209 }
210210
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+
211217 dev -> keycode = map ;
212218 dev -> keycodemax = map_size ;
213219 dev -> getkeycode = sparse_keymap_getkeycode ;
@@ -268,6 +274,7 @@ void sparse_keymap_report_entry(struct input_dev *dev, const struct key_entry *k
268274{
269275 switch (ke -> type ) {
270276 case KE_KEY :
277+ input_event (dev , EV_MSC , MSC_SCAN , ke -> code );
271278 input_report_key (dev , ke -> keycode , value );
272279 input_sync (dev );
273280 if (value && autorelease ) {
@@ -305,12 +312,19 @@ bool sparse_keymap_report_event(struct input_dev *dev, unsigned int code,
305312{
306313 const struct key_entry * ke =
307314 sparse_keymap_entry_from_scancode (dev , code );
315+ struct key_entry unknown_ke ;
308316
309317 if (ke ) {
310318 sparse_keymap_report_entry (dev , ke , value , autorelease );
311319 return true;
312320 }
313321
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+
314328 return false;
315329}
316330EXPORT_SYMBOL (sparse_keymap_report_event );
0 commit comments