Author: tfaber
Date: Sat Jan 18 19:18:33 2014
New Revision: 61680

URL: http://svn.reactos.org/svn/reactos?rev=61680&view=rev
Log:
[HIDPARSER]
- Use the full bit range of input items instead of discarding high bits
CORE-7772 #resolve

Modified:
    trunk/reactos/lib/drivers/hidparser/api.c

Modified: trunk/reactos/lib/drivers/hidparser/api.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/hidparser/api.c?rev=61680&r1=61679&r2=61680&view=diff
==============================================================================
--- trunk/reactos/lib/drivers/hidparser/api.c   [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/hidparser/api.c   [iso-8859-1] Sat Jan 18 
19:18:33 2014
@@ -602,7 +602,7 @@
         return HIDPARSER_STATUS_INVALID_REPORT_LENGTH;
     }
 
-    for(Index = 0; Index < Report->ItemCount; Index++)
+    for (Index = 0; Index < Report->ItemCount; Index++)
     {
         //
         // get report item
@@ -632,10 +632,10 @@
         ASSERT(ReportItem->ByteOffset < ReportDescriptorLength);
 
         //
-        // FIXME: support items with variable bitlength
-        //
-        ASSERT(ReportItem->BitCount == 16);
-        Data = (ReportDescriptor[ReportItem->ByteOffset +1] & 0xFF) | 
(ReportDescriptor[ReportItem->ByteOffset +2] & 0xFF) << 8;
+        // one extra shift for skipping the prepended report id
+        //
+        Data = 0;
+        Parser->Copy(&Data, &ReportDescriptor[ReportItem->ByteOffset + 1], 
min(sizeof(ULONG), ReportDescriptorLength - (ReportItem->ByteOffset + 1)));
 
         //
         // shift data
@@ -699,7 +699,7 @@
         return HIDPARSER_STATUS_INVALID_REPORT_LENGTH;
     }
 
-    for(Index = 0; Index < Report->ItemCount; Index++)
+    for (Index = 0; Index < Report->ItemCount; Index++)
     {
         //
         // get report item
@@ -732,8 +732,7 @@
         // one extra shift for skipping the prepended report id
         //
         Data = 0;
-        Parser->Copy(&Data, &ReportDescriptor[ReportItem->ByteOffset +1], 
min(sizeof(ULONG), ReportDescriptorLength - (ReportItem->ByteOffset + 1)));
-        Data = ReportDescriptor[ReportItem->ByteOffset + 1];
+        Parser->Copy(&Data, &ReportDescriptor[ReportItem->ByteOffset + 1], 
min(sizeof(ULONG), ReportDescriptorLength - (ReportItem->ByteOffset + 1)));
 
         //
         // shift data
@@ -812,7 +811,6 @@
             //
             return CustomerScanCodes[i].ScanCode;
         }
-            
     }
 
     //


Reply via email to