A while ago, the backspace key on my laptop keyboard stopped working. If this had been a regular keyboard, I would have just taken it apart and cleaned or fixed whatever was the problem. But things are never so simple with laptops. The keyboard couldn't be removed except by disassembling the entire laptop. And I'm far too lazy for that. So for months I was going without a backspace key, which is of course a pain.
Then I got the brilliant idea of modifying my keyboard drivers to remap some rarely-used key to backspace. The only keys that I don't really use are Pause/Break and Num Lock. But it turns out that those two keys happen to be involved in some awful backwards compatibility mess. You see, in the old days, it was much cheaper and easier to make keyboards that mapped keys by position rather than by the actual meaning of the key, and then do the mapping from key position to key meaning in software. These positions codes are called scan codes, and are keyboard-specific. Every model keyboard can potentially have a completely different mapping of scan code to key meaning.
To make things even messier, scan codes can be variable-length, and special scan codes (typically E0, E1, and E2) can modify the meaning of the following scan code sequence. Now, I wanted to remap the Pause/Break key. Due to some historical idiocy, it turns out that keyboards transmit the Pause/Break key with the sequence "E1, LeftCtrl, NumLock". That is, rather than having its own unique scan code, the Pause/Break key is formed by combining the scan codes for the left Control key and the Num Lock key. As far as I know, it's the only key that works like that.
I don't think Windows keyboard layouts are capable of handling this oddity directly, so as a result Windows seems to contain a hack that converts the sequence "E1, LeftCtrl" into the pause/break key, and then ignores the Num Lock key that follows. In typical Microsoft style, none of this is documented.
So what happened was that when I pressed Pause/Break, it would indeed work as a backspace key, but then Windows would no longer ignore the Num Lock key that followed, so pressing my new backspace key would also toggle the numpad, which is an awful thing on a laptop. It took a while to figure out why. Finally I gave up on that and just remapped Num Lock to backspace, and Scroll Lock to Num Lock. And it works!
In retrospect, I suppose I could have just hijacked the Caps Lock key instead and avoided the whole mess.
It's nice to be able to do this kind of thing. It's a whole lot better than sending the laptop to Dell, paying them $100 to fix the keyboard, and having them mistakenly format my hard drive instead.
Comments
To become a non-anonymous Bryant, you can create an account. To not expose your email address, don't enter it. It's not required. Would you like me to erase the email address that's already been entered so spammers don't harvest it? :-)