Add new attributes to the HID Report Parser and HID Host Mode Class driver to keep track of the largest report the device can send for buffer allocation purposes. Change MouseHostWithParser and KeyboardHostWithParser demos to only allocate the needed number of bytes.
This commit is contained in:
parent
3ffa7543a0
commit
242303c160
9 changed files with 41 additions and 25 deletions
|
@ -101,6 +101,7 @@ uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo
|
|||
}
|
||||
}
|
||||
|
||||
HIDInterfaceInfo->State.LargestReportSize = 8;
|
||||
HIDInterfaceInfo->State.IsActive = true;
|
||||
return HID_ENUMERROR_NoError;
|
||||
}
|
||||
|
@ -288,6 +289,7 @@ uint8_t USB_HID_Host_SetBootProtocol(USB_ClassInfo_HID_Host_t* const HIDInterfac
|
|||
if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful)
|
||||
return ErrorCode;
|
||||
|
||||
HIDInterfaceInfo->State.LargestReportSize = 8;
|
||||
HIDInterfaceInfo->State.UsingBootProtocol = true;
|
||||
|
||||
return HOST_SENDCONTROL_Successful;
|
||||
|
@ -339,6 +341,9 @@ uint8_t USB_HID_Host_SetReportProtocol(USB_ClassInfo_HID_Host_t* const HIDInterf
|
|||
return HID_ERROR_LOGICAL | ErrorCode;
|
||||
}
|
||||
|
||||
uint8_t LargestReportSizeBits = HIDInterfaceInfo->Config.HIDParserData->LargestReportSizeBits;
|
||||
HIDInterfaceInfo->State.LargestReportSize = (LargestReportSizeBits >> 3) + ((LargestReportSizeBits & 0x07) != 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue