I'm using RawInput for device management, in a project that I have been working on for some time. It works great, really, but...
After some hardware changes on my development system, including the addition of a second Wacom device, I'm having difficulty getting RawInput to enumerate the default mouse and keyboard input devices without going in and plugging hard values into the enumeration code.
When I call GetRawInputDeviceList and sort through the device instances based on their RawInput DeviceType, I have 5 keyboard devices and 6 mice, along with a slew of non-specific HID devices. Usually, the first keyboard device returned is the real default system keyboard -- but not always. Adding or removing USB devices between application runs almost always breaks it.
Digging deeper into the enumerated device instances, I thought that examining the RawInputDeviceInformation structure would help. For some devices, especially older input devices, there's a value that allows you to identify which device instance is a real physical device and not one of those phantom/pseudo devices. DeviceInformation structures on keyboard device instances all report a differing number of keys, with all the other significant values -- vendor, usage page, usage, etc. being identical. Unsurprisingly, the reported number of keys doesn't even reflect the actual number of physical keys on the keyboard.
DirectInput identifies the default system mouse and keyboard, and although it's based on RawInput, does it use RawInput to achieve this? Switching away from RawInput is not an option for me because of the other devices I am operating with it (Wacom, Logitech G19 etc). Any advice on how to straighten this out would be gratefully received, with thanks!