Commit bb0b761c authored by Dean Camera's avatar Dean Camera
Browse files

Make the HID Report Parser Get/Set Report Item routines fail if a NULL pointer...

Make the HID Report Parser Get/Set Report Item routines fail if a NULL pointer to a report item is given.

Minor visual enhancement to the HIDReportViewer project.
parent 6599238d
......@@ -290,6 +290,9 @@ uint8_t USB_ProcessHIDReport(const uint8_t* ReportData,
bool USB_GetHIDReportItemInfo(const uint8_t* ReportData,
HID_ReportItem_t* const ReportItem)
{
if (ReportItem == NULL)
return false;
uint16_t DataBitsRem = ReportItem->Attributes.BitSize;
uint16_t CurrentBit = ReportItem->BitOffset;
uint32_t BitMask = (1 << 0);
......@@ -320,6 +323,9 @@ bool USB_GetHIDReportItemInfo(const uint8_t* ReportData,
void USB_SetHIDReportItemInfo(uint8_t* ReportData,
HID_ReportItem_t* const ReportItem)
{
if (ReportItem == NULL)
return;
uint16_t DataBitsRem = ReportItem->Attributes.BitSize;
uint16_t CurrentBit = ReportItem->BitOffset;
uint32_t BitMask = (1 << 0);
......
......@@ -140,7 +140,7 @@ int main(void)
((ReportSizeFeatureBits >> 3) + ((ReportSizeFeatureBits & 0x07) != 0)));
}
printf_P(PSTR("\r\n\r\nReport Items: %d\r\n"), HIDReportInfo.TotalDeviceReports);
puts_P(PSTR("\r\nReport Items:\r\n"));
for (uint8_t ItemIndex = 0; ItemIndex < HIDReportInfo.TotalReportItems; ItemIndex++)
{
const HID_ReportItem_t* RItem = &HIDReportInfo.ReportItems[ItemIndex];
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment