What is the behavior of HidP_GetUsagesEx?

I am currently trying to get the usages from a HID input report with the HidP_GetUsagesEx() function.

I used HidP_GetCollectionDescription() to parse the report descriptor, which works fine, but when I try to read an acutal input report with HidP_GetUsagesEx() I get a HIDP_STATUS_INCOMPATIBLE_REPORT_ID error.

The report descriptor I provided to HidP_GetCollectionDescription() does not use report ids, so I’m confused at where this error is coming from. The descriptor I’ve parsed is a standard keyboard descriptor with the modifiers (E0-E7) in the first byte. Whenever I press a normal key, like the spacebar, HidP_GetUsagesEx() seems to work just fine, but as soon as I do anything that touches the first byte, HidP_GetUsagesEx() fails with HIDP_STATUS_INCOMPATIBLE_REPORT_ID. I can’t think of a reason this could happen other than HidP_GetUsagesEx() treating the first byte as a report id, despite the descriptor not defining any report ids.

Here is the descriptor I am currently parsing with HidP_GetCollectionDescription():

05 01 09 06 A1 01 05 07 19 E0 29 E7 15 00 25 01  	
75 01 95 08 81 02 95 01 75 08 81 01 05 08 95 05  	
75 01 19 01 29 05 91 02 95 01 75 03 91 01 95 06  	
75 08 15 00 26 FF 00 05 07 19 00 29 91 81 00 C0  

I’m really confused on what is happening here.

Have you tried specifying a report ID of 0?

Your descriptor decodes as

0x05, 0x01,        // Usage Page (Generic Desktop Ctrls)
0x09, 0x06,        // Usage (Keyboard)
0xA1, 0x01,        // Collection (Application)
0x05, 0x07,        //   Usage Page (Kbrd/Keypad)
0x19, 0xE0,        //   Usage Minimum (0xE0)
0x29, 0xE7,        //   Usage Maximum (0xE7)
0x15, 0x00,        //   Logical Minimum (0)
0x25, 0x01,        //   Logical Maximum (1)
0x75, 0x01,        //   Report Size (1)
0x95, 0x08,        //   Report Count (8)
0x81, 0x02,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x95, 0x01,        //   Report Count (1)
0x75, 0x08,        //   Report Size (8)
0x81, 0x01,        //   Input (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x05, 0x08,        //   Usage Page (LEDs)
0x95, 0x05,        //   Report Count (5)
0x75, 0x01,        //   Report Size (1)
0x19, 0x01,        //   Usage Minimum (Num Lock)
0x29, 0x05,        //   Usage Maximum (Kana)
0x91, 0x02,        //   Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0x95, 0x01,        //   Report Count (1)
0x75, 0x03,        //   Report Size (3)
0x91, 0x01,        //   Output (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0x95, 0x06,        //   Report Count (6)
0x75, 0x08,        //   Report Size (8)
0x15, 0x00,        //   Logical Minimum (0)
0x26, 0xFF, 0x00,  //   Logical Maximum (255)
0x05, 0x07,        //   Usage Page (Kbrd/Keypad)
0x19, 0x00,        //   Usage Minimum (0x00)
0x29, 0x91,        //   Usage Maximum (0x91)
0x81, 0x00,        //   Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position)
0xC0,              // End Collection

It seems that a report ID of 0 causes HidP_GetCollectionDescription() to fail with
HIDP_STATUS_INVALID_REPORT_TYPE, however specifying anything else works just fine! Thanks for the help.