0
votes

I am trying to emulate USB Multimedia keyboard, but stuck at HID report descriptor. I am manage to define "single report" descriptor, but then stuck when I am trying to add additional report id. Below example was minimized, in final application I am trying to put more data in single report, also MUTE function is choosen to make it testing simple.

0x09, 0x01,        // Usage (Consumer Control)
0xA1, 0x01,        // Collection (Application)

0x85, 0x01,        //   Report ID (1)
0x05, 0x0C,        //   Usage Page (Consumer)
0x15, 0x00,        //   Logical Minimum (0)
0x25, 0x01,        //   Logical Maximum (1)
0x75, 0x01,        //   Report Size (1)
0x95, 0x01,        //   Report Count (1)
0x09, 0xE2,        //   Usage (Mute)
0x81, 0x62,        //   Input (Data,Var,Abs,No Wrap,Linear,No Preferred State,Null State)

0x85, 0x02,        //   Report ID (2)
0x05, 0x0C,        //   Usage Page (Consumer)
0x15, 0x00,        //   Logical Minimum (0)
0x25, 0x01,        //   Logical Maximum (1)
0x75, 0x01,        //   Report Size (1)
0x95, 0x01,        //   Report Count (1)
0x09, 0xE2,        //   Usage (Mute)
0x81, 0x62,        //   Input (Data,Var,Abs,No Wrap,Linear,No Preferred State,Null State)
0xC0,              // End Collection

The result is, when I sent 0x01 0x01 (request 1, bit 1) computer (Windows) mute sounds, but when the USB device sent 0x02 0x01 (request 2, bit 2) over same endpoint, computer ignore it. I tried to group reports into Logical Collection, but it does not chane anything.

How this descriptor should look like?

PS there was obvious mistake in descriptor (missing Input entity for report #2) on the first post, but it was done when I simplified the descriptor for purpose of this question.

1
The descriptor looks ok to me (although there is no need to respecify global items such as logical min/max and report size/count if they have not changed). It may be helpful to update your question with the full report descriptor, the other descriptors and the code used to send the reports. Someone may spot the problem. Sometimes people forget to update the descriptor length after they change a descriptor, for example. - aja

1 Answers

0
votes

Accidently I solved the problem. More, the minimal example shown above is not working, but the issue was same as in my full implementation.

For some reason for Windows each report must be aligned to 8 bits, otherway the last byte which is "not complete" does not trigger expected action. The solution is to add byte alignment bits to the report.