I've followed the steps in the 'USB Library User's Guide' to implement a custom HID device. First I implemented a device with only one report and it worked fine. Now I want to add a second report and tried to add a report ID to each report descriptor. As soon as I do this, Windows shows a Error Code 10 for the device and it doesn't work anymore.
Here is the code for the report descriptors:
/**
* The LED report descriptor
*/
static const unsigned char g_pucCustomHidReportDescriptorLEDs[]=
{
ReportID(1),
UsagePage(0x08), // LED
Usage(0x4E),
Collection(USB_HID_APPLICATION),
LogicalMinimum(0),
LogicalMaximum(0xFFFF),
Usage(0x4E),
ReportSize(8),
ReportCount(6),
Output(USB_HID_INPUT_DATA | USB_HID_INPUT_VARIABLE | USB_HID_INPUT_ABS),
EndCollection,
};
/**
* The buttons report descriptor
*/
static const unsigned char g_pucCustomHidReportDescriptorButtons[]=
{
ReportID(2),
UsagePage(USB_HID_CONSUMER_DEVICE),
Usage(USB_HID_USAGE_CONSUMER_CONTROL),
Collection(USB_HID_APPLICATION),
LogicalMinimum(0),
LogicalMaximum(1),
Usage(0x36), // function buttons
ReportSize(1), // 1 bit per button
ReportCount(2), // 2 buttons
Input(USB_HID_INPUT_DATA | USB_HID_INPUT_VARIABLE | USB_HID_INPUT_ABS), // variable, absolute data
ReportCount(6),
Input(USB_HID_INPUT_CONSTANT | USB_HID_INPUT_ARRAY | USB_HID_INPUT_ABS),
EndCollection,
};
Both descriptors work fine when used alone and without the ReportID() macro but as soon as I add this macro I get the error described above.
As far as I know the report ID field is needed to support multiple reports. When I remove the report ID field the device is displayed as functional in the Device Manager but only the first descriptor works.
I'm using the Stellaris Launchpad with Code Composer Studio.
How to fix this error?