Change HID report parser so that it can calculate and record the sizes (IN, OUT and FEATURE) of each report within the device, by report ID. This will be required in host mode, so that the host can determine how many bytes of data must be read in for each report.
Add to MouseHostWithParser and KeyboardHostWithParser demos to print out the report sizes when a valid device is connected.
This commit is contained in:
parent
331929833d
commit
524decdeb3
6 changed files with 103 additions and 21 deletions
|
@ -182,6 +182,20 @@ void Keyboard_HID_Task(void)
|
|||
break;
|
||||
}
|
||||
|
||||
printf("Total Reports: %d\r\n", HIDReportInfo.TotalDeviceReports);
|
||||
|
||||
for (uint8_t i = 0; i < HIDReportInfo.TotalDeviceReports; i++)
|
||||
{
|
||||
HID_ReportSizeInfo_t* CurrReportIDInfo = &HIDReportInfo.ReportIDSizes[i];
|
||||
|
||||
/* Print out the byte sizes of each report within the device */
|
||||
printf_P(PSTR(" + Report ID %d - In: %d bytes, Out: %d bytes, Feature: %d bytes\r\n"),
|
||||
CurrReportIDInfo->ReportID,
|
||||
((CurrReportIDInfo->BitsIn >> 3) + (CurrReportIDInfo->BitsIn & 0x07)),
|
||||
((CurrReportIDInfo->BitsOut >> 3) + (CurrReportIDInfo->BitsOut & 0x07)),
|
||||
((CurrReportIDInfo->BitsFeature >> 3) + (CurrReportIDInfo->BitsFeature & 0x07)));
|
||||
}
|
||||
|
||||
puts_P(PSTR("Keyboard Enumerated.\r\n"));
|
||||
|
||||
USB_HostState = HOST_STATE_Configured;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue