From Deskthority wiki
Jump to navigation Jump to search

This article is a stub. You can help Deskthority by expanding it.

Universal Serial Bus, commonly referred to as USB, is a modern serial peripheral interface that is the current method for connecting keyboards and mice. USB allows for the connection of a vast range of peripherals to computers, including printers, network adapters, microphones, displays and hard drives.


USB allows a peripherals to expose multiple interfaces for different types of devices. For instance, a peripheral could be both a keyboard and a storage device, each on a separate logic interface.[footnote 1]

Unlike e.g. PS/2, the bus is controlled by the host. The host decides speed, timing, power management and whenever devices are allowed to send bytes to the host. Peripherals don't communicate between each-other.

USB does not actually have daisy-chaining but allows tree-shaped networks with a "hub" in each node. When a device has one or more external ports, either the device itself and its ports are all under the hub or the port is a pass-through through the device cable to a separate plug on the host side.[footnote 2]

A hub can be powered or not powered. On a non-powered hub, all input devices must share 500 mA power from the host between them (and the hub itself). This can cause problems with some backlit keyboards that use more power. If a device requests too much power, the host is within its rights to shut it off. Devices are also required to go into a low-power mode whenever the host does.

Human Interface Device

The Human Interface Device (HID) subprotocol is used for input devices including keyboards, pointing devices and game controllers. HID uses the USB 2.0 protocol (or earlier), even if the port is capable of faster speeds. This uses the original four leads that are present in every cable. A keyboard with a USB C port on the keyboard side should therefore work when plugged into a USB-Type A port capable of only USB 2.0.

Report Descriptor

The USB-HID specifies that every peripheral declares its report format in a "Report Descriptor", defined in a binary language that needs to be parsed on the host side. This complex report descriptor language should —in theory— allow for a very large number of different report formats, including keyboards for n-key rollover over full-speed (or greater) USB.

Unfortunately, because of its complexity, the standard has not been interpreted the same everywhere and there have been (or are) still slight differences in how host implementations work. For instance, MacOS X does not permit the same key to be reported twice.[1]

Keyboard Boot Protocol and NKRO

To avoid complexity in boot code, such as PC BIOS:es and bootloaders, the USB HID specification says that a keyboard or mouse interface that is "boot-capable" should use special hard-coded protocols when talking to BIOS:es, and to be able to switch back and forth between this and their regular protocol on ("Set Protocol") requests from the host. It also requires that each regular (non-boot) protocol be a superset of the corresponding boot protocol and that a report not be larger than eight bytes.

The keyboard boot protocol is however eight bytes long already, which means that boot-capable keyboards must in practice speak the boot protocol always. [footnote 3]. This protocol imposes a limit of six arbitrary keys plus modifiers to be pressed at one time. This limit is referred to as 6-key rollover, or 6KRO.

If a keyboard interface is not a "boot keyboard" however, then its report format is not restricted and could be capable of N-key rollover

Some keyboards work around this problem by allowing the user to select between 6-key and NKRO with a DIP switch or special key combination.

The trick to supporting both boot and NKRO is for the keyboard to expose two interfaces — one boot interface and one NKRO interface — but to not send (valid) reports on both at the same time. The change-overs happen when the keyboard receives "Set Protocol" requests, which (some) BIOS:es and all fully-fledged operating systems send.

Soarer's Converter and firmware employ a variation of this trick, known to work with both Windows, MacOS and Linux. The 6KRO "boot" protocol is sent always but the report descriptor for that interface describes it as containing no keys. Therefore, only a BIOS (which does not read report descriptors) would read from that interface but ignore the non-boot interface, and vice versa.[2]


  1. One device known to actually be both a keyboard and a storage device is the Kinesis Advantage 2, where the storage device is used for upgrading the keyboard's firmware and settings
  2. Some keyboards carry passthrough not only for a second USB bus but also for analogue headphone and microphone jacks.
  3. The "boot mouse" protocol however is only 3 bytes, which means that a boot-capable mouse interface's reports could have up to five additional bytes that a BIOS would just ignore.

External links

See also


  1. Post by thefloweringash on Geekhack—Noppoo Choc Mini on MacOS. Dated 2011-12-06
  2. Post by Soarer on Geekhack—Re:Are there any USB NKRO keyboards on the market yet?. Posted 2013-10-04. Retrieved 2016-03-06.