Advertisement
snaipperi

Linux N-key keyboard repeating key fix

Sep 5th, 2014
464
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 1.43 KB | None | 0 0
  1. --- drivers/hid/hid-input.c.original    2014-09-05 21:51:41.421798237 +0300
  2. +++ drivers/hid/hid-input.c     2014-09-05 22:03:30.573774280 +0300
  3. @@ -1063,6 +1063,20 @@ void hidinput_hid_event(struct hid_devic
  4.                 return;
  5.         }
  6.  
  7. +       /*
  8. +        * Some keyboards will report both HID keys 0x31 (\ and |) and
  9. +        * 0x32 (Non-US # and ~) which are both mapped to
  10. +        * KEY_BACKSLASH. This will cause spurious events causing
  11. +        * repeated backslash key presses. Handle this by tracking the
  12. +        * active HID code and ignoring the other one.
  13. +        */
  14. +       if (usage->type == EV_KEY && usage->code == KEY_BACKSLASH) {
  15. +               if (value)
  16. +                       field->hidinput->backslash_usage = usage->hid;
  17. +               else if (field->hidinput->backslash_usage != usage->hid)
  18. +                       return;
  19. +       }
  20. +
  21.         /* report the usage code as scancode if the key status has changed */
  22.         if (usage->type == EV_KEY && !!test_bit(usage->code, input->key) != value)
  23.                 input_event(input, EV_MSC, MSC_SCAN, usage->hid);
  24. --- include/linux/hid.h.original        2014-09-05 21:52:03.615797487 +0300
  25. +++ include/linux/hid.h 2014-09-05 22:03:30.573774280 +0300
  26. @@ -432,6 +432,7 @@ struct hid_input {
  27.         struct list_head list;
  28.         struct hid_report *report;
  29.         struct input_dev *input;
  30. +       unsigned backslash_usage;
  31.  };
  32.  
  33.  enum hid_type {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement