views:

91

answers:

3

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).

A: 

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

bobobobo
Actually I'm already using it. I get the data but I don't know what the structure of that data is.
egon
+1  A: 

Did you find Jan Axelson's HID page yet? It might be in there somewhere.

http://www.lvr.com/hidpage.htm

jo0ls
A: 

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.

John Weldon
Yes, I'm already using those... the part I'm missing is what describes the hid-device raw output (as read by getRawInputData). And as I said - I know that HID-descriptors (part of winapi) contain that info but no idea how to get that info.
egon