Tuesday, 14 May 2013

Fast Keyboard

After making some improvements (mainly related to USB reports buffering) it is time to test InputStick performance. In order to do that, I've modified USBKeyboard class by changing endpoint polling interval form 32ms to 1ms. In theory this should allow to send up to 1000 reports per second and as a result type 1000 characters (under some conditions).

First, take a look at this video:

So here's what happens:

application sends Alt+Insert combination, what starts music playback in Winamp

Now some simple math: 10000 characters in approximately 13 seconds gives 770 characters per second = 46200 characters per minute. Pretty fast and pretty close to 1000 characters per seconds what is highest possible value. I guess that after some further improvements I should be able to reach that value.

Are there any applications for that? At this rate, typing all four digit PIN codes, each followed by "Enter" key (50000 characters) will take approximately 65 seconds. In some real world scenario it probably will be necessary to add some delay between consecutive attempts, and deal with "Wrong Password" messages (for example: press "Enter" to try again). Also, there is an assumption that target will allow for infinite (OK, 10000 will also do) number of attempts.

Finally, some remarks. As you can see the test has been performed on Windows and I'm not sure how different systems may behave. It may be necessary to send additional USB report after each character ("release" key), or separate "Shift+Key" report into two reports: "Shift" and "Shift+Key". This may reduce final performance by two or three times, but still, even 15000 characters per minute is really fast, see: World Records in Typing.