Phantom keyboards

Eggheads talking about bytes and stuff.
Post Reply
User avatar
Krishty
Site Admin
Posts: 1270
Joined: 2022-Jan-09, 00:59

Phantom keyboards

Post by Krishty »

Last year, over at Combatsim, we had a short discussion about phantom keyboards showing up in TFXplorer’s device list:
https://community.combatsim.com/topic/3 ... nt-5218099
mikew wrote:Something a bit strange, and this is on a PC running Win10 as host OS. Yes, there's a USB keyboard connected (which I'm typing on right now, so the driver seems OK) but just the one.
Krycztij wrote:Some USB keyboards create virtual devices for extended functionality, e. g. providing buttons and sliders for sound volume control. This is not part of the ordinary keyboard protocol, so they create a virtual dummy device related to SFX. (Observe that one of them has axes, and the other two have buttons – could be a slider vs. +-buttons if related to SFX.)

Windows does not seem to allow me reading input from those devices, but nonetheless enumerates them for me. This makes TFXplorer behave strangely around them. I will have to conduct further research on this later
Well, just today Raymond Chen wrote about this very problem: The Old New Thing – Filtering out fake keyboards from the GetRawInputDeviceList function

Raymond is the Win32 guru, blogging about Win32 for 19 years. He worked on the Kernel, the Window manager, the Application Compatibility, and even on Direct3D. If I hadn’t read his blog again and again and again, TFXplorer would easily have twice as much code and work not even half as well.

So I was pretty disappointed when I read (for the first time ever!)
It helps a little. Some of the phantom keyboards disappear. But at least on my machine, there’s one phantom keyboard left: It describes itself as a Virtual HID Framework (VHF) HID device. This appears to be a facility for creating virtual devices.

I don’t know enough about Windows device management to find an easy way to filter out these virtual keyboards. Even KeyboardCapabilities.KeyboardPresent appears to be faked out by them. Maybe somebody can pick up the ball here.
Well shit – I haven’t seen him giving up like this in 19 years! This problem seems freaking hard.
mikew
Data Genius
Posts: 558
Joined: 2022-Jan-09, 20:21

Re: Phantom keyboards

Post by mikew »

Seems Windows (like any big codebase developed over decades) is totally out of control. :(
Post Reply