68

When I slam my hand onto my keyboard, only a maximum of 6 keys will be registered, I've tested this for the past few minutes and was unable to get more than 6. Is this the same on all keyboards? If not, what would be the distinguishing factor, If yes: why 6 specifically?

For clarification: I do not have a usecase for this, I am simply curious

90

Not all keyboards are like that. What you're referring to is called rollover or key rollover. This simply refers to a computer's ability to correctly handle several simultaneous keystrokes.

X-key rollover refers to how many keys you can press down at once, while still being registered by the computer.

I don't know if there is a standard "default" level, but many keyboards are 6-key rollover. There are some gaming and higher end keyboards that have true n-key rollover, which means each key is scanned completely independently by the keyboard hardware. This ensures that each keypress is correctly detected regardless of how many other keys are pressed down at the same time.

Depending on your keyboard, you could have the option to use 6-key rollover, or enable true n-key rollover. For example, I have a Deck Hassium Pro that has 6-key rollover by default, but there is a hotkey to enable true n-key rollover.

  • 68
    One reason for the 6 key limit: the HID specification requires that keyboards not report more than 6 keys at once to the BIOS (though the OS has no such limitations). See usb.org/sites/default/files/documents/hid1_11.pdf appendix B for reference. I suspect it's just that nobody wants to deal with having a BIOS mode and a "extended mode" with n-key rollover. – Andrew Sun Jun 6 '19 at 0:05
  • 23
    @AndrewSun: Bizarrely enough, this is only a restriction with USB. PS/2 keyboards can support true n-key rollover without having to provide "Am I talking to the BIOS?" logic. – Kevin Jun 6 '19 at 6:38
  • 5
    Does the n-key-rollover-hotkey work if you are already pressing six other keys when you hit it? – JDL Jun 6 '19 at 14:18
  • 14
    @JDL that was harder than I thought to test, but the answer is yes. – DrZoo Jun 6 '19 at 14:29
  • 8
    The claim that the HID specification requires this is really a myth. The boot report descriptor format does not support more than 6-key rollover (excluding modifiers). But that does not preclude the very thing that USB has designed in: alternative report descriptor formats. People can and do use those. unix.stackexchange.com/a/401773/5132 – JdeBP Jun 6 '19 at 19:28
56

Search for key rollover.

  • One limit occurs because most keyboards do not have individual wires for each key; instead the keyboard has a matrix (or several) where each key connects a specific row/column, and when too many simultaneous connections are made in the same matrix, they become impossible to distinguish.

    So the first number of simultaneous keys depends on how the keyboard's electronics were designed. Search "keyboard matrix ghosting" for quite a few articles on this topic.

  • If the keyboard's hardware avoids the physical issue, the other limit occurs due to the protocol used by USB HID devices – or rather, two protocols. To quote Wikipedia:

    For the user to get the benefit of the full n-key rollover, the complete key press status must be transmitted to the computer. When the data is sent via the USB protocol, there are two operating modes: Human Interface Device (HID) "report protocol" and "boot protocol". The boot protocol, which is enabled on boot, is limited to 8 modifier keys [...] followed by maximum 6 key codes. This will limit the number of simultaneous key presses that can be reported. To get full n-key rollover, HID report protocol must be implemented on both keyboard and computer.

    (If you're sure the keyboard supports it, then it might be just a matter of switching the driver in Windows.)

  • 2
    The first problem can be solved by putting each key in series with a diode. – Paul Jun 6 '19 at 9:20
2

Keyboards do not wire to each single key independently. Membrane keyboards use a sort of a sparse grid, which is just enough to tell which key is being pressed right now. Varying by the model, there's about 20 contacts between the membrane and the controller board, including the ground.

Every key being pressed or not is 104 bits of data per poll interval. If the membrane contained semiconductor components that could encode this data, it could send it to the controller. But the membrane is just a plastic film with a bit of silver tracing - a parallel analog interface that has no more capacity than its number of contact pins. The traces are placed such as to identify a couple keys being pressed simultaneously, plus the modifiers.

High-end keyboards are almost universally mechanical, built on a PCB, which supports active electronics at any place on the board. Early mechs included some 6KRO models, but the majority of mechanical keyboards today support NKRO, which means any number of keys will be registered simultaneously.

If you aren't prone to spills and look for guaranteed key registration, the way to go today is mechanical. (With spills, most back-lit mechanicals will die from the high current to the backlight hitting the controller.) There's a small segment that still prefers scissor membrane keyboards, and non-scissor membranes remain the second most spill-resistant practical keyboards after Topre's capacitor models, usually lumped in with mechanical ones.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.