0

I helped a friend buy his first PC a few months ago. His IT experience before this was limited to iOS, Android and Chromebooks. Today he reported that for the past few days pressing the 4 key on his keyboard has produced a 6. The 6 key produces a 6 as well. This is only happening with the main 4 key. Num pad 4 behaves normally.

He assumed it was a problem with the keyboard and bought a new one (both wired USB keyboards). But the behavior is the same with the new keyboard. I just had him try plugging both keyboards in to his friend's Win10 laptop and both behave normally there so this does appear to be an issue with his PC.

I will remote desktop (Zoom) with him tomorrow (we're in different timezones) and I plan to try the following:

  1. Resetting the keyboard settings.
    • I sent him an article that suggested these steps: "Open Control Panel > Language. Select your default language. If you have multiple languages enabled, move another language to the top of the list, to make it the primary language – and then again move your existing preferred language back to the top of the list. This will reset the keyboard."
    • He claims to have followed them correctly and that it didn't fix the issue. I'll try myself over Zoom to make sure.
  2. Uninstalling and reinstalling or at least resetting the keyboard device driver. I've not looked up the best way to do this on Win10 yet but assume I can get there from Device Manager.
  3. Installing PowerToys and seeing if the Keyboard Manager either reports an existing mapping is in place or allows one to be created to temporarily work around the issue.
  4. Installing some 3rd party key mapping application and doing the same as 3. But I'd prefer not to add a 3rd party program like that to his system.

If anyone recognizes this issue, or has some other or better ideas, I'd love to hear about it. I'm an ex-Windows developer so happy to dive in to the registry etc and you can be as technical as you like.

bosconi
  • 101

1 Answers1

0

Solved. TL;DR:

Somehow a key mapping had been added in the Windows registry. Deleting the Scancode Map registry key and restarting the machine resolved it. I used regedit but the SharpKeys free, open source app looks like a good choice for investigating and fixing this sort of issue.

Details to add to the collective information on this:

  1. Resetting the keyboard settings in the way described in my question didn't help. His machine only had one language installed (UK English), so we added US English. This triggered a download that tool a while, so I'd say skip this step.
  2. I was indeed able to reinstall the keyboard drive via Device Manager. I brought up the keyboard properties and on the driver tab removed the driver. After a restart (that took a while because an update was pending) we were back to where we were before. This turns out to be a Logitech wireless keyboard/mouse combo that connects via a small USB dongle. But it looks like there's nothing special to do with this kind of wireless keyboard/mouse. It seems to present to Windows directly as HID devices. I did not find additional USB drivers in Device Manager that were obviously related Logitech, HID etc or that weren't obviously for some other device.
  3. PowerToys's Keyboard Manager showed no key mappings in place, was happy to add a new mapping but (rather obviously with hindsight) refused to map 4 to itself.
  4. I didn't get to this, but if I had come back to it I think I would have gone with SharpKeys (GitHub repo, developer website posts) as it has been around for over 17 years at this point, is open source, widely used and operates directly on the Windows registry rather than interjecting some new component into the software stack that is involved in handling keyboard events...

Before step 4 I did some searches on resetting keyboard mappings in the registry. Plenty of articles and some even point to this previous SuperUser Q&A: How to undo custom keyboard mapping in registry.

I went with navigating to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout in regedit and deleting the Scancode Map key. After a Windows restart the 4 key is back to its expected behavior.

Checking on a friend's Win10 machine I see no value set for that registry key, so it would seem that this key is only set (and has a non-empty value) if one or more key mapping override is in place. (Based on one observation - YMMV.)

Give that SharpKeys works by manipulating the registry, there's a good chance it would have shown this "4 to 6" mapping if I'd installed it. So the best recommendation is probably to start with installing SharpKeys, especially when supporting a user who isn't familiar with regedit.

Some of the posts about this have titles along the lines of "What to do when an April Fool's Day prank has left your keyboard messed up". Pointing that out here so this answer might show up in search results along those lines.

I'm curious how my friend's machine ended up in this state. He's sure no one else has had physical access to it, and his anti-virus software reports no malware. I hope there's no way for a webpage to induce a registry change like this, and it doesn't seem like corruption. If anyone has an idea (specific to the "4 to 6" change or more generally how this can happen ... or if there's a way to see when it happened in Windows logs etc.) please leave a comment.

bosconi
  • 101