25 05 2006

Repeating key bug with USB keyboard

Category: Hardware, Linux

Here’s a solution for that strange repeating key glitch with your USB keyboard. You know, the one where you get repeating letters in the output when you type fast (e.g. when typing “mount” you get “mouount”).

The culprit is the usbkbd module, which is the device driver for the USB keyboard boot protocol. The boot protocol is a stripped-down version of the full USB keyboard protocol that is only supposed to be used in the system BIOS and other limited environments. The thing is, the usbhid module is perfectly capable of driving both your USB keyboard and mouse without the help of usbkbd or usbmouse.

But wait! Don’t go unloading those two modules just yet. If you do, your keyboard and mouse will drop dead. What you need to do is get rid of those two modules files and then reboot, causing the proper drivers to be loaded. Here’s what I did:

  1. Rename usbkbd.ko and usbmouse.ko in /lib/modules/x.y.z/kernel/drivers/usb/input
  2. (x.y.z is your kernel version)

  3. Build a new initrd image (which contains some drivers that are loaded at boot time):
        # cd /boot
        # mv initrd.img-x.y.z initrd.imb-x.y.z.bak
        # mkinitrd -o initrd.img-x.y.z
        
  4. Reboot and check that everything works

Just to be safe I recommend you keep and older kernel version around that you can boot with and restore the original initrd image if something goes wrong.

No Comments

Leave a comment