jdogherman Posted April 15, 2010 Share Posted April 15, 2010 I know Darren had said that it was only limited to the USB bus but here is some numbers on what the Teensy theoretically might be able to do. looks to be a max 500-62.5 keystrokes Bandwidth - Less Than You Might Expect USB Keyboard speed is limited to 500 keystrokes per second, and some operating systems may limit the speed to only 62.5 keystrokes per second. There is nothing you can do about these limits. Reading the rest of this section will only help you understand why they exist. The HID protocol is used by USB keyboards, and HID uses the USB "interrupt" transfer type, which allocates 1 packet per a configurable number of USB frames. Each USB frame is 1ms, and the Teensyduino USB keyboard code requests the interval to be every frame. If the operating system honors this request, bandwidth is available for 1000 packets per second. Each keystroke requires 2 calls to Keyboard.send_now(), the first to press the key and the second to release it. This translates to 500 keystrokes per second. Of course, you can send 10 different keys in each, but logic inside the USB device driver will analyze for changes, which imposes a practical limit, especially when sending to already-written software which expects "normal" typing. Some operating systems might disregard the request and instead schedule 1 packet every 8 frames. At 16ms each, only 62.5 keystrokes per second are possible. Taken from: http://www.pjrc.com/teensy/td_keyboard.html Quote Link to comment Share on other sites More sharing options...
1n5aN1aC Posted April 15, 2010 Share Posted April 15, 2010 500/s is plenty to do what you need to get access (install something), but 62.5/s is't as good as I would have hoped. Quote Link to comment Share on other sites More sharing options...
Seshan Posted April 15, 2010 Share Posted April 15, 2010 62.5 keystrokes per second is still incredible fast. Quote Link to comment Share on other sites More sharing options...
Paul Stoffregen Posted April 15, 2010 Share Posted April 15, 2010 USB "interrupt" type endpoints have a descriptor field called "bInterval", which specifies the maximum (slowest) rate the host is supposed to poll them for new data. The number represents the maximum number of USB frames between initiating a USB transaction to check for new data. There are 1000 frames per second. According to the USB spec, the host is allowed to poll more frequently, and the device must allow polling at any speed, though returning a NAK is of course allowed when no data is to be sent. (the 650 page USB 2.0 spec says a lot more, but these are the main points relevant to this issue). Teensyduino sets bInterval to 1 for the keyboard. So according to the USB spec, it should never be polled slower than 1000 times per second. However, Microsoft is not known for adhering closely to standards! At least 1 knowledgeable person has told me (and claims to have verified) that some Windows systems will poll once every 8 frames in some cases, even if bInterval says they must poll faster. Of course, this is completely disregarding the USB standard, and there doesn't seem to be any documentation about it. Well, maybe there is? I've also heard hints that other unrelated things, maybe under the USB device's control, can influence if Microsoft's driver will honor the bInterval requirement or default to 125 Hz polling. I would really like to explore this further, and if possible modify the code so as many Windows systems as possible will use the correct polling speed. If you have a windows system that polls slow, please let me know. Quote Link to comment Share on other sites More sharing options...
shadowpwner Posted April 18, 2010 Share Posted April 18, 2010 Lets think about this in terms of "on the field usage". What would you need to type that's so long without waiting for or adding a delay for the computer to process? CMD takes 1 second to popup for me. Bandwidth usage isn't as important when you Teensy can also be implemented as a card reader? (In a future release) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.