Keyboard nerdery: Difference between revisions

From Helpful
Jump to navigation Jump to search
Line 69: Line 69:
==Key rollover==
==Key rollover==


A many-key design often has a limit of buttons that you can press at the same time before it becomes ambiguous.


A design has the option to  
 
When you have a lot of buttons, you can give each one their own pair of wires and input,
but it is much more economical to use fewer wires.
 
This implies there is a limit of buttons that you can press at the same time before it becomes ambiguous.
When it does, a hardware implementation has the option to  
: '''ghost''' - keys are registered unrelated to the ones you pressed
: '''ghost''' - keys are registered unrelated to the ones you pressed
: '''block''' - not emitting some of the keys you pressed
: '''block''' - not emitting some of the keys you pressed


Most controllers, when they run into this limit, will block rather than ghost -- it's the safer option.
Most controllers, when they run into this limit, will block rather than ghost -- it's the safer option that also leads to fewer angry helpdesk calls.





Revision as of 17:12, 16 October 2023


"How do I type the euro sign on my keyboard" (and an introduction to the wild world that is keyboard input)

This article/section is a stub — some half-sorted notes, not necessarily checked, not necessarily correct. Feel free to ignore, or tell me about it.


Key rollover

When you have a lot of buttons, you can give each one their own pair of wires and input, but it is much more economical to use fewer wires.

This implies there is a limit of buttons that you can press at the same time before it becomes ambiguous. When it does, a hardware implementation has the option to

ghost - keys are registered unrelated to the ones you pressed
block - not emitting some of the keys you pressed

Most controllers, when they run into this limit, will block rather than ghost -- it's the safer option that also leads to fewer angry helpdesk calls.


Key rollover refers to the number of keys that can be registered simultaneously without either ghosting or blocking.

...regardless of which keys they are - so basically limited by the worst case you can find, not the best or average.

As that suggests, that worst-case number is not the maximum number of simultaneous keys you can get out if you get to choose.


Limits happen within clusters.


  • Take the cheap keyboard I'm typing this on.
I can press all of ASDFGHJKL at once - that's 9 right there.
If I hold down Q and A, I can't press E. This keyboard is in fact 2-key rollover (2KRO).
  • The same keyboard, within QWEASD
most combinations of 3 are fine
many combinations of 4 are fine
a few of 5 are fine
In fact, all problems seem to happen when pressing Q and E.
  • At the same time, I have zero conflicts within WASDFGR (and I can add either of Q or E, but not both).
  • Or, in fact, within WASDFGR, Shift, Control, Space, Tab - that's 11 keys.
In fact I can get a rather specific combination of 13 keys (possibly more, but it's very uncomfortable on the hands).


I'm assuming this is not uncommon in 2KRO keyboards, because game designers tend to put a lot of actions on those ten keys, and sorta-exclusive things on Q and E.


But - another cheap keyboard I have, also 2KRO, actually has a lot of conflicts within that same sorta-gaming set. Still mostly fine in most games, but enough to bother me.


This is one reason that 2KRO is a crapshoot for gaming, and 6KRO is basically the "never have to worry about it" choice.


Why limits?

The difference between the rollover number, and the maximum, and the fact that specific keys will and won't work together, often comes mainly from the way it's wired, and to a lesser degree from how it communicates.


Wiring Sure, you could wire all ~100ish keys separately, but that's so much wire, and difficult to route.

It's not even that wire costs much more. It's that routing that many wires around each other is somewhere between 'really messy' and 'impossible', depending on further constraints.


Instead, you can wire it in a way that is conceptually very similar to a switch matrix -- and probably best introduced that way.

This multiplexes the wires, in a way where keys share wires. Pressing any one is unambiguous, whereas specific combinations may be ambiguous or not.


When ambiguous, the controller has a choice - it can send out extra keypresses for things you didn't press, or it can say 'this is messy, I will send out nothing', which is clearly the safer choice.

Because of some practical details, it turns out that 2KRO is fairly simple to do, while more than that gets more involved.


Communication

The way it's communicated can also be a limitation.

Yet there are some silly (but very persistent) myths around this.


For example, USB has a simplified variant of keyboard protocol, with fixed size packets, with one byte reserved for modifier keys, and space for six scancodes.

This protocol is used during the text-mode part of PC boot, when the BIOS rather than the real OS is in control, because this is one of a few reasons the BIOS's USB stack can be a lot simpler.


This has led to the myth that USB is only ever 6KRO.

Yes, this simplified format is 6KRO, but only during boot.

And yes, many cheap keyboards implement only this protocol, because it's enough, particularly if on the mechanical side it's no better than 6KRO anyway.


But a full USB implementation includes all of USB HID spec, which can basically already work around that problem, e.g.

  • by switching to a device-specific driver (it would only be 6KRO during early boot, when it really doesn't matter).
  • by reporting as multiple completely standard 6KRO keyboards

Some NKRO keyboards do the latter. But many seem to prefer the driver way, more so when there's also colorful blinky LEDs to control(verify).


An even sillier myth is that because PS2 didn't have this problem (it sends a packet for each event), using one of those USB-to-PS2 adapters will make it it NKRO.

This makes no sense whatsoever, for multiple reasons. But the main one is that if your OS doesn't know how to talk to your NKRO keyboard, then neither will a generic adapter. And what it talks after that happens is irrelevant.



So how much do you need?

2-key rollover might be good enough for typing, because you tend to hit only one or two keys at a time.


Gamers will often be holding down four or five keys, so 2-key rollover isn't great,

sure it may work - I never noticed either of my 2KRO keyboard were that before.
but 2 is the only guarantee you have
The better one has no conflicts within the most typical gaming keys - involving more keys than I have fingers.
The worse one is still mostly fine within the keys you would most typically hold together in games.


But that difference also illustrates that you'll never know exactly which combinations of keys aren't going to work.

So if you want a guarantee, you look for designs that guarantee it.

Most gamers will be perfectly fine fine with 6KRO, because the specific combinations of 7 keys you can't hit are even harder to hit (certainly with one hand), and even easier to avoid by design.

NKRO then is overkill - but also the simplest way to never have to think about it again.


See also:

Keyboard response time

PS/2 protocol

Keycodes