USB

From Deskthority wiki
Jump to: navigation, 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.

HID keyboards

Report Descriptor

The USB Human Interface Standard specifies that every peripheral (keyboards, mice, gamepads and others) declares its report format in a "Report Descriptor", which is in a binary language that needs to be parsed on the host side. This complex report descriptor language allows for a very large number of different report formats, including support for n-key rollover over full-speed (or greater) USB.

Boot Protocol

To avoid complexity in boot code, such as PC BIOS:es and bootloaders, the USB HID standard specifies that keyboards should also support a hard-coded "boot protocol" and be able to switch between this and its regular protocol on the host's request The boot protocol imposes a limitation of six concurrent keys plus modifiers to be pressed at one time. This behaviour is referred to as 6-key rollover, or 6KRO.

Most keyboards describe a protocol identical to the boot protocol as its regular protocol. There can be many arguments for such a design choice, including less complexity in the keyboard firmware, the protocol being well understood, 6KRO being more than enough for office use, 6KRO being more than what the keyboard's matrix supports, use of low-speed USB and compatibility with bad BIOS:es (read below).

BIOS problems

A problem is that many common BIOS:es and bootloaders do not follow the USB HID standard properly. They incorrectly expect that all keyboards talk the boot protocol from the start, and therefore they will never request the keyboard to switch from its regular protocol. This is the reason why some keyboards can not be used to enter BIOS on some PCs. Often the keyboard is blamed, while the fault lies with the BIOS.

Workarounds

A workaround that simply increases the size of the report (with the first eight bytes being the same as the boot report) does unfortunately cause some BIOS:es to crash.

A workaround for increased rollover capacity with maintained PC BIOS compatibility is to divide a longer report into smaller chunks, each sent from a different USB "endpoint". Unfortunately, several keyboards that employ this strategy do not work properly with MacOS X because it recognizes each endpoint as a separate device and does not combine modifiers from one keyboard with non-modifiers from another.

The forum user Soarer discovered a workaround that supposedly does work with both bad BIOS:es and MacOS. The keyboard presents two keyboard interfaces: The first is a "boot keyboard" that sends the boot report always but which is described in its Report Descriptor as empty - so the reports would be ignored by a capable host. The other interface sends the n-KRO protocol report but does not present itself as a "boot keyboard" - so it would be ignored by a non-capable BIOS.