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 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),
.data = { 0x06, 0x00 }};
static const USB_HID_Short_Item_t hidUsageConsumerControl = { static const USB_HID_Short_Item_t hidUsageConsumerControl = {
.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 = { 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,12 +216,11 @@ 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,
&hidUsageConsumerControl, &hidUsageKeyboard,
&hidCollectionApplication,
&hidReportSize1, &hidReportSize1,
&hidLogicalMinimum0, &hidLogicalMinimum0,
&hidCollectionLogical, // Report 1 &hidCollectionApplication, // Report 1
&hidReportId1, &hidReportId1,
&(hidReportKeyboard.item), &(hidReportKeyboard.item),
&hidLogicalMaximum1, &hidLogicalMaximum1,
@@ -222,7 +238,9 @@ static const USB_HID_Short_Item_t* const hidReportDescriptorItems[] = {
&hidReportCount4, &hidReportCount4,
&hidInputConstArray, &hidInputConstArray,
&hidCollectionEnd, &hidCollectionEnd,
&hidCollectionLogical, // Report 2 &hidUsagePageConsumerControl,
&hidUsageConsumerControl,
&hidCollectionApplication, // Report 2
&hidReportId2, &hidReportId2,
&(hidReportConsumer.item), &(hidReportConsumer.item),
&hidLogicalMaximum1, &hidLogicalMaximum1,
@@ -253,7 +271,9 @@ static const USB_HID_Short_Item_t* const hidReportDescriptorItems[] = {
&(hidUsageReport2Byte1Bit7.item), &(hidUsageReport2Byte1Bit7.item),
&hidInputDataVar, &hidInputDataVar,
&hidCollectionEnd, &hidCollectionEnd,
&hidCollectionLogical, // Report 3 &hidUsagePageTelephony,
&hidUsageTelephonyHeadset,
&hidCollectionApplication, // Report 3
&hidReportId3, &hidReportId3,
&(hidReportTelephony.item), &(hidReportTelephony.item),
&(hidUsageReport3Byte0Bit0.item), &(hidUsageReport3Byte0Bit0.item),
@@ -264,7 +284,6 @@ static const USB_HID_Short_Item_t* const hidReportDescriptorItems[] = {
&hidReportCount6, &hidReportCount6,
&hidInputConstArray, &hidInputConstArray,
&hidCollectionEnd, &hidCollectionEnd,
&hidCollectionEnd
}; };
/* /*