Tutorial :HID device info structure from GetRawInputData



Question:

Where can I get the structure for an HID device?

For example:

 raw data from a device, using GetRawInputData:   (  0 137 117  0 146 130 24 128  0  )   (  0 137 117  0 146 130  8 128  0  )                            /\   at this I can see that  ||  there is being a button released   that means, at the 6-th char at 4-th bit  

By analyzing the raw stream I can figure out where are the buttons, switches and analog data. Is there a way to ask this information from Windows.

My main goal is to basically get structure:

Button - 6th char, 4th bit.  Analog - 2nd char  Switch - 6th char, 0-3th bit.  

The only solution I found was HID Descriptors. But I'm not sure how to use them. After reading documentation I felt like running into a brick wall. Is there maybe a good example how to use them or a book that describes them better. (Or a easier way doing it without descriptors)


I found HidP_GetButtons and HidP_GetUsages but still no idea how to extract the structure (as described above).


Solution:1

Oh, you have to use GetRawInputData. There is a somewhat crummy example on msdn.


Solution:2

The problem seems to be that each device has it's own structure. There doesn't seem to be a universal way through the win32 api to get the interpretation of the structure.

The combination of

Seems to get you all the information you can from win32.

After that, you probably need some external source of information (or generated by you), that describes specific fields etc.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »