PS2 Protocol Discussion

User avatar
XMIT
[ XMIT ]

07 Aug 2018, 17:13

I saw this link from Hacker News yesterday:
http://www.os2museum.com/wp/how-fast-is ... -keyboard/

tl;dr - the PS/2 protocol can do ~1 ms response times, and USB HID does ~16ms (about 1/60 of a second). That's ... not great, especially by comparison.

I've had an idea for a while to do away with the keyboard controller entirely. The keyboard would boot in normal (BIOS) mode. But, it could enter a mode where it only sends key switch press information at the fastest rate possible. This could be a 256-bit word, with each bit representing a single switch's state. It would be up to a driver stack running (with realtime priority - polling, not interrupt driven) on the host to interpret these words and figure out what to do with them, serving them up to software on the host through a virtual keyboard interface.

Fun times.

andrewjoy

07 Aug 2018, 17:21

PS/2 was interrupt based tho right ? Its USB HDI that has polling.

User avatar
XMIT
[ XMIT ]

07 Aug 2018, 17:26

As to why 16 milliseconds—that appears to be an artifact of the particular (common) BIOS USB keyboard support implementation. All keyboard-related processing is done with a 16ms interval, including conversion of a USB key event into two (or more) scan codes seen by the keyboard interrupt handler.

Findecanor

07 Aug 2018, 18:02

We don't know which USB keyboard they tested with.
The USB HID polling interval can be limited by several components:
1. Theoretically, HID over the Full Speed USB is capable of polling at up to every 1 ms but Low Speed USB is polled at best only every 10 ms. The device sets the speed and it is always the same.*
2. The device declares the minimum polling interval. It could have been set to 16 ms even if it uses Full Speed USB.
3. The host controller could be limited to 16 ms polling interval, as the article suggests. There are motherboards that advertise being capable of 1 ms polling rate though.
4. Some host subsystems round up intervals to a power of 2 to make scheduling easier, 10 ms -> 16 ms.

*: Theoretically, the USB device could detach itself, change speed and re-attach itself electrically under firmware control.. but why would it?

User avatar
kakan

07 Aug 2018, 18:18

Their methodology doesn't go over using a USB keyboard over PS/2 or using another polling rate on said device. What it comes down to for me is the ergonomics of USB keyboard with a wide variety of switches and other things that gives you a competitive advantage. I myself haven't noticed a difference even tho I have over average response time. My conclusions comes from comparing mechanical USB devices to rubber domes ps/2 devices so it's not really fair to begin with. But shaving of 15ms would be huge as the margin is already low due to high speed internet and good peripherals.

hansichen

07 Aug 2018, 18:44

USB 2 or 3 is the solution, but people hardly care about that.
There is a good video in German how to set up a kinesis board to have an input latency of around 655 µs over USB.
https://www.youtube.com/watch?v=H2fipGm2ysY

Post Reply

Return to “Keyboards”