Fixed USB_GetHIDReportItemInfo() function modifying the given report item's data when the report item does not exist within the supplied report of a multiple report HID device.

This commit is contained in:
Dean Camera 2010-08-10 12:13:07 +00:00
parent eb060db71b
commit f4de17207e
3 changed files with 12 additions and 6 deletions

View file

@ -276,7 +276,7 @@ uint8_t USB_ProcessHIDReport(const uint8_t* ReportData,
{
UsageMinMax.Minimum = 0;
UsageMinMax.Maximum = 0;
UsageListSize = 0;
UsageListSize = 0;
}
}
@ -292,9 +292,6 @@ bool USB_GetHIDReportItemInfo(const uint8_t* ReportData,
uint16_t DataBitsRem = ReportItem->Attributes.BitSize;
uint16_t CurrentBit = ReportItem->BitOffset;
uint32_t BitMask = (1 << 0);
ReportItem->PreviousValue = ReportItem->Value;
ReportItem->Value = 0;
if (ReportItem->ReportID)
{
@ -304,6 +301,9 @@ bool USB_GetHIDReportItemInfo(const uint8_t* ReportData,
ReportData++;
}
ReportItem->PreviousValue = ReportItem->Value;
ReportItem->Value = 0;
while (DataBitsRem--)
{
if (ReportData[CurrentBit / 8] & (1 << (CurrentBit % 8)))