Add descriptor validation function & fix issues it found
Note this is in progress, I either want to move the check function somewhere else, or convert the printf calls to something else (I imagine some kind of log function exists?)
This commit is contained in:
@@ -50,6 +50,9 @@ static const USB_HID_Short_Item_t hidReportCount4 = {
|
||||
static const USB_HID_Short_Item_t hidReportCount6 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_REPORT_COUNT),
|
||||
.data = { 0x06, 0x00 } };
|
||||
static const USB_HID_Short_Item_t hidReportCount7 = {
|
||||
.header = HID_REPORT_SET_HEADER(1, HID_REPORT_ITEM_TYPE_GLOBAL, HID_REPORT_ITEM_TAG_REPORT_COUNT),
|
||||
.data = { 0x07, 0x00 } };
|
||||
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),
|
||||
.data = { 0x01, 0x00 } };
|
||||
@@ -243,9 +246,10 @@ static const USB_HID_Short_Item_t* const hidReportDescriptorItems[] = {
|
||||
&(hidUsageReport2Byte0Bit7.item),
|
||||
&hidInputDataVar,
|
||||
&hidLogicalMaximum0,
|
||||
&hidReportCount6,
|
||||
&hidReportCount7,
|
||||
&hidInputConstArray,
|
||||
&hidLogicalMaximum1,
|
||||
&hidReportCount1,
|
||||
&(hidUsageReport2Byte1Bit7.item),
|
||||
&hidInputDataVar,
|
||||
&hidCollectionEnd,
|
||||
|
||||
@@ -66,6 +66,11 @@ void test_print_report( void )
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
void test_validate_report( void ) {
|
||||
unsigned retVal = hidReportValidate();
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_GOOD, retVal );
|
||||
}
|
||||
|
||||
// Basic report descriptor tests
|
||||
void test_unprepared_hidGetReportDescriptor( void )
|
||||
{
|
||||
|
||||
@@ -127,6 +127,7 @@ static const USB_HID_Short_Item_t* const hidReportDescriptorItems[] = {
|
||||
&hidLogicalMaximum0,
|
||||
&hidReportCount6,
|
||||
&hidInputConstArray,
|
||||
&hidReportCount1,
|
||||
&hidLogicalMaximum1,
|
||||
&(hidUsageByte1Bit7.item),
|
||||
&hidInputDataVar,
|
||||
|
||||
@@ -40,6 +40,11 @@ void setUp( void )
|
||||
hidResetReportDescriptor();
|
||||
}
|
||||
|
||||
void test_validate_report( void ) {
|
||||
unsigned retVal = hidReportValidate();
|
||||
TEST_ASSERT_EQUAL_UINT( HID_STATUS_GOOD, retVal );
|
||||
}
|
||||
|
||||
// Basic report descriptor tests
|
||||
void test_unprepared_hidGetReportDescriptor( void )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user