Wednesday, June 13, 2018

Stuck keys since the 1990s

Recently, I ran into another instance of one of the shift, alt, or ctrl keys getting logically stuck.  That is, any keyboard press you make gets a gratuitous instance of shift, alt, or ctrl, as if they were held down continuously.  This is similar to the problem described here and elsewhere.

A solution to this problem is to press and hold the offending stuck key, then pressing the delete key (not backspace).  Releasing both then restores the stuck key to its working state.  If you're not sure which key is stuck, you just go through ctrl+del, alt+del, shift+del, and so on, perhaps doing both left and right keys, until you get good behavior.

I am at a loss on how to form an opinion on the problem.  I first observed this behavior in the early 1990s on machines running MS-DOS --- and the delete fix I discovered back then still works today.  What are some possible explanations for this phenomenon?

One is that keyboards today use the same hardware controller as in the 1990s, that this interface has some random race condition in it, and that nobody fixed it since then.  Another is that essentially the same keyboard software driver has been ported along since the MS-DOS era into Windows, bugs and all, and this is why the problem replicates in modern as well as museum configurations.

The software explanation seems more likely because I've seen this happen on virtualized Windows machines: while the guest OS sees stuck keys, the host keyboard behavior is correct.  It's really weird to have to type e.g. alt+del on your machine, which is working correctly, so that the guest OS also sees alt+del, so that the guest keyboard behavior is thus restored.

In other words, the museum configurations where this problem manifests itself may be real (as in the 1990s) as well as emulated (as in today).  Specifically, the latest instance of this problem occurred while running DOSBox inside Windows XP inside VMware inside OS X, and I was called to correct the issue via Skype with screen sharing.  The symptom was that pressing 'e' resulted in a new Windows Explorer window rather than the character 'e' appearing on the screen.

However, different software is not a guarantee policy against stuck keys.  I see this weird keyboard behavior happen about once a year in Windows land.  I have also seen this on OS X, although much less frequently --- perhaps once every 5 years.  I saw this happen once on Linux, too.  I've tried to find reasonable bug reports for this problem several times, but alas I haven't found a good explanation for why this happens (much less a patch or a definitive fix). 

Could anyone please find and correct this bug?  I'd be also interested in a good diagnosis that determines where the problem actually is, even if the analysis does not come with a fix.