How To: Fix USB Keyboards Missing the First Keypress in Linux

I use my laptop as a desktop with an external monitor, mouse & keyboard, and found that recently the keyboard would keep missing the first character of input – and it was driving me nuts. After much googling I found a blog post over at that narrowed the issue down to a USB sleep problem, and described how to blacklist a USB keyboard from going into sleep mode – and it works great!

The way to fix this issue is:

1 – Find the details of your USB keyboard via the lsusb command, like this:

2 – Once you can see your keyboard, if you can’t remember which way the vendor ID and product ID go (it’s that very order), you can get the details (in this case looking at the Microsoft keyboard on bus 003, device 002) like this:

3 – Next, edit (or create if necessary) the file: /etc/udev/rules.d/91-local.rules and place the following contents into it:

So for my USB keyboard I entered:

4 – Finally, with that done you can reload the udev rules with the following and you should be all set:

As a final note, I found that this (bizarrely) didn’t work when I used the lowercase hex codes (i.e. 045e & 00dd) – I had to put them to uppercase (045E & 00DD) for it to kick in!

Sanity restored! =D

P.S. If you want to disable your first (i.e. laptop) keyboard and/or are using laptop-mode-tools then the wulftone article has you covered. So many thanks to Trevor Bortin for this fix!

6 thoughts on “How To: Fix USB Keyboards Missing the First Keypress in Linux”

  1. Hey,

    First of all, thank you for posting this. I really hated typing my password twice when I came back to my computer because the keyboard sat for too long and ignored the first key press.

    I had the exact same problem, except I had to change a few things:

    SUBSYSTEM for my keyboard device was “input” and not “usb”

    Also, the input device itself didn’t have the idVendor and idProduct attributes, so I used ATTRS to include parent devices’ attributes.

    My final rule looked like this:

    ACTION==”add”, SUBSYSTEM==”input”, ATTRS{idVendor}==”2516″, ATTRS{idProduct}==”0015″, TEST==”power/control”, ATTR{power/control}=”on”

  2. Thank you for this post!

    I recently had this problem too, which I guess was either a new kernel install or related to some modifications I’d made to allow a USB controller to sleep, so that my laptop could be made to suspend properly.

    So glad you posted this – it was starting to seriously hamper my productivity!!

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.