# Strange key repeats on USB keyboard when typing normally



## Declan Hoare (Feb 14, 2021)

My keyboard shows up in lsusb as "Unicomp, Inc. Ruffian 6 Keyboard v3 [Model M]" and my motherboard is a Gigabyte AX370-Gaming K3 with the latest firmware, and I'm booting in UEFI mode.  I've just installed FreeBSD 12.2 and I'm getting strange key repeats as I type, both in text mode and in X, which wasn't happening on Arch Linux or NetBSD.

I think this has to do with key jamming.  The easiest way for me to reproduce this problem is to depress G, H, J, and K in order and then release them in order, which results in the text "ghghkj", whereas what I get when connecting the same keyboard to a Linux system is "ghkj".  The first "g" and "h" appear when pressing those buttons, and the rest of the text appears immediately on releasing H.  I'm also having frequent issues in practice, typing at normal speeds; the words "then" and "them" in this paragraph showed up as "theehn" and "theehm".

I've tried enabling "Port 60/64 emulation" in the UEFI setup in hopes of having the keyboard be detected as a PS/2 device instead to see if that would help, but I think it's still being used as a USB device, as it still shows up in lsusb.  I installed xf86-input-evdev and uninstalled xf86-input-libinput, which caused evdev to be used but it didn't make a difference so I changed it back (I would be happy to solve the problem in X even if it remains in text mode as I spend most of my time in X).  And I've set hald_enable and dbus_enable as described in the sticky in this forum, and rebooted, but this didn't affect the problem either.

Does anyone know how I can prevent these repeats from happening?


----------



## Snurg (Feb 14, 2021)

I once had a similar experience, and in the computer BIOS I found a setting "Emulate PS/2 Keyboard", "Legacy PS/2 support" and the like.
I suppose the background is that USB keyboards have 2- or 3-key rollover only, while PS/2 can take more keys without getting confused.

Edit: Good to see evdev is still available


----------



## Declan Hoare (Feb 15, 2021)

Based on what you said I tried harder to get it to recognise the keyboard as PS/2 but I don't think it will work on my hardware.  I disabled ukbd0 with PS/2 emulation enabled in the UEFI setup, but that gave me no keyboard input in FreeBSD.  I turned emulation back off and used an adapter to connect the keyboard to my physical PS/2 port but that didn't work at all, even in setup itself.  I tried a PS/2 keyboard and a different USB keyboard and both worked fine though, so it seems to be a clash with this particular keyboard.


----------



## Vladimir Kondratyev (Feb 15, 2021)

Looks like known issue. You can apply ukbd_rollover.patch from PR/253249 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=253249


----------



## jbo (Oct 29, 2021)

Relevant: https://forums.freebsd.org/threads/usb-keyboard-missed-extra-keystrokes.70063/#post-539037


----------

