When using multiple keyboards in OS X, modifier keys (shift, command, option, control) on one keyboard do not affect keys pressed on other keybeards. So typing "shift" on one keyboard and a "t" on the other would result in a lowercase "t" rather than an uppercase one.
Compile this code on a Mac and then run it in the command line, probably as Super User.
Code derived from osxbook.com
As specified on osxbook.com, my provided code is also released under the GPL license.
I wrote this back when OS X 10.5 was the current version of OS X.
I have no idea if any of this still works or applies, but I'm still sharing this in case anyone still needs it.