USB custom HID error: Report Descriptor was not byte aligned
Hi,
I am doing a Button Box for my sim racing for controlling in game car settings. The project is very simple, is just 8 push buttons that the PC need to recognize as gamepad.
So, for this project I followed the ST Tutorial of How to implement a USB device custom HID class, until there it's all ok, but when I try to change the CUSTOM_HID_ReportDesc_FS (inside usbd_custom_hid_if.c) for the computer recognize the device as a gamepad, I get the error on windows "Report Descriptor was not byte aligned." and the error code 10. I already read a lot of documentations about USB descriptors, and followed a tutorial explaining how to program the report descriptor, and used the HID descriptor tool to generate it, so can someone help me saying where is the error?
/** Usb HID report descriptor. */
__ALIGN_BEGIN static uint8_t CUSTOM_HID_ReportDesc_FS[USBD_CUSTOM_HID_REPORT_DESC_SIZE] __ALIGN_END =
{
/* USER CODE BEGIN 0 */
0x05, 0x01, //Usage Page (Generic Desktop)
0x09, 0x05, //Usage (Game Pad)
0xA1, 0x01, //Collection (Application)
0xA1, 0x00, //Collection (Physical)
0x05, 0x09, //Usage Page (Button)
0x19, 0x01, //Usage Minimum (1)
0x29, 0x01, //Usage Maximum (1)
0x15, 0x00, //Logical Minimum (0)
0x25, 0x01, //Logical Maximum (1)
0x75, 0x64, //Report Size (64)
0x95, 0x01, //Report Count (1)
0x81, 0x00, //Input (Data, Var, Abs)
0xC0, //End Collection*/
/* Here is the Working HID Report Desc.
0x06, 0x00, 0xff, // Usage Page(Undefined )
0x0B, 0x05, // USAGE (Undefined)
0xa1, 0x01, // COLLECTION (Application)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255)
0x75, 0x08, // REPORT_SIZE (8)
0x95, 0x40, // REPORT_COUNT (64)
0x0B, 0x05, // USAGE (Undefined)
0x81, 0x02, // INPUT (Data,Var,Abs)
0x95, 0x40, // REPORT_COUNT (64)
0x0B, 0x05, // USAGE (Undefined)
0x91, 0x02, // OUTPUT (Data,Var,Abs)
0x95, 0x01, // REPORT_COUNT (1)
0x0B, 0x05, // USAGE (Undefined)
0xb1, 0x02, // FEATURE (Data,Var,Abs)
*/
/* USER CODE END 0 */
0xC0 /* END_COLLECTION */
};