🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

RawInput Hid HANDLE

Started by
2 comments, last by Funkymunky 3 years, 9 months ago

I've recently implemented RawInput in my engine, and I'm using the HID functions to query the devices on the system. When I call GetRawInputBuffer and start parsing RAWINPUT packets to HID devices, I can differentiate them by the HANDLE in the RAWINPUT header.

But I can't find a way to tie this HANDLE to anything returned by the HID functions (HidD_GetPreparsedData etc.) I can get the same HANDLE by calling GetRawInputDeviceList, but I still don't have all the extra information provided by the HID functions (product name, calibration data, etc.)

Advertisement

Hi, it's been some time since I used raw input and barely remember anything, but I thought you might find my wrapper implementation useful: https://github.com/turanszkij/WickedEngine/blob/master/WickedEngine/wiRawInput.cpp#L174

It handles mouse, keyboard, and generic gamepads (also filters out xbox controllers, because those are better handled by Xinput).

You can use GetRawInputDeviceInfo to fill the preparsed data, then use the Hidp stuff after that. The ParseRawInputBlock function in the file I linked basically deals with every device type I support.

That's very much appreciated! I think I figured it out though, I have to use GetRawInputDeviceInfo with RIDI_DEVICENAME to get the device path to open with CreateFile. I was getting it with SetupDiGetDeviceInterfaceDetail before, but this way I have the same HANDLE that will come in with the RAWINPUT packets.

Thanks for the reply!

This topic is closed to new replies.

Advertisement