Modify unit test report descriptor to match the working 3610

This commit is contained in:
Ciaran Woodward
2021-12-23 12:38:27 +00:00
parent 66a611f4fd
commit cb774f3c11

View File

@@ -20,9 +20,7 @@ static const USB_HID_Short_Item_t hidCollectionApplication = {
static const USB_HID_Short_Item_t hidCollectionEnd = { static const USB_HID_Short_Item_t hidCollectionEnd = {
.header = HID_REPORT_SET_HEADER(0, HID_REPORT_ITEM_TYPE_MAIN, HID_REPORT_ITEM_TAG_END_COLLECTION), .header = HID_REPORT_SET_HEADER(0, HID_REPORT_ITEM_TYPE_MAIN, HID_REPORT_ITEM_TAG_END_COLLECTION),
.data = { 0x00, 0x00 } }; .data = { 0x00, 0x00 } };
static const USB_HID_Short_Item_t hidCollectionLogical = {
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_MAIN, HID_REPORT_ITEM_TAG_COLLECTION),
.data = { 0x02, 0x00 } };
static const USB_HID_Short_Item_t hidInputConstArray = { static const USB_HID_Short_Item_t hidInputConstArray = {
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_MAIN, HID_REPORT_ITEM_TAG_INPUT), .header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_MAIN, HID_REPORT_ITEM_TAG_INPUT),
@@ -57,9 +55,25 @@ static const USB_HID_Short_Item_t hidReportSize1 = {
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_REPORT_SIZE), .header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_REPORT_SIZE),
.data = { 0x01, 0x00 } }; .data = { 0x01, 0x00 } };
static const USB_HID_Short_Item_t hidUsageConsumerControl = { static const USB_HID_Short_Item_t hidUsagePageGenericDesktop = {
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_USAGE_PAGE),
.data = { USB_HID_USAGE_PAGE_ID_GENERIC_DESKTOP, 0x00 }};
static const USB_HID_Short_Item_t hidUsagePageConsumerControl = {
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_USAGE_PAGE),
.data = { USB_HID_USAGE_PAGE_ID_CONSUMER, 0x00 }};
static const USB_HID_Short_Item_t hidUsagePageTelephony = {
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_USAGE_PAGE),
.data = { USB_HID_USAGE_PAGE_ID_TELEPHONY_DEVICE, 0x00 }};
static const USB_HID_Short_Item_t hidUsageKeyboard = {
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE), .header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
.data = { 0x01, 0x00 } }; .data = { 0x06, 0x00 }};
static const USB_HID_Short_Item_t hidUsageConsumerControl = {
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
.data = { 0x01, 0x00 }};
static const USB_HID_Short_Item_t hidUsageTelephonyHeadset = {
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
.data = { 0x05, 0x00 }};
/* /*
* Define the HID Report Descriptor Item, Usage Page, Report ID and length for each HID Report * Define the HID Report Descriptor Item, Usage Page, Report ID and length for each HID Report
@@ -93,6 +107,9 @@ static const USB_HID_Report_Element_t hidReportTelephony = {
.location = HID_REPORT_SET_LOC( USB_HID_REPORT_ID_TELEPHONY, 1, 0, 0 ) .location = HID_REPORT_SET_LOC( USB_HID_REPORT_ID_TELEPHONY, 1, 0, 0 )
}; };
/*
* Define configurable elements in the HID Report descriptor.
*/
static USB_HID_Report_Element_t hidUsageReport1Byte0Bit0 = { static USB_HID_Report_Element_t hidUsageReport1Byte0Bit0 = {
.item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE), .item.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_LOCAL, HID_REPORT_ITEM_TAG_USAGE),
.item.data = { 0x17, 0x00 }, .item.data = { 0x17, 0x00 },
@@ -199,72 +216,74 @@ static const USB_HID_Report_Element_t* const hidReports[] = {
* List all items in the HID Report descriptor. * List all items in the HID Report descriptor.
*/ */
static const USB_HID_Short_Item_t* const hidReportDescriptorItems[] = { static const USB_HID_Short_Item_t* const hidReportDescriptorItems[] = {
&(hidReportConsumer.item), &hidUsagePageGenericDesktop,
&hidUsageKeyboard,
&hidReportSize1,
&hidLogicalMinimum0,
&hidCollectionApplication, // Report 1
&hidReportId1,
&(hidReportKeyboard.item),
&hidLogicalMaximum1,
&hidReportCount1,
&(hidUsageReport1Byte0Bit0.item),
&hidInputDataVar,
&hidLogicalMaximum0,
&hidInputConstArray,
&hidLogicalMaximum1,
&(hidUsageReport1Byte0Bit2.item),
&hidInputDataVar,
&(hidUsageReport1Byte0Bit3.item),
&hidInputDataVar,
&hidLogicalMaximum0,
&hidReportCount4,
&hidInputConstArray,
&hidCollectionEnd,
&hidUsagePageConsumerControl,
&hidUsageConsumerControl, &hidUsageConsumerControl,
&hidCollectionApplication, &hidCollectionApplication, // Report 2
&hidReportSize1, &hidReportId2,
&hidLogicalMinimum0, &(hidReportConsumer.item),
&hidCollectionLogical, // Report 1 &hidLogicalMaximum1,
&hidReportId1, &hidReportCount1,
&(hidReportKeyboard.item), &(hidUsageReport2Byte0Bit0.item),
&hidLogicalMaximum1, &hidInputDataVar,
&hidReportCount1, &(hidUsageReport2Byte0Bit1.item),
&(hidUsageReport1Byte0Bit0.item), &hidInputDataVar,
&hidInputDataVar, &(hidUsageReport2Byte0Bit2.item),
&hidLogicalMaximum0, &hidInputDataVar,
&hidInputConstArray, &hidLogicalMaximum0,
&hidLogicalMaximum1, &hidInputConstArray,
&(hidUsageReport1Byte0Bit2.item), &hidLogicalMaximum1,
&hidInputDataVar, &(hidUsageReport2Byte0Bit4.item),
&(hidUsageReport1Byte0Bit3.item), &hidInputDataVar,
&hidInputDataVar, &hidLogicalMaximum0,
&hidLogicalMaximum0, &hidInputConstArray,
&hidReportCount4, &hidLogicalMaximum1,
&hidInputConstArray, &(hidUsageReport2Byte0Bit6.item),
&hidCollectionEnd, &hidInputDataVar,
&hidCollectionLogical, // Report 2 &(hidUsageReport2Byte0Bit7.item),
&hidReportId2, &hidInputDataVar,
&(hidReportConsumer.item), &hidLogicalMaximum0,
&hidLogicalMaximum1, &hidReportCount7,
&hidReportCount1, &hidInputConstArray,
&(hidUsageReport2Byte0Bit0.item), &hidLogicalMaximum1,
&hidInputDataVar, &hidReportCount1,
&(hidUsageReport2Byte0Bit1.item), &(hidUsageReport2Byte1Bit7.item),
&hidInputDataVar, &hidInputDataVar,
&(hidUsageReport2Byte0Bit2.item), &hidCollectionEnd,
&hidInputDataVar, &hidUsagePageTelephony,
&hidLogicalMaximum0, &hidUsageTelephonyHeadset,
&hidInputConstArray, &hidCollectionApplication, // Report 3
&hidLogicalMaximum1, &hidReportId3,
&(hidUsageReport2Byte0Bit4.item), &(hidReportTelephony.item),
&hidInputDataVar, &(hidUsageReport3Byte0Bit0.item),
&hidLogicalMaximum0, &hidInputDataVar,
&hidInputConstArray, &(hidUsageReport3Byte0Bit1.item),
&hidLogicalMaximum1, &hidInputDataVar,
&(hidUsageReport2Byte0Bit6.item), &hidLogicalMaximum0,
&hidInputDataVar, &hidReportCount6,
&(hidUsageReport2Byte0Bit7.item), &hidInputConstArray,
&hidInputDataVar, &hidCollectionEnd,
&hidLogicalMaximum0,
&hidReportCount7,
&hidInputConstArray,
&hidLogicalMaximum1,
&hidReportCount1,
&(hidUsageReport2Byte1Bit7.item),
&hidInputDataVar,
&hidCollectionEnd,
&hidCollectionLogical, // Report 3
&hidReportId3,
&(hidReportTelephony.item),
&(hidUsageReport3Byte0Bit0.item),
&hidInputDataVar,
&(hidUsageReport3Byte0Bit1.item),
&hidInputDataVar,
&hidLogicalMaximum0,
&hidReportCount6,
&hidInputConstArray,
&hidCollectionEnd,
&hidCollectionEnd
}; };
/* /*