fixmint

Keyboard ghosting and rollover: why some key combinations fail

By · · 4 min read

Ghosting is when a keyboard reports a key you did not press, or drops one you did, because several keys are held down together. It happens on keyboards that share wires between keys. Rollover is how many key presses the keyboard can report at once. Basic USB keyboards often report six ordinary keys at a time, which is six-key rollover. Full N-key rollover reports every key that is down, and it is the one to look for if you game or type with many keys held together.

Keyboard testSome keys don’t respondOpen

How the key matrix causes ghosts

Most keyboards do not wire each key to its own line. Keys sit at the crossings of a grid of rows and columns. The controller finds a pressed key by driving one row at a time and reading which columns are active. Pressing a key closes the circuit at one crossing.

Ghosting happens when three pressed keys complete a path the controller can misread. Picture three keys at three corners of a rectangle on the grid. Hold them down, and the controller can trace a route through the rectangle to the fourth corner, so it reports a fourth key nobody pressed. Depending on the wiring and the scan order, you may see a phantom press appear, or a real key ignored. The ignored key is the one that fails when a game refuses a combination.

A diode under each key stops the loop. A diode passes current in one direction only, so the controller cannot trace a path back through other keys. Cheap membrane keyboards often omit diodes. Many keyboards with full rollover include them, which is why the two features are often sold together.

Rollover: 6KRO and NKRO

A USB keyboard tells the computer what is pressed by sending a small report, many times a second. The standard boot protocol report is eight bytes long. One byte flags the modifier keys, Shift, Ctrl, Alt and the Windows or Command key. One byte is reserved, and six bytes carry the codes of the ordinary keys that are down.

Because the six key slots are for ordinary keys, a boot-protocol keyboard can report six of them at once. Modifiers have their own byte, so holding Shift with six letters is still a valid report. A seventh ordinary key is not reported, and the report fills its key slots with an error code instead. That is six-key rollover, or 6KRO.

N-key rollover, NKRO, works differently. Instead of six slots, the report is a bitmap with one bit for each key. Every key that is down sets its own bit, so the keyboard can report any number of keys, within the limits of its own design.

Most typing never holds more than six ordinary keys together, so 6KRO is fine for text. It shows up in games, where several movement and action keys may be held at the same moment. Some keyboards limit rollover in wireless modes, so check the manufacturer's notes if you use one over Bluetooth.

Testing combinations

Use the keyboard test to check your own keyboard:

  1. Click the box, then hold one key. It turns mint while it is down, and the most-held counter reads 1.
  2. Add a second and third key, then a fourth, and watch the most-held figure rise. It stops at the number the browser can read, which may be lower than your keyboard's real rollover.
  3. Test a rectangle. On a standard layout, W, E and S are three corners of a rectangle whose fourth corner is D. Hold those three. If D lights up, and you did not press it, the keyboard is ghosting in that corner.
  4. Try a second set, such as R, T and F, whose fourth corner on a standard layout is G. A phantom on one set is a clue. Phantoms on several sets suggest the keyboard has no anti-ghosting.

The page shows what the browser receives. A phantom key the keyboard sends will light up, and a key the keyboard drops will stay dark. System keys such as volume and brightness may never reach the page at all, so do not count them as failures.

Fixes that work

  • Choose full rollover or anti-ghosting for games. If combinations matter to you, look for NKRO or anti-ghosting in the specification, not only in the marketing.
  • Move the combination. Bind a game's key combination to keys that do not form a rectangle on the grid. Use the test to find which sets ghost, then remap around them.
  • Try the cable. Some wireless keyboards report fewer keys than their wired mode. Test again over the cable before you decide the keyboard is at fault.
  • Do not blame the port. A USB hub or a different port does not change how the keys are wired. The limit is in the keyboard and its report, so a different port usually makes no difference.

Edge cases

  • Dead keys. A key that never responds has a different cause from ghosting. See why keyboard keys do not work.
  • Holds and repeats. Holding a key makes it repeat in a text box, and the test shows the repeat. A repeat is not a second press, so do not count it as a rollover result.
  • Stuck switches. A key that stays down after you release it is a switch fault, not ghosting. Clean the key and test again before you blame the matrix.
  • Laptops. Laptop keyboards vary a lot. Test the combinations that matter to you before you rely on them, rather than assuming full rollover.
Cover of HARDWARE THEORYHARDWARE THEORY

Twenty years of computing hardware explained: cores, clocks, memory and storage, and why your devices behave the way they do.

$4.99 Get it on Gumroad →