aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2018-12-09 13:31:04 +1100
committerDean Camera <dean@fourwalledcubicle.com>2018-12-09 13:31:07 +1100
commit10163f4607dda747cbcd7ce89c0ce9ce477b3ec6 (patch)
tree694ad8f9b94a851f7fd3919a1b76fba41790d7b3
parentb3010839385f81c0f62c379aa3bb62862c26ddbb (diff)
downloadlufa-10163f4607dda747cbcd7ce89c0ce9ce477b3ec6.tar.gz
lufa-10163f4607dda747cbcd7ce89c0ce9ce477b3ec6.tar.bz2
lufa-10163f4607dda747cbcd7ce89c0ce9ce477b3ec6.zip
Fix HID report parser incorrectly decoding 32-bit USAGE elements.
-rw-r--r--LUFA/DoxygenPages/ChangeLog.txt1
-rw-r--r--LUFA/Drivers/USB/Class/Common/HIDParser.c6
2 files changed, 4 insertions, 3 deletions
diff --git a/LUFA/DoxygenPages/ChangeLog.txt b/LUFA/DoxygenPages/ChangeLog.txt
index 0880224ad..ebb815055 100644
--- a/LUFA/DoxygenPages/ChangeLog.txt
+++ b/LUFA/DoxygenPages/ChangeLog.txt
@@ -31,6 +31,7 @@
* - Fixed CDC_Device_Send*_P() and CDC_Host_Send*_P() variant functions not compiled out for UC3 architecture
* - Fixed USB_STRING_DESCRIPTOR_ARRAY() not accepting more than two byte long arrays
* - Fixed HID report parser corruption when parsing PUSH and POP report item elements
+ * - Fixed HID report parser incorrectly decoding 32-bit USAGE elements
* - Library Applications:
* - Fixed bootloaders not disabling global interrupts during erase and write operations (thanks to Zoltan)
* - Fixed bootloaders accepting flash writes to the bootloader region (thanks to NicoHood)
diff --git a/LUFA/Drivers/USB/Class/Common/HIDParser.c b/LUFA/Drivers/USB/Class/Common/HIDParser.c
index 87eaf7c67..08f894e6b 100644
--- a/LUFA/Drivers/USB/Class/Common/HIDParser.c
+++ b/LUFA/Drivers/USB/Class/Common/HIDParser.c
@@ -105,9 +105,6 @@ uint8_t USB_ProcessHIDReport(const uint8_t* ReportData,
break;
case HID_RI_USAGE_PAGE(0):
- if ((HIDReportItem & HID_RI_DATA_SIZE_MASK) == HID_RI_DATA_BITS_32)
- CurrStateTable->Attributes.Usage.Page = (ReportItemData >> 16);
-
CurrStateTable->Attributes.Usage.Page = ReportItemData;
break;
@@ -178,6 +175,9 @@ uint8_t USB_ProcessHIDReport(const uint8_t* ReportData,
if (UsageListSize == HID_USAGE_STACK_DEPTH)
return HID_PARSE_UsageListOverflow;
+ if ((HIDReportItem & HID_RI_DATA_SIZE_MASK) == HID_RI_DATA_BITS_32)
+ CurrStateTable->Attributes.Usage.Page = (ReportItemData >> 16);
+
UsageList[UsageListSize++] = ReportItemData;
break;