Myths about USB NKRO and how USB HID works
devever.net
devever.net
There is at least one company making analog keyboards, mainly for gaming: https://wooting.io/
[1] https://www.realforce.co.jp/products/108UH-ANLG_AFAX01/index...
[2] https://www.youtube.com/watch?v=mhCSIy-Qt0M
[3] https://www.realforce.co.jp/en/products/R2A-US4G-BK/index.ht...
I really (really) like my topre realforce rgb although the apex pro is very close in terms of solid feel, and has much more interesting electronics.
Some keyboards also do that to support OSes that have broken HID drivers, like Mac.
The cost of replacing the MCU with something that can run USB1.1 instead of 1.0, cost of programming, cost of dealing with broken cases that don't support HID properly (for example BIOSes that don't send "boot proto only" command, or every Mac) quickly increase the total cost. And the margins are thin.
And then there's the fact that even people who should know better often believe myths about USB being unable to report more than 6 keys - even if they are keyboard vendors who should know better and are making a high-enough margin to use better controller.
someone counting cents will not use several microcontrollers + separate usb hub chip, where did you get that idea from anyway?
>cost of replacing the MCU with something that can run USB1.1 instead of 1.0
http://www.os2museum.com/wp/how-fast-again/ there is no hardware difference between 1.0 and 1.1.
As for counting cents - for majority of keyboards made, you'll get as little work done on the keyboard controller as possible. If they add a separate USB chip, it's usually logically separate from the keyboard anyway.
When you reach the more fancy keyboards, you deal with another problem.
Namely, what to do with all the broken software involved. Your priority for reducing costs is removing support calls, angry gamers calling when they can't change their overclocking parameters in BIOS, Macintosh users complaining the keyboard doesn't work at all, corporate/OEM clients returning keyboards because it is not possible to input password to McBuggy Disk Encryption and Employee Spyware v6.66 when the computer starts.
Those limit your options when the budget for your fancy keyboard would provide for better microcontroller.
How can this be for high end gaming keyboards that retail for $150-$200 or more?
However, if you have a modern USB 2.0 "gaming keyboard controller" polling at 1000ms, who cares. Job done, go home.
It's not even like sound where you'd be doing a bunch of DSP on it right after.
Cost of electronics is not everything.
What's broken on macOS?
Resulted in some keyboards having special cases for dealing with "NKRO" on Mac.
It's been a long time since I've gamed, but when I did I always used ESDF (which I picked up from Tribes). It seems kinda silly to hyper-optimize solely to a default like WSAD.
In 2020 keyboard mapping is still a mess IMHO but may be I'm missing something :)
This would be somewhat similar the more boutique input devices which are configurable in hardware.
That said, I question whether most people actually want key behavior to match the labeling. I think any touch typist would rather use their preferred layout regardless of labeling.
This problem would be infrequently encountered in the US (mostly just Dvorak and Colemak addicts) but is a lot more common in Europe due to AZERTY.
But that does not tell me why there is no standard way for a key map / layout to be transmitted by the hardware to the software.
When the vendor makes the keyboard, he's the one choosing both the physical layout (A vs Q) and the USB microcontroller behaviour, so nothing prevents transmission of physical layout in some way to the software.
In 2020 we do not have to tell the software what the screen resolution is, what the drive size is, but we still have to manually tell software AZERTY vs QWERTY ...
Besides is there any use for NKRO besides being a meme feature for overpriced keyboards? The only use case I can think of is if you play two player games on the same keyboard but doesn't seem very common these days (and you can probably buy a decent gamepad for the price of a NKRO keyboard).
When stroking a chord you can have 6+ keys held down easily. I design and write firmware for QMK powered writers/ergonomic keyboards, and NKRO is absolutely vital if you don't want to resort to serial devices [1]. Plover uses this technique to allow for use of gaming keyboards as a low cost stenographic writer powered by FOSS.
Add a clock chip to the HID device as well, and you could even get finer event-reporting granularity than the OS cares to poll for (i.e. the buffer delivered at (Polling Interval x N)ms, would contain events timestamped for (Interval x (N-1)) ms, (Interval x (N-1) + 1)ms, etc.) The timestamps could just be relative to the beginning of the interval, so they wouldn’t need to take up that many bits at all.
Two issues. Unless you use USB 2.0 high speed, USB "packets" (transactions) are small[1]. For low speed they can have 8 bytes of data, full speed 64 bytes. USB 2.0 HS is a lot more costly of course.
Secondly, keycodes that are sent in the same report have no defined order[2]. Thus if two keys were not present in previous report and are present in current report, the order in which those two keys are pressed are indeterminate to the OS.
So that would not be very helpful I think.
[1]: http://www.usbmadesimple.co.uk/ums_3.htm (Interrupt Transfers)
[2]: https://www.usb.org/document-library/device-class-definition... (Appendix C)
Yes, the key combination probably doesn't go over 6 keys at once and I don't always have ~8-16ms presses but switching over to NKRO + 1000Hz (which are coupled on QMK) would stop this from happening.
But the boot protocol has a six key limit, so that's what many devices support.
In "Appendix C - Keyboard Implementation" in the "USB Device Class Definition" document[1], it says:
"The following are the design requirements for USB keyboards:
- Non-modifier keys must be reported in Input (Array, Absolute) items. Reports must contain a list of keys currently pressed and not make/break codes (relative data)."
Of course you could make some HID device which has relative key events, but would the OS then recognize it as a keyboard?
[1]: https://www.usb.org/document-library/device-class-definition...
The "good old" PC/XT keyboards worked that way. By the time of the PS/2, there were two different ways to signal break scancodes, three scancode sets only some of which were supported by any given keyboard, a mapping system to make one set of new scancodes look like the PC/XT, fake modifiers so that the system still thought that pause was Control+Numlock, and keys that for similar XT compatibility emitted a complete make+break sequence for several scancodes on press. And multimedia keyboards that threatened to exceed the limit on 7-bit scancodes were just around the corner.
The USB HID protocol is a lot less messy. No scancode set switching. No prefix bytes. No translation. No XT backwards compatibility. And conversely: A well-defined mechanism for vendor extensions. Well-defined usages for a whole bunch of extra keys that one might want to add, from media players to more complete calculator keypads.
It also places no limit on the number of simultaneous keypresses. A USB HID keyboard report is a very simple concept. It is a big bitmap of the instantaneous state of every key on the keyboard. The boot report format is constrained, by (mostly) using an inverted-array form for that bitmap, 8 bytes only permitting 64 keys in normal bitmap form; but a 16-byte report transmitted as a straight bitmap could handle a keyboard with 128 simultaneous keys if that were desired.