Fixed report data alignment issues in the MouseHostWithParser demo when X and Y movem...
authorDean Camera <dean@fourwalledcubicle.com>
Tue, 28 Jul 2009 15:14:54 +0000 (15:14 +0000)
committerDean Camera <dean@fourwalledcubicle.com>
Tue, 28 Jul 2009 15:14:54 +0000 (15:14 +0000)
Fixed HID Report Descriptor Parser not correctly resetting internal states when a REPORT ID element is encountered.

Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c
LUFA/Drivers/USB/Class/Host/HIDParser.c
LUFA/ManPages/ChangeLog.txt

index 63fce0d..8ea5e72 100644 (file)
@@ -260,12 +260,7 @@ void ProcessMouseReport(uint8_t* MouseReport)
                        if (!(FoundData))\r
                          continue;\r
                          \r
-                       int16_t DeltaMovement;\r
-                       \r
-                       if (ReportItem->Attributes.BitSize > 8)\r
-                         DeltaMovement = (int16_t)ReportItem->Value;\r
-                       else\r
-                         DeltaMovement = (int8_t)ReportItem->Value;\r
+                       int16_t DeltaMovement = (int16_t)(ReportItem->Value << (16 - ReportItem->Attributes.BitSize));\r
                        \r
                        /* Determine if the report is for the X or Y delta movement */\r
                        if (ReportItem->Attributes.Usage.Usage == USAGE_X)\r
index 18519a0..cee602a 100644 (file)
@@ -113,6 +113,8 @@ uint8_t USB_ProcessHIDReport(const uint8_t* ReportData, uint16_t ReportSize, HID
                                break;\r
                        case (TYPE_GLOBAL | TAG_GLOBAL_REPORTID):\r
                                CurrStateTable->ReportID                    = ReportItemData;\r
+                               BitOffsetIn = 0;\r
+                               BitOffsetOut = 0;\r
                                break;\r
                        case (TYPE_LOCAL | TAG_LOCAL_USAGE):\r
                                if (UsageStackSize == HID_USAGE_STACK_DEPTH)\r
index 2aaef12..1a09e8b 100644 (file)
@@ -73,6 +73,8 @@
   *  - Fixed Mouse/Keyboard demos not performing the correct arithmetic on the Idle period at the right times (thanks to Brian Dickman)\r
   *  - Fixed GenericHID failing HID class tests due to incorrect Logical Minimum and Logical Maximum values (thanks to Søren Greiner)\r
   *  - Fixed incorrect PIPE_EPNUM_MASK mask causing pipe failures on devices with endpoint addresses of 8 and above (thanks to John Andrews)\r
+  *  - Fixed report data alignment issues in the MouseHostWithParser demo when X and Y movement data size is not a multiple of 8 bits\r
+  *  - Fixed HID Report Descriptor Parser not correctly resetting internal states when a REPORT ID element is encountered\r
   *\r
   *\r
   *  \section Sec_ChangeLog090605 Version 090605\r