[ros-diffs] [janderwald] 55332: [HIDPARSE] - Start support for multi top level hid collections - Not yet full implemented - Required for proper usb composite support

janderwald at svn.reactos.org janderwald at svn.reactos.org
Mon Jan 30 19:29:26 UTC 2012


Author: janderwald
Date: Mon Jan 30 19:29:26 2012
New Revision: 55332

URL: http://svn.reactos.org/svn/reactos?rev=55332&view=rev
Log:
[HIDPARSE]
- Start support for multi top level hid collections
- Not yet full implemented
- Required for proper usb composite support

Modified:
    branches/usb-bringup-trunk/lib/drivers/hidparser/api.c
    branches/usb-bringup-trunk/lib/drivers/hidparser/hidparser.c
    branches/usb-bringup-trunk/lib/drivers/hidparser/hidparser.h
    branches/usb-bringup-trunk/lib/drivers/hidparser/parser.c
    branches/usb-bringup-trunk/lib/drivers/hidparser/parser.h

Modified: branches/usb-bringup-trunk/lib/drivers/hidparser/api.c
URL: http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/lib/drivers/hidparser/api.c?rev=55332&r1=55331&r2=55332&view=diff
==============================================================================
--- branches/usb-bringup-trunk/lib/drivers/hidparser/api.c [iso-8859-1] (original)
+++ branches/usb-bringup-trunk/lib/drivers/hidparser/api.c [iso-8859-1] Mon Jan 30 19:29:26 2012
@@ -95,89 +95,73 @@
 }
 
 PHID_REPORT
+HidParser_GetReportInCollection(
+    PHID_COLLECTION Collection,
+    IN UCHAR ReportType)
+{
+    ULONG Index;
+    PHID_REPORT Report;
+
+    //
+    // search in local array
+    //
+    for(Index = 0; Index < Collection->ReportCount; Index++)
+    {
+        if (Collection->Reports[Index]->Type == ReportType)
+        {
+            //
+            // found report
+            //
+            return Collection->Reports[Index];
+        }
+    }
+
+    //
+    // search in local array
+    //
+    for(Index = 0; Index < Collection->NodeCount; Index++)
+    {
+        Report = HidParser_GetReportInCollection(Collection->Nodes[Index], ReportType);
+        if (Report)
+        {
+            //
+            // found report
+            //
+            return Report;
+        }
+    }
+
+    //
+    // not found
+    //
+    return NULL;
+}
+
+PHID_REPORT
 HidParser_GetReportByType(
     IN PHID_PARSER Parser,
-    IN ULONG ReportType)
-{
-    PHID_PARSER_CONTEXT ParserContext;
-    ULONG Index;
-
-    //
-    // get parser context
-    //
-    ParserContext = (PHID_PARSER_CONTEXT)Parser->ParserContext;
-
-    //
-    // sanity checks
-    //
-    ASSERT(ParserContext);
-
-    //
-    // FIXME support multiple top collecions
-    //
-    ASSERT(ParserContext->RootCollection->NodeCount == 1);
-    for(Index = 0; Index < ParserContext->ReportCount; Index++)
-    {
-        //
-        // check if the report type match
-        //
-        if (ParserContext->Reports[Index]->Type == ReportType)
-        {
-            //
-            // found report
-            //
-            return ParserContext->Reports[Index];
-        }
-    }
-
-    //
-    // report not found
-    //
-    return NULL;
-}
-
-
-ULONG
-HidParser_NumberOfReports(
-    IN PHID_PARSER Parser,
-    IN ULONG ReportType)
-{
-    PHID_PARSER_CONTEXT ParserContext;
-    ULONG Index;
-    ULONG ReportCount = 0;
-
-    //
-    // get parser context
-    //
-    ParserContext = (PHID_PARSER_CONTEXT)Parser->ParserContext;
-
-    //
-    // sanity checks
-    //
-    ASSERT(ParserContext);
-
-    //
-    // FIXME support multiple top collecions
-    //
-    ASSERT(ParserContext->RootCollection->NodeCount == 1);
-    for(Index = 0; Index < ParserContext->ReportCount; Index++)
-    {
-        //
-        // check if the report type match
-        //
-        if (ParserContext->Reports[Index]->Type == ReportType)
-        {
-            //
-            // found report
-            //
-            ReportCount++;
-        }
-    }
-
-    //
-    // done
-    //
-    return ReportCount;
+    IN ULONG CollectionIndex,
+    IN UCHAR ReportType)
+{
+    PHID_COLLECTION Collection;
+
+    //
+    // find collection
+    //
+    Collection = HidParser_GetCollection(Parser, CollectionIndex);
+    if (!Collection)
+    {
+        //
+        // no such collection
+        //
+        ASSERT(FALSE);
+        return NULL;
+    }
+
+    //
+    // search report
+    //
+    return HidParser_GetReportInCollection(Collection, ReportType);
 }
 
 HIDPARSER_STATUS
@@ -212,6 +196,7 @@
 ULONG
 HidParser_GetReportLength(
     IN PHID_PARSER Parser,
+    IN ULONG CollectionIndex,
     IN ULONG ReportType)
 {
     PHID_PARSER_CONTEXT ParserContext;
@@ -236,7 +221,7 @@
     //
     // get first report
     //
-    Report = HidParser_GetReportByType(Parser, ReportType);
+    Report = HidParser_GetReportByType(Parser, CollectionIndex, ReportType);
     if (!Report)
     {
         //
@@ -289,6 +274,7 @@
 ULONG
 HidParser_GetReportItemCountFromReportType(
     IN PHID_PARSER Parser,
+    IN ULONG CollectionIndex,
     IN ULONG ReportType)
 {
     PHID_PARSER_CONTEXT ParserContext;
@@ -312,7 +298,7 @@
     //
     // get report
     //
-    Report = HidParser_GetReportByType(Parser, ReportType);
+    Report = HidParser_GetReportByType(Parser, CollectionIndex, ReportType);
     if (!Report)
     {
         //
@@ -331,6 +317,7 @@
 ULONG
 HidParser_GetReportItemTypeCountFromReportType(
     IN PHID_PARSER Parser,
+    IN ULONG CollectionIndex,
     IN ULONG ReportType,
     IN ULONG bData)
 {
@@ -357,7 +344,7 @@
     //
     // get report
     //
-    Report = HidParser_GetReportByType(Parser, ReportType);
+    Report = HidParser_GetReportByType(Parser, CollectionIndex, ReportType);
     if (!Report)
     {
         //
@@ -398,7 +385,8 @@
 
 ULONG
 HidParser_GetContextSize(
-    IN PHID_PARSER Parser)
+    IN PHID_PARSER Parser,
+    IN ULONG CollectionIndex)
 {
     //
     // FIXME the context must contain all parsed info
@@ -540,6 +528,7 @@
 ULONG
 HidParser_GetMaxUsageListLengthWithReportAndPage(
     IN PHID_PARSER Parser,
+    IN ULONG CollectionIndex,
     IN ULONG ReportType,
     IN USAGE  UsagePage  OPTIONAL)
 {
@@ -567,7 +556,7 @@
     //
     // get report
     //
-    Report = HidParser_GetReportByType(Parser, ReportType);
+    Report = HidParser_GetReportByType(Parser, CollectionIndex, ReportType);
     if (!Report)
     {
         //
@@ -600,6 +589,7 @@
 HIDPARSER_STATUS
 HidParser_GetSpecificValueCapsWithReport(
     IN PHID_PARSER Parser,
+    IN ULONG CollectionIndex,
     IN ULONG ReportType,
     IN USHORT UsagePage,
     IN USHORT Usage,
@@ -631,7 +621,7 @@
     //
     // get report
     //
-    Report = HidParser_GetReportByType(Parser, ReportType);
+    Report = HidParser_GetReportByType(Parser, CollectionIndex, ReportType);
     if (!Report)
     {
         //
@@ -705,6 +695,7 @@
 HIDPARSER_STATUS
 HidParser_GetUsagesWithReport(
     IN PHID_PARSER Parser,
+    IN ULONG CollectionIndex,
     IN ULONG  ReportType,
     IN USAGE  UsagePage,
     OUT USAGE  *UsageList,
@@ -739,7 +730,7 @@
     //
     // get report
     //
-    Report = HidParser_GetReportByType(Parser, ReportType);
+    Report = HidParser_GetReportByType(Parser, CollectionIndex, ReportType);
     if (!Report)
     {
         //
@@ -852,6 +843,7 @@
 HIDPARSER_STATUS
 HidParser_GetScaledUsageValueWithReport(
     IN PHID_PARSER Parser,
+    IN ULONG CollectionIndex,
     IN ULONG ReportType,
     IN USAGE UsagePage,
     IN USAGE  Usage,
@@ -884,7 +876,7 @@
     //
     // get report
     //
-    Report = HidParser_GetReportByType(Parser, ReportType);
+    Report = HidParser_GetReportByType(Parser, CollectionIndex, ReportType);
     if (!Report)
     {
         //
@@ -1042,6 +1034,7 @@
 HIDPARSER_STATUS
 HidParser_TranslateUsage(
     IN PHID_PARSER Parser,
+    IN ULONG CollectionIndex,
     IN USAGE Usage,
     IN HIDP_KEYBOARD_DIRECTION  KeyAction,
     IN OUT PHIDP_KEYBOARD_MODIFIER_STATE  ModifierState,
@@ -1072,4 +1065,16 @@
     // done
     //
     return HIDPARSER_STATUS_SUCCESS;
-}
+}
+
+ULONG
+HidParser_GetCollectionNumberFromParserContext(
+    IN PHID_PARSER Parser)
+{
+    PHID_PARSER_CONTEXT Context = (PHID_PARSER_CONTEXT)Parser->ParserContext;
+
+    //
+    // get parser context
+    //
+    return Context->CollectionIndex;
+}

Modified: branches/usb-bringup-trunk/lib/drivers/hidparser/hidparser.c
URL: http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/lib/drivers/hidparser/hidparser.c?rev=55332&r1=55331&r2=55332&view=diff
==============================================================================
--- branches/usb-bringup-trunk/lib/drivers/hidparser/hidparser.c [iso-8859-1] (original)
+++ branches/usb-bringup-trunk/lib/drivers/hidparser/hidparser.c [iso-8859-1] Mon Jan 30 19:29:26 2012
@@ -69,16 +69,12 @@
     // get collection count
     //
     CollectionCount = HidParser_NumberOfTopCollections(Parser);
-
-    //
-    // FIXME: only one top level collection is supported
-    //
-    ASSERT(CollectionCount <= 1);
     if (CollectionCount == 0)
     {
         //
         // no top level collections found
         //
+        ASSERT(FALSE);
         return STATUS_NO_DATA_DETECTED;
     }
 
@@ -119,9 +115,9 @@
         //
         DeviceDescription->ReportIDs[Index].CollectionNumber = Index + 1;
         DeviceDescription->ReportIDs[Index].ReportID = Index; //FIXME
-        DeviceDescription->ReportIDs[Index].InputLength = HidParser_GetReportLength(Parser, HID_REPORT_TYPE_INPUT);
-        DeviceDescription->ReportIDs[Index].OutputLength = HidParser_GetReportLength(Parser, HID_REPORT_TYPE_OUTPUT);
-        DeviceDescription->ReportIDs[Index].FeatureLength = HidParser_GetReportLength(Parser, HID_REPORT_TYPE_FEATURE);
+        DeviceDescription->ReportIDs[Index].InputLength = HidParser_GetReportLength(Parser, Index, HID_REPORT_TYPE_INPUT);
+        DeviceDescription->ReportIDs[Index].OutputLength = HidParser_GetReportLength(Parser, Index, HID_REPORT_TYPE_OUTPUT);
+        DeviceDescription->ReportIDs[Index].FeatureLength = HidParser_GetReportLength(Parser, Index, HID_REPORT_TYPE_FEATURE);
 
         //
         // init collection description
@@ -143,7 +139,7 @@
         //
         // set preparsed data length
         //
-        DeviceDescription->CollectionDesc[Index].PreparsedDataLength = HidParser_GetContextSize(Parser);
+        DeviceDescription->CollectionDesc[Index].PreparsedDataLength = HidParser_GetContextSize(Parser, Index);
         DeviceDescription->CollectionDesc[Index].PreparsedData = Parser->Alloc(DeviceDescription->CollectionDesc[Index].PreparsedDataLength);
         if (!DeviceDescription->CollectionDesc[Index].PreparsedData)
         {
@@ -209,23 +205,24 @@
     OUT PHIDP_CAPS  Capabilities)
 {
     ULONG CollectionNumber;
+
+    //
+    // get collection number from context
+    //
+    CollectionNumber = HidParser_GetCollectionNumberFromParserContext(Parser);
+
     //
     // zero capabilities
     //
     Parser->Zero(Capabilities, sizeof(HIDP_CAPS));
 
     //
-    // FIXME support multiple top level collections
-    //
-    CollectionNumber = 0;
-
-    //
     // init capabilities
     //
     HidParser_GetCollectionUsagePage(Parser, CollectionNumber, &Capabilities->Usage, &Capabilities->UsagePage);
-    Capabilities->InputReportByteLength = HidParser_GetReportLength(Parser, HID_REPORT_TYPE_INPUT);
-    Capabilities->OutputReportByteLength = HidParser_GetReportLength(Parser, HID_REPORT_TYPE_OUTPUT);
-    Capabilities->FeatureReportByteLength = HidParser_GetReportLength(Parser, HID_REPORT_TYPE_FEATURE);
+    Capabilities->InputReportByteLength = HidParser_GetReportLength(Parser, CollectionNumber, HID_REPORT_TYPE_INPUT);
+    Capabilities->OutputReportByteLength = HidParser_GetReportLength(Parser, CollectionNumber, HID_REPORT_TYPE_OUTPUT);
+    Capabilities->FeatureReportByteLength = HidParser_GetReportLength(Parser, CollectionNumber, HID_REPORT_TYPE_FEATURE);
 
     //
     // always pre-prend report id
@@ -237,29 +234,29 @@
     //
     // get number of link collection nodes
     //
-    Capabilities->NumberLinkCollectionNodes = HidParser_GetTotalCollectionCount(Parser);
+    Capabilities->NumberLinkCollectionNodes = HidParser_GetTotalCollectionCount(Parser, CollectionNumber);
 
     //
     // get data indices
     //
-    Capabilities->NumberInputDataIndices = HidParser_GetReportItemTypeCountFromReportType(Parser, HID_REPORT_TYPE_INPUT, TRUE);
-    Capabilities->NumberOutputDataIndices = HidParser_GetReportItemTypeCountFromReportType(Parser, HID_REPORT_TYPE_OUTPUT, TRUE);
-    Capabilities->NumberFeatureDataIndices = HidParser_GetReportItemTypeCountFromReportType(Parser, HID_REPORT_TYPE_FEATURE, TRUE);
+    Capabilities->NumberInputDataIndices = HidParser_GetReportItemTypeCountFromReportType(Parser, CollectionNumber, HID_REPORT_TYPE_INPUT, TRUE);
+    Capabilities->NumberOutputDataIndices = HidParser_GetReportItemTypeCountFromReportType(Parser, CollectionNumber, HID_REPORT_TYPE_OUTPUT, TRUE);
+    Capabilities->NumberFeatureDataIndices = HidParser_GetReportItemTypeCountFromReportType(Parser, CollectionNumber, HID_REPORT_TYPE_FEATURE, TRUE);
 
     //
     // get value caps
     //
-    Capabilities->NumberInputValueCaps = HidParser_GetReportItemTypeCountFromReportType(Parser, HID_REPORT_TYPE_INPUT, FALSE);
-    Capabilities->NumberOutputValueCaps = HidParser_GetReportItemTypeCountFromReportType(Parser, HID_REPORT_TYPE_OUTPUT, FALSE);
-    Capabilities->NumberFeatureValueCaps = HidParser_GetReportItemTypeCountFromReportType(Parser, HID_REPORT_TYPE_FEATURE, FALSE);
+    Capabilities->NumberInputValueCaps = HidParser_GetReportItemTypeCountFromReportType(Parser, CollectionNumber, HID_REPORT_TYPE_INPUT, FALSE);
+    Capabilities->NumberOutputValueCaps = HidParser_GetReportItemTypeCountFromReportType(Parser, CollectionNumber, HID_REPORT_TYPE_OUTPUT, FALSE);
+    Capabilities->NumberFeatureValueCaps = HidParser_GetReportItemTypeCountFromReportType(Parser, CollectionNumber, HID_REPORT_TYPE_FEATURE, FALSE);
 
 
     //
     // get button caps
     //
-    Capabilities->NumberInputButtonCaps = HidParser_GetReportItemCountFromReportType(Parser, HID_REPORT_TYPE_INPUT);
-    Capabilities->NumberOutputButtonCaps = HidParser_GetReportItemCountFromReportType(Parser, HID_REPORT_TYPE_OUTPUT);
-    Capabilities->NumberFeatureButtonCaps = HidParser_GetReportItemCountFromReportType(Parser, HID_REPORT_TYPE_FEATURE);
+    Capabilities->NumberInputButtonCaps = HidParser_GetReportItemCountFromReportType(Parser, CollectionNumber, HID_REPORT_TYPE_INPUT);
+    Capabilities->NumberOutputButtonCaps = HidParser_GetReportItemCountFromReportType(Parser, CollectionNumber, HID_REPORT_TYPE_OUTPUT);
+    Capabilities->NumberFeatureButtonCaps = HidParser_GetReportItemCountFromReportType(Parser, CollectionNumber, HID_REPORT_TYPE_FEATURE);
 
     //
     // done
@@ -275,6 +272,14 @@
     IN HIDP_REPORT_TYPE  ReportType,
     IN USAGE  UsagePage  OPTIONAL)
 {
+    ULONG CollectionNumber;
+
+    //
+    // get collection number from context
+    //
+    CollectionNumber = HidParser_GetCollectionNumberFromParserContext(Parser);
+
+
     //
     // FIXME test what should be returned when usage page is not defined
     //
@@ -296,21 +301,21 @@
         //
         // input report
         //
-        return HidParser_GetMaxUsageListLengthWithReportAndPage(Parser, HID_REPORT_TYPE_INPUT, UsagePage);
+        return HidParser_GetMaxUsageListLengthWithReportAndPage(Parser, CollectionNumber, HID_REPORT_TYPE_INPUT, UsagePage);
     }
     else if (ReportType == HidP_Output)
     {
         //
         // input report
         //
-        return HidParser_GetMaxUsageListLengthWithReportAndPage(Parser, HID_REPORT_TYPE_OUTPUT, UsagePage);
+        return HidParser_GetMaxUsageListLengthWithReportAndPage(Parser, CollectionNumber, HID_REPORT_TYPE_OUTPUT, UsagePage);
     }
     else if (ReportType == HidP_Feature)
     {
         //
         // input report
         //
-        return HidParser_GetMaxUsageListLengthWithReportAndPage(Parser, HID_REPORT_TYPE_FEATURE, UsagePage);
+        return HidParser_GetMaxUsageListLengthWithReportAndPage(Parser, CollectionNumber, HID_REPORT_TYPE_FEATURE, UsagePage);
     }
     else
     {
@@ -348,6 +353,14 @@
     IN OUT PULONG  ValueCapsLength)
 {
     HIDPARSER_STATUS ParserStatus;
+    ULONG CollectionNumber;
+
+    //
+    // get collection number from context
+    //
+    CollectionNumber = HidParser_GetCollectionNumberFromParserContext(Parser);
+
+
 
     //
     // FIXME: implement searching in specific collection
@@ -359,21 +372,21 @@
         //
         // input report
         //
-        ParserStatus = HidParser_GetSpecificValueCapsWithReport(Parser, HID_REPORT_TYPE_INPUT, UsagePage, Usage, ValueCaps, ValueCapsLength);
+        ParserStatus = HidParser_GetSpecificValueCapsWithReport(Parser, CollectionNumber, HID_REPORT_TYPE_INPUT, UsagePage, Usage, ValueCaps, ValueCapsLength);
     }
     else if (ReportType == HidP_Output)
     {
         //
         // input report
         //
-        ParserStatus = HidParser_GetSpecificValueCapsWithReport(Parser, HID_REPORT_TYPE_OUTPUT, UsagePage, Usage, ValueCaps, ValueCapsLength);
+        ParserStatus = HidParser_GetSpecificValueCapsWithReport(Parser, CollectionNumber, HID_REPORT_TYPE_OUTPUT, UsagePage, Usage, ValueCaps, ValueCapsLength);
     }
     else if (ReportType == HidP_Feature)
     {
         //
         // input report
         //
-        ParserStatus = HidParser_GetSpecificValueCapsWithReport(Parser, HID_REPORT_TYPE_FEATURE, UsagePage, Usage, ValueCaps, ValueCapsLength);
+        ParserStatus = HidParser_GetSpecificValueCapsWithReport(Parser, CollectionNumber, HID_REPORT_TYPE_FEATURE, UsagePage, Usage, ValueCaps, ValueCapsLength);
     }
     else
     {
@@ -541,6 +554,12 @@
     IN ULONG  ReportLength)
 {
     HIDPARSER_STATUS ParserStatus;
+    ULONG CollectionNumber;
+
+    //
+    // get collection number from context
+    //
+    CollectionNumber = HidParser_GetCollectionNumberFromParserContext(Parser);
 
     //
     // FIXME: implement searching in specific collection
@@ -552,21 +571,21 @@
         //
         // input report
         //
-        ParserStatus = HidParser_GetUsagesWithReport(Parser, HID_REPORT_TYPE_INPUT, UsagePage, UsageList, UsageLength, Report, ReportLength);
+        ParserStatus = HidParser_GetUsagesWithReport(Parser, CollectionNumber, HID_REPORT_TYPE_INPUT, UsagePage, UsageList, UsageLength, Report, ReportLength);
     }
     else if (ReportType == HidP_Output)
     {
         //
         // input report
         //
-        ParserStatus = HidParser_GetUsagesWithReport(Parser, HID_REPORT_TYPE_OUTPUT, UsagePage, UsageList, UsageLength, Report, ReportLength);
+        ParserStatus = HidParser_GetUsagesWithReport(Parser, CollectionNumber, HID_REPORT_TYPE_OUTPUT, UsagePage, UsageList, UsageLength, Report, ReportLength);
     }
     else if (ReportType == HidP_Feature)
     {
         //
         // input report
         //
-        ParserStatus = HidParser_GetUsagesWithReport(Parser, HID_REPORT_TYPE_FEATURE, UsagePage, UsageList, UsageLength, Report, ReportLength);
+        ParserStatus = HidParser_GetUsagesWithReport(Parser, CollectionNumber, HID_REPORT_TYPE_FEATURE, UsagePage, UsageList, UsageLength, Report, ReportLength);
     }
     else
     {
@@ -604,6 +623,12 @@
     IN ULONG  ReportLength)
 {
     HIDPARSER_STATUS ParserStatus;
+    ULONG CollectionNumber;
+
+    //
+    // get collection number from context
+    //
+    CollectionNumber = HidParser_GetCollectionNumberFromParserContext(Parser);
 
     //
     // FIXME: implement searching in specific collection
@@ -615,21 +640,21 @@
         //
         // input report
         //
-        ParserStatus = HidParser_GetScaledUsageValueWithReport(Parser, HID_REPORT_TYPE_INPUT, UsagePage, Usage, UsageValue, Report, ReportLength);
+        ParserStatus = HidParser_GetScaledUsageValueWithReport(Parser, CollectionNumber, HID_REPORT_TYPE_INPUT, UsagePage, Usage, UsageValue, Report, ReportLength);
     }
     else if (ReportType == HidP_Output)
     {
         //
         // input report
         //
-        ParserStatus = HidParser_GetScaledUsageValueWithReport(Parser, HID_REPORT_TYPE_OUTPUT, UsagePage, Usage, UsageValue, Report, ReportLength);
+        ParserStatus = HidParser_GetScaledUsageValueWithReport(Parser, CollectionNumber, HID_REPORT_TYPE_OUTPUT, UsagePage, Usage, UsageValue, Report, ReportLength);
     }
     else if (ReportType == HidP_Feature)
     {
         //
         // input report
         //
-        ParserStatus = HidParser_GetScaledUsageValueWithReport(Parser, HID_REPORT_TYPE_FEATURE,  UsagePage, Usage, UsageValue, Report, ReportLength);
+        ParserStatus = HidParser_GetScaledUsageValueWithReport(Parser, CollectionNumber, HID_REPORT_TYPE_FEATURE,  UsagePage, Usage, UsageValue, Report, ReportLength);
     }
     else
     {
@@ -667,6 +692,12 @@
 {
     ULONG Index;
     HIDPARSER_STATUS Status = HIDPARSER_STATUS_SUCCESS;
+    ULONG CollectionNumber;
+
+    //
+    // get collection number from context
+    //
+    CollectionNumber = HidParser_GetCollectionNumberFromParserContext(Parser);
 
     for(Index = 0; Index < UsageListLength; Index++)
     {
@@ -678,7 +709,7 @@
             //
             // process usage
             //
-            Status = HidParser_TranslateUsage(Parser, ChangedUsageList[Index].Usage, KeyAction, ModifierState, InsertCodesProcedure, InsertCodesContext);
+            Status = HidParser_TranslateUsage(Parser, CollectionNumber, ChangedUsageList[Index].Usage, KeyAction, ModifierState, InsertCodesProcedure, InsertCodesContext);
         }
         else if (ChangedUsageList[Index].UsagePage == HID_USAGE_PAGE_CONSUMER)
         {
@@ -890,12 +921,12 @@
 NTSTATUS
 NTAPI
 HidParser_GetData(
-  IN HIDP_REPORT_TYPE  ReportType,
-  OUT PHIDP_DATA  DataList,
-  IN OUT PULONG  DataLength,
-  IN PHIDP_PREPARSED_DATA  PreparsedData,
-  IN PCHAR  Report,
-  IN ULONG  ReportLength)
+    IN PHID_PARSER Parser,
+    IN HIDP_REPORT_TYPE  ReportType,
+    OUT PHIDP_DATA  DataList,
+    IN OUT PULONG  DataLength,
+    IN PCHAR  Report,
+    IN ULONG  ReportLength)
 {
     UNIMPLEMENTED
     ASSERT(FALSE);
@@ -906,11 +937,11 @@
 NTSTATUS
 NTAPI
 HidParser_GetExtendedAttributes(
-  IN HIDP_REPORT_TYPE  ReportType,
-  IN USHORT  DataIndex,
-  IN PHIDP_PREPARSED_DATA  PreparsedData,
-  OUT PHIDP_EXTENDED_ATTRIBUTES  Attributes,
-  IN OUT PULONG  LengthAttributes)
+    IN PHID_PARSER Parser,
+    IN HIDP_REPORT_TYPE  ReportType,
+    IN USHORT  DataIndex,
+    OUT PHIDP_EXTENDED_ATTRIBUTES  Attributes,
+    IN OUT PULONG  LengthAttributes)
 {
     UNIMPLEMENTED
     ASSERT(FALSE);
@@ -921,9 +952,9 @@
 NTSTATUS
 NTAPI
 HidParser_GetLinkCollectionNodes(
+    IN PHID_PARSER Parser,
     OUT PHIDP_LINK_COLLECTION_NODE  LinkCollectionNodes,
-    IN OUT PULONG  LinkCollectionNodesLength,
-    IN PHIDP_PREPARSED_DATA  PreparsedData)
+    IN OUT PULONG  LinkCollectionNodesLength)
 {
     UNIMPLEMENTED
     ASSERT(FALSE);
@@ -934,27 +965,26 @@
 NTSTATUS
 NTAPI
 HidParser_GetUsageValue(
-  IN HIDP_REPORT_TYPE  ReportType,
-  IN USAGE  UsagePage,
-  IN USHORT  LinkCollection,
-  IN USAGE  Usage,
-  OUT PULONG  UsageValue,
-  IN PHIDP_PREPARSED_DATA  PreparsedData,
-  IN PCHAR  Report,
-  IN ULONG  ReportLength)
-{
-    UNIMPLEMENTED
-    ASSERT(FALSE);
-    return STATUS_NOT_IMPLEMENTED;
-}
-
-
-NTSTATUS
-NTAPI
-HidParser_SysPowerEvent (
+    IN PHID_PARSER Parser,
+    IN HIDP_REPORT_TYPE  ReportType,
+    IN USAGE  UsagePage,
+    IN USHORT  LinkCollection,
+    IN USAGE  Usage,
+    OUT PULONG  UsageValue,
+    IN PCHAR  Report,
+    IN ULONG  ReportLength)
+{
+    UNIMPLEMENTED
+    ASSERT(FALSE);
+    return STATUS_NOT_IMPLEMENTED;
+}
+
+NTSTATUS
+NTAPI
+HidParser_SysPowerEvent(
+    IN PHID_PARSER Parser,
     IN PCHAR HidPacket,
     IN USHORT HidPacketLength,
-    IN PHIDP_PREPARSED_DATA Ppd,
     OUT PULONG OutputBuffer)
 {
     UNIMPLEMENTED
@@ -965,7 +995,7 @@
 NTSTATUS
 NTAPI
 HidParser_SysPowerCaps (
-    IN PHIDP_PREPARSED_DATA Ppd,
+    IN PHID_PARSER Parser,
     OUT PULONG OutputBuffer)
 {
     UNIMPLEMENTED
@@ -977,15 +1007,15 @@
 NTSTATUS
 NTAPI
 HidParser_GetUsageValueArray(
-  IN HIDP_REPORT_TYPE  ReportType,
-  IN USAGE  UsagePage,
-  IN USHORT  LinkCollection  OPTIONAL,
-  IN USAGE  Usage,
-  OUT PCHAR  UsageValue,
-  IN USHORT  UsageValueByteLength,
-  IN PHIDP_PREPARSED_DATA  PreparsedData,
-  IN PCHAR  Report,
-  IN ULONG  ReportLength)
+    IN PHID_PARSER Parser,
+    IN HIDP_REPORT_TYPE  ReportType,
+    IN USAGE  UsagePage,
+    IN USHORT  LinkCollection  OPTIONAL,
+    IN USAGE  Usage,
+    OUT PCHAR  UsageValue,
+    IN USHORT  UsageValueByteLength,
+    IN PCHAR  Report,
+    IN ULONG  ReportLength)
 {
     UNIMPLEMENTED
     ASSERT(FALSE);
@@ -996,14 +1026,14 @@
 NTSTATUS
 NTAPI
 HidParser_UnsetUsages(
-  IN HIDP_REPORT_TYPE  ReportType,
-  IN USAGE  UsagePage,
-  IN USHORT  LinkCollection,
-  IN PUSAGE  UsageList,
-  IN OUT PULONG  UsageLength,
-  IN PHIDP_PREPARSED_DATA  PreparsedData,
-  IN OUT PCHAR  Report,
-  IN ULONG  ReportLength)
+    IN PHID_PARSER Parser,
+    IN HIDP_REPORT_TYPE  ReportType,
+    IN USAGE  UsagePage,
+    IN USHORT  LinkCollection,
+    IN PUSAGE  UsageList,
+    IN OUT PULONG  UsageLength,
+    IN OUT PCHAR  Report,
+    IN ULONG  ReportLength)
 {
     UNIMPLEMENTED
     ASSERT(FALSE);
@@ -1030,14 +1060,14 @@
 NTSTATUS
 NTAPI
 HidParser_SetUsages(
-  IN HIDP_REPORT_TYPE  ReportType,
-  IN USAGE  UsagePage,
-  IN USHORT  LinkCollection,
-  IN PUSAGE  UsageList,
-  IN OUT PULONG  UsageLength,
-  IN PHIDP_PREPARSED_DATA  PreparsedData,
-  IN OUT PCHAR  Report,
-  IN ULONG  ReportLength)
+    IN PHID_PARSER Parser,
+    IN HIDP_REPORT_TYPE  ReportType,
+    IN USAGE  UsagePage,
+    IN USHORT  LinkCollection,
+    IN PUSAGE  UsageList,
+    IN OUT PULONG  UsageLength,
+    IN OUT PCHAR  Report,
+    IN ULONG  ReportLength)
 {
     UNIMPLEMENTED
     ASSERT(FALSE);
@@ -1048,15 +1078,15 @@
 NTSTATUS
 NTAPI
 HidParser_SetUsageValueArray(
-  IN HIDP_REPORT_TYPE  ReportType,
-  IN USAGE  UsagePage,
-  IN USHORT  LinkCollection  OPTIONAL,
-  IN USAGE  Usage,
-  IN PCHAR  UsageValue,
-  IN USHORT  UsageValueByteLength,
-  IN PHIDP_PREPARSED_DATA  PreparsedData,
-  OUT PCHAR  Report,
-  IN ULONG  ReportLength)
+    IN PHID_PARSER Parser,
+    IN HIDP_REPORT_TYPE  ReportType,
+    IN USAGE  UsagePage,
+    IN USHORT  LinkCollection  OPTIONAL,
+    IN USAGE  Usage,
+    IN PCHAR  UsageValue,
+    IN USHORT  UsageValueByteLength,
+    OUT PCHAR  Report,
+    IN ULONG  ReportLength)
 {
     UNIMPLEMENTED
     ASSERT(FALSE);
@@ -1067,14 +1097,14 @@
 NTSTATUS
 NTAPI
 HidParser_SetUsageValue(
-  IN HIDP_REPORT_TYPE  ReportType,
-  IN USAGE  UsagePage,
-  IN USHORT  LinkCollection,
-  IN USAGE  Usage,
-  IN ULONG  UsageValue,
-  IN PHIDP_PREPARSED_DATA  PreparsedData,
-  IN OUT PCHAR  Report,
-  IN ULONG  ReportLength)
+    IN PHID_PARSER Parser,
+    IN HIDP_REPORT_TYPE  ReportType,
+    IN USAGE  UsagePage,
+    IN USHORT  LinkCollection,
+    IN USAGE  Usage,
+    IN ULONG  UsageValue,
+    IN OUT PCHAR  Report,
+    IN ULONG  ReportLength)
 {
     UNIMPLEMENTED
     ASSERT(FALSE);
@@ -1085,14 +1115,14 @@
 NTSTATUS
 NTAPI
 HidParser_SetScaledUsageValue(
-  IN HIDP_REPORT_TYPE  ReportType,
-  IN USAGE  UsagePage,
-  IN USHORT  LinkCollection  OPTIONAL,
-  IN USAGE  Usage,
-  IN LONG  UsageValue,
-  IN PHIDP_PREPARSED_DATA  PreparsedData,
-  IN OUT PCHAR  Report,
-  IN ULONG  ReportLength)
+    IN PHID_PARSER Parser,
+    IN HIDP_REPORT_TYPE  ReportType,
+    IN USAGE  UsagePage,
+    IN USHORT  LinkCollection  OPTIONAL,
+    IN USAGE  Usage,
+    IN LONG  UsageValue,
+    IN OUT PCHAR  Report,
+    IN ULONG  ReportLength)
 {
     UNIMPLEMENTED
     ASSERT(FALSE);
@@ -1103,12 +1133,12 @@
 NTSTATUS
 NTAPI
 HidParser_SetData(
-  IN HIDP_REPORT_TYPE  ReportType,
-  IN PHIDP_DATA  DataList,
-  IN OUT PULONG  DataLength,
-  IN PHIDP_PREPARSED_DATA  PreparsedData,
-  IN OUT PCHAR  Report,
-  IN ULONG  ReportLength)
+    IN PHID_PARSER Parser,
+    IN HIDP_REPORT_TYPE  ReportType,
+    IN PHIDP_DATA  DataList,
+    IN OUT PULONG  DataLength,
+    IN OUT PCHAR  Report,
+    IN ULONG  ReportLength)
 {
     UNIMPLEMENTED
     ASSERT(FALSE);
@@ -1119,8 +1149,8 @@
 ULONG
 NTAPI
 HidParser_MaxDataListLength(
-  IN HIDP_REPORT_TYPE  ReportType,
-  IN PHIDP_PREPARSED_DATA  PreparsedData)
+    IN PHID_PARSER Parser,
+    IN HIDP_REPORT_TYPE  ReportType)
 {
     UNIMPLEMENTED
     ASSERT(FALSE);
@@ -1131,11 +1161,11 @@
 NTSTATUS
 NTAPI
 HidParser_InitializeReportForID(
-  IN HIDP_REPORT_TYPE  ReportType,
-  IN UCHAR  ReportID,
-  IN PHIDP_PREPARSED_DATA  PreparsedData,
-  IN OUT PCHAR  Report,
-  IN ULONG  ReportLength)
+    IN PHID_PARSER Parser,
+    IN HIDP_REPORT_TYPE  ReportType,
+    IN UCHAR  ReportID,
+    IN OUT PCHAR  Report,
+    IN ULONG  ReportLength)
 {
     UNIMPLEMENTED
     ASSERT(FALSE);
@@ -1148,12 +1178,12 @@
 NTSTATUS
 NTAPI
 HidParser_GetValueCaps(
-  HIDP_REPORT_TYPE ReportType,
-  PHIDP_VALUE_CAPS ValueCaps,
-  PULONG ValueCapsLength,
-  PHIDP_PREPARSED_DATA PreparsedData)
-{
-    UNIMPLEMENTED
-    ASSERT(FALSE);
-    return STATUS_NOT_IMPLEMENTED;
-}
+    IN PHID_PARSER Parser,
+    HIDP_REPORT_TYPE ReportType,
+    PHIDP_VALUE_CAPS ValueCaps,
+    PULONG ValueCapsLength)
+{
+    UNIMPLEMENTED
+    ASSERT(FALSE);
+    return STATUS_NOT_IMPLEMENTED;
+}

Modified: branches/usb-bringup-trunk/lib/drivers/hidparser/hidparser.h
URL: http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/lib/drivers/hidparser/hidparser.h?rev=55332&r1=55331&r2=55332&view=diff
==============================================================================
--- branches/usb-bringup-trunk/lib/drivers/hidparser/hidparser.h [iso-8859-1] (original)
+++ branches/usb-bringup-trunk/lib/drivers/hidparser/hidparser.h [iso-8859-1] Mon Jan 30 19:29:26 2012
@@ -119,7 +119,7 @@
 NTAPI
 HidParser_FreeCollectionDescription(
     IN PHID_PARSER Parser,
-    IN PHIDP_DEVICE_DESC   DeviceDescription);
+    IN PHIDP_DEVICE_DESC DeviceDescription);
 
 HIDAPI
 NTSTATUS
@@ -180,53 +180,53 @@
 NTSTATUS
 NTAPI
 HidParser_GetData(
-  IN HIDP_REPORT_TYPE  ReportType,
-  OUT PHIDP_DATA  DataList,
-  IN OUT PULONG  DataLength,
-  IN PHIDP_PREPARSED_DATA  PreparsedData,
-  IN PCHAR  Report,
-  IN ULONG  ReportLength);
+    IN PHID_PARSER Parser,
+    IN HIDP_REPORT_TYPE  ReportType,
+    OUT PHIDP_DATA  DataList,
+    IN OUT PULONG  DataLength,
+    IN PCHAR  Report,
+    IN ULONG  ReportLength);
 
 HIDAPI
 NTSTATUS
 NTAPI
 HidParser_GetExtendedAttributes(
-  IN HIDP_REPORT_TYPE  ReportType,
-  IN USHORT  DataIndex,
-  IN PHIDP_PREPARSED_DATA  PreparsedData,
-  OUT PHIDP_EXTENDED_ATTRIBUTES  Attributes,
-  IN OUT PULONG  LengthAttributes);
+    IN PHID_PARSER Parser,
+    IN HIDP_REPORT_TYPE  ReportType,
+    IN USHORT  DataIndex,
+    OUT PHIDP_EXTENDED_ATTRIBUTES  Attributes,
+    IN OUT PULONG  LengthAttributes);
 
 HIDAPI
 NTSTATUS
 NTAPI
 HidParser_GetLinkCollectionNodes(
+    IN PHID_PARSER Parser,
     OUT PHIDP_LINK_COLLECTION_NODE  LinkCollectionNodes,
-    IN OUT PULONG  LinkCollectionNodesLength,
-    IN PHIDP_PREPARSED_DATA  PreparsedData);
+    IN OUT PULONG  LinkCollectionNodesLength);
 
 HIDAPI
 NTSTATUS
 NTAPI
 HidParser_GetUsageValue(
-  IN HIDP_REPORT_TYPE  ReportType,
-  IN USAGE  UsagePage,
-  IN USHORT  LinkCollection,
-  IN USAGE  Usage,
-  OUT PULONG  UsageValue,
-  IN PHIDP_PREPARSED_DATA  PreparsedData,
-  IN PCHAR  Report,
-  IN ULONG  ReportLength);
+    IN PHID_PARSER Parser,
+    IN HIDP_REPORT_TYPE  ReportType,
+    IN USAGE  UsagePage,
+    IN USHORT  LinkCollection,
+    IN USAGE  Usage,
+    OUT PULONG  UsageValue,
+    IN PCHAR  Report,
+    IN ULONG  ReportLength);
 
 HIDAPI
 NTSTATUS
 NTAPI
 HidParser_UsageListDifference(
-  IN PUSAGE  PreviousUsageList,
-  IN PUSAGE  CurrentUsageList,
-  OUT PUSAGE  BreakUsageList,
-  OUT PUSAGE  MakeUsageList,
-  IN ULONG  UsageListLength);
+    IN PUSAGE  PreviousUsageList,
+    IN PUSAGE  CurrentUsageList,
+    OUT PUSAGE  BreakUsageList,
+    OUT PUSAGE  MakeUsageList,
+    IN ULONG  UsageListLength);
 
 
 HIDAPI
@@ -266,30 +266,30 @@
 NTSTATUS
 NTAPI
 HidParser_SysPowerEvent (
+    IN PHID_PARSER Parser,
     IN PCHAR HidPacket,
     IN USHORT HidPacketLength,
-    IN PHIDP_PREPARSED_DATA Ppd,
     OUT PULONG OutputBuffer);
 
 NTSTATUS
 NTAPI
 HidParser_SysPowerCaps (
-    IN PHIDP_PREPARSED_DATA Ppd,
+    IN PHID_PARSER Parser,
     OUT PULONG OutputBuffer);
 
 HIDAPI
 NTSTATUS
 NTAPI
 HidParser_GetUsageValueArray(
-  IN HIDP_REPORT_TYPE  ReportType,
-  IN USAGE  UsagePage,
-  IN USHORT  LinkCollection  OPTIONAL,
-  IN USAGE  Usage,
-  OUT PCHAR  UsageValue,
-  IN USHORT  UsageValueByteLength,
-  IN PHIDP_PREPARSED_DATA  PreparsedData,
-  IN PCHAR  Report,
-  IN ULONG  ReportLength);
+    IN PHID_PARSER Parser,
+    IN HIDP_REPORT_TYPE  ReportType,
+    IN USAGE  UsagePage,
+    IN USHORT  LinkCollection  OPTIONAL,
+    IN USAGE  Usage,
+    OUT PCHAR  UsageValue,
+    IN USHORT  UsageValueByteLength,
+    IN PCHAR  Report,
+    IN ULONG  ReportLength);
 
 
 HIDAPI
@@ -306,14 +306,14 @@
 NTSTATUS
 NTAPI
 HidParser_UnsetUsages(
-  IN HIDP_REPORT_TYPE  ReportType,
-  IN USAGE  UsagePage,
-  IN USHORT  LinkCollection,
-  IN PUSAGE  UsageList,
-  IN OUT PULONG  UsageLength,
-  IN PHIDP_PREPARSED_DATA  PreparsedData,
-  IN OUT PCHAR  Report,
-  IN ULONG  ReportLength);
+    IN PHID_PARSER Parser,
+    IN HIDP_REPORT_TYPE  ReportType,
+    IN USAGE  UsagePage,
+    IN USHORT  LinkCollection,
+    IN PUSAGE  UsageList,
+    IN OUT PULONG  UsageLength,
+    IN OUT PCHAR  Report,
+    IN ULONG  ReportLength);
 
 HIDAPI
 NTSTATUS
@@ -342,87 +342,87 @@
 NTSTATUS
 NTAPI
 HidParser_SetUsages(
-  IN HIDP_REPORT_TYPE  ReportType,
-  IN USAGE  UsagePage,
-  IN USHORT  LinkCollection,
-  IN PUSAGE  UsageList,
-  IN OUT PULONG  UsageLength,
-  IN PHIDP_PREPARSED_DATA  PreparsedData,
-  IN OUT PCHAR  Report,
-  IN ULONG  ReportLength);
+    IN PHID_PARSER Parser,
+    IN HIDP_REPORT_TYPE  ReportType,
+    IN USAGE  UsagePage,
+    IN USHORT  LinkCollection,
+    IN PUSAGE  UsageList,
+    IN OUT PULONG  UsageLength,
+    IN OUT PCHAR  Report,
+    IN ULONG  ReportLength);
 
 HIDAPI
 NTSTATUS
 NTAPI
 HidParser_SetUsageValueArray(
-  IN HIDP_REPORT_TYPE  ReportType,
-  IN USAGE  UsagePage,
-  IN USHORT  LinkCollection  OPTIONAL,
-  IN USAGE  Usage,
-  IN PCHAR  UsageValue,
-  IN USHORT  UsageValueByteLength,
-  IN PHIDP_PREPARSED_DATA  PreparsedData,
-  OUT PCHAR  Report,
-  IN ULONG  ReportLength);
+    IN PHID_PARSER Parser,
+    IN HIDP_REPORT_TYPE  ReportType,
+    IN USAGE  UsagePage,
+    IN USHORT  LinkCollection  OPTIONAL,
+    IN USAGE  Usage,
+    IN PCHAR  UsageValue,
+    IN USHORT  UsageValueByteLength,
+    OUT PCHAR  Report,
+    IN ULONG  ReportLength);
 
 HIDAPI
 NTSTATUS
 NTAPI
 HidParser_SetUsageValue(
-  IN HIDP_REPORT_TYPE  ReportType,
-  IN USAGE  UsagePage,
-  IN USHORT  LinkCollection,
-  IN USAGE  Usage,
-  IN ULONG  UsageValue,
-  IN PHIDP_PREPARSED_DATA  PreparsedData,
-  IN OUT PCHAR  Report,
-  IN ULONG  ReportLength);
+    IN PHID_PARSER Parser,
+    IN HIDP_REPORT_TYPE  ReportType,
+    IN USAGE  UsagePage,
+    IN USHORT  LinkCollection,
+    IN USAGE  Usage,
+    IN ULONG  UsageValue,
+    IN OUT PCHAR  Report,
+    IN ULONG  ReportLength);
 
 HIDAPI
 NTSTATUS
 NTAPI
 HidParser_SetScaledUsageValue(
-  IN HIDP_REPORT_TYPE  ReportType,
-  IN USAGE  UsagePage,
-  IN USHORT  LinkCollection  OPTIONAL,
-  IN USAGE  Usage,
-  IN LONG  UsageValue,
-  IN PHIDP_PREPARSED_DATA  PreparsedData,
-  IN OUT PCHAR  Report,
-  IN ULONG  ReportLength);
+    IN PHID_PARSER Parser,
+    IN HIDP_REPORT_TYPE  ReportType,
+    IN USAGE  UsagePage,
+    IN USHORT  LinkCollection  OPTIONAL,
+    IN USAGE  Usage,
+    IN LONG  UsageValue,
+    IN OUT PCHAR  Report,
+    IN ULONG  ReportLength);
 
 HIDAPI
 NTSTATUS
 NTAPI
 HidParser_SetData(
-  IN HIDP_REPORT_TYPE  ReportType,
-  IN PHIDP_DATA  DataList,
-  IN OUT PULONG  DataLength,
-  IN PHIDP_PREPARSED_DATA  PreparsedData,
-  IN OUT PCHAR  Report,
-  IN ULONG  ReportLength);
+    IN PHID_PARSER Parser,
+    IN HIDP_REPORT_TYPE  ReportType,
+    IN PHIDP_DATA  DataList,
+    IN OUT PULONG  DataLength,
+    IN OUT PCHAR  Report,
+    IN ULONG  ReportLength);
 
 HIDAPI
 ULONG
 NTAPI
 HidParser_MaxDataListLength(
-  IN HIDP_REPORT_TYPE  ReportType,
-  IN PHIDP_PREPARSED_DATA  PreparsedData);
+    IN PHID_PARSER Parser,
+    IN HIDP_REPORT_TYPE  ReportType);
 
 HIDAPI
 NTSTATUS
 NTAPI
 HidParser_InitializeReportForID(
-  IN HIDP_REPORT_TYPE  ReportType,
-  IN UCHAR  ReportID,
-  IN PHIDP_PREPARSED_DATA  PreparsedData,
-  IN OUT PCHAR  Report,
-  IN ULONG  ReportLength);
-
+    IN PHID_PARSER Parser,
+    IN HIDP_REPORT_TYPE  ReportType,
+    IN UCHAR  ReportID,
+    IN OUT PCHAR  Report,
+    IN ULONG  ReportLength);
 
 HIDPARSER_STATUS
 HidParser_TranslateUsage(
     IN PHID_PARSER Parser,
+    IN ULONG CollectionNumber,
     IN USAGE Usage,
     IN HIDP_KEYBOARD_DIRECTION  KeyAction,
     IN OUT PHIDP_KEYBOARD_MODIFIER_STATE  ModifierState,
@@ -433,7 +433,7 @@
 NTSTATUS
 NTAPI
 HidParser_GetValueCaps(
-  HIDP_REPORT_TYPE ReportType,
-  PHIDP_VALUE_CAPS ValueCaps,
-  PULONG ValueCapsLength,
-  PHIDP_PREPARSED_DATA PreparsedData);
+    PHID_PARSER Parser,
+    HIDP_REPORT_TYPE ReportType,
+    PHIDP_VALUE_CAPS ValueCaps,
+    PULONG ValueCapsLength);

Modified: branches/usb-bringup-trunk/lib/drivers/hidparser/parser.c
URL: http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/lib/drivers/hidparser/parser.c?rev=55332&r1=55331&r2=55332&view=diff
==============================================================================
--- branches/usb-bringup-trunk/lib/drivers/hidparser/parser.c [iso-8859-1] (original)
+++ branches/usb-bringup-trunk/lib/drivers/hidparser/parser.c [iso-8859-1] Mon Jan 30 19:29:26 2012
@@ -136,26 +136,6 @@
     //
     ParserContext = (PHID_PARSER_CONTEXT)Parser->ParserContext;
 
-
-    //
-    // delete all reports
-    //
-    for(Index = 0; Index < ParserContext->ReportCount; Index++)
-    {
-        //
-        // delete report
-        //
-        HidParser_DeleteReport(Parser, ParserContext->Reports[Index]);
-    }
-
-    if (ParserContext->ReportCount && ParserContext->Reports)
-    {
-        //
-        // free report array
-        //
-       Parser->Free(ParserContext->Reports);
-    }
-
     if (ParserContext->RootCollection)
     {
         //
@@ -167,8 +147,6 @@
     //
     // reinit parser
     //
-    ParserContext->ReportCount = 0;
-    ParserContext->Reports = NULL;
     ParserContext->RootCollection = NULL;
     ParserContext->UseReportIDs = FALSE;
 
@@ -235,6 +213,49 @@
     //
     return HIDPARSER_STATUS_SUCCESS;
 }
+
+HIDPARSER_STATUS
+HidParser_FindReportInCollection(
+    IN PHID_COLLECTION Collection,
+    IN UCHAR ReportType,
+    IN UCHAR ReportID,
+    OUT PHID_REPORT *OutReport)
+{
+    ULONG Index;
+    HIDPARSER_STATUS Status;
+
+    //
+    // search in local list
+    //
+    for(Index = 0; Index < Collection->ReportCount; Index++)
+    {
+        if (Collection->Reports[Index]->Type == ReportType && Collection->Reports[Index]->ReportID == ReportID)
+        {
+            //
+            // found report
+            //
+            *OutReport = Collection->Reports[Index];
+            return HIDPARSER_STATUS_SUCCESS;
+        }
+    }
+
+    //
+    // search in sub collections
+    //
+    for(Index = 0; Index < Collection->NodeCount; Index++)
+    {
+        Status = HidParser_FindReportInCollection(Collection->Nodes[Index], ReportType, ReportID, OutReport);
+        if (Status == HIDPARSER_STATUS_SUCCESS)
+            return Status;
+    }
+
+    //
+    // no such report found
+    //
+    *OutReport = NULL;
+    return HIDPARSER_STATUS_REPORT_NOT_FOUND;
+}
+
 
 HIDPARSER_STATUS
 HidParser_FindReport(
@@ -244,7 +265,6 @@
     OUT PHID_REPORT *OutReport)
 {
     PHID_PARSER_CONTEXT ParserContext;
-    ULONG Index;
 
     //
     // get parser context
@@ -252,23 +272,10 @@
     ParserContext = (PHID_PARSER_CONTEXT)Parser->ParserContext;
     ASSERT(ParserContext);
 
-    for(Index = 0; Index < ParserContext->ReportCount; Index++)
-    {
-        if (ParserContext->Reports[Index]->Type == ReportType && ParserContext->Reports[Index]->ReportID == ReportID)
-        {
-            //
-            // found report
-            //
-            *OutReport = ParserContext->Reports[Index];
-            return HIDPARSER_STATUS_SUCCESS;
-        }
-    }
-
-    //
-    // no such report found
-    //
-    *OutReport = NULL;
-    return HIDPARSER_STATUS_REPORT_NOT_FOUND;
+    //
+    // search in current top level collection
+    //
+    return HidParser_FindReportInCollection(ParserContext->RootCollection->Nodes[ParserContext->RootCollection->NodeCount-1], ReportType, ReportID, OutReport);
 }
 
 HIDPARSER_STATUS
@@ -306,8 +313,9 @@
 }
 
 HIDPARSER_STATUS
-HidParser_AddReport(
+HidParser_AddReportToCollection(
     IN PHID_PARSER Parser,
+    IN PHID_COLLECTION CurrentCollection,
     IN PHID_REPORT NewReport)
 {
     PHID_REPORT * NewReportArray;
@@ -322,7 +330,7 @@
     //
     // allocate new report array
     //
-    NewReportArray = (PHID_REPORT*)Parser->Alloc(sizeof(PHID_REPORT) * (ParserContext->ReportCount + 1));
+    NewReportArray = (PHID_REPORT*)Parser->Alloc(sizeof(PHID_REPORT) * (CurrentCollection->ReportCount + 1));
     if (!NewReportArray)
     {
         //
@@ -331,25 +339,25 @@
         return HIDPARSER_STATUS_INSUFFICIENT_RESOURCES;
     }
 
-    if (ParserContext->ReportCount)
+    if (CurrentCollection->ReportCount)
     {
         //
         // copy old array contents
         //
-        Parser->Copy(NewReportArray, ParserContext->Reports, sizeof(PHID_REPORT) * ParserContext->ReportCount);
+        Parser->Copy(NewReportArray, CurrentCollection->Reports, sizeof(PHID_REPORT) * CurrentCollection->ReportCount);
 
         //
         // free old array
         //
-        Parser->Free(ParserContext->Reports);
+        Parser->Free(CurrentCollection->Reports);
     }
 
     //
     // store result
     //
-    NewReportArray[ParserContext->ReportCount] = NewReport;
-    ParserContext->Reports = NewReportArray;
-    ParserContext->ReportCount++;
+    NewReportArray[CurrentCollection->ReportCount] = NewReport;
+    CurrentCollection->Reports = NewReportArray;
+    CurrentCollection->ReportCount++;
 
     //
     // completed successfully
@@ -360,6 +368,7 @@
 HIDPARSER_STATUS
 HidParser_GetReport(
     IN PHID_PARSER Parser,
+    IN PHID_COLLECTION Collection,
     IN UCHAR ReportType,
     IN UCHAR ReportID,
     IN UCHAR CreateIfNotExists,
@@ -394,7 +403,7 @@
     //
     // add report
     //
-    Status = HidParser_AddReport(Parser, *OutReport);
+    Status = HidParser_AddReportToCollection(Parser, Collection, *OutReport);
     if (Status != HIDPARSER_STATUS_SUCCESS)
     {
         //
@@ -925,7 +934,7 @@
             }
 
         }
-
+        Parser->Debug("Tag %x Type %x Size %x Offset %lu Length %lu\n", CurrentItem->Tag, CurrentItem->Type, CurrentItem->Size,  ((ULONG_PTR)CurrentItem - (ULONG_PTR)ReportDescriptor), ReportLength);
         //
         // handle items
         //
@@ -1019,7 +1028,7 @@
                             break;
 
                         default:
-                            Parser->Debug("[HIDPARSE] Unknown ReportType %x\n", CurrentItem->Tag);
+                            Parser->Debug("[HIDPARSE] Unknown ReportType Tag %x Type %x Size %x CurrentItemSize %x\n", CurrentItem->Tag, CurrentItem->Type, CurrentItem->Size, CurrentItemSize);
                             ASSERT(FALSE);
                             break;
                     }
@@ -1030,7 +1039,7 @@
                     //
                     // get report
                     //
-                    Status = HidParser_GetReport(Parser, ReportType, ParserContext->GlobalItemState.ReportId, TRUE, &Report);
+                    Status = HidParser_GetReport(Parser, CurrentCollection, ReportType, ParserContext->GlobalItemState.ReportId, TRUE, &Report);
                     ASSERT(Status == HIDPARSER_STATUS_SUCCESS);
 
                     // fill in a sensible default if the index isn't set
@@ -1246,7 +1255,7 @@
                         break;
 
                     case ITEM_TAG_LOCAL_USAGE_MAXIMUM:
-                        Parser->Debug("[HIDPARSE] ITEM_TAG_LOCAL_USAGE_MAXIMUM Data %x\n", Data);
+                        Parser->Debug("[HIDPARSE] ITEM_TAG_LOCAL_USAGE_MAXIMUM Data %x ItemSize %x %x\n", Data, CurrentItemSize, CurrentItem->Size);
                         ParserContext->LocalItemState.UsageMaximum.u.Extended = Data;
                         ParserContext->LocalItemState.UsageMaximum.IsExtended
                             = CurrentItemSize == sizeof(ULONG);
@@ -1344,4 +1353,3 @@
     //
     return HIDPARSER_STATUS_SUCCESS;
 }
-

Modified: branches/usb-bringup-trunk/lib/drivers/hidparser/parser.h
URL: http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/lib/drivers/hidparser/parser.h?rev=55332&r1=55331&r2=55332&view=diff
==============================================================================
--- branches/usb-bringup-trunk/lib/drivers/hidparser/parser.h [iso-8859-1] (original)
+++ branches/usb-bringup-trunk/lib/drivers/hidparser/parser.h [iso-8859-1] Mon Jan 30 19:29:26 2012
@@ -195,7 +195,7 @@
     UCHAR Valid;
 }HID_REPORT_ITEM, *PHID_REPORT_ITEM;
 
-struct HID_REPORT;
+struct _HID_REPORT;
 
 typedef struct __HID_COLLECTION__
 {
@@ -210,14 +210,15 @@
 
     ULONG ItemCount;
     ULONG ItemCountAllocated;
+
     PHID_REPORT_ITEM * Items;
 
-    //ULONG ReportCount;
-    //struct HID_REPORT ** Reports; 
+    ULONG ReportCount;
+    struct _HID_REPORT ** Reports; 
 
 }HID_COLLECTION, *PHID_COLLECTION;
 
-typedef struct
+typedef struct _HID_REPORT
 {
     UCHAR Type;
     UCHAR ReportID;
@@ -225,11 +226,8 @@
 
     ULONG ItemCount;
     ULONG ItemAllocated;
-    PHID_REPORT_ITEM *Items;
-
-    ULONG ReportStatus;
-    UCHAR * CurrentReport;
-    ULONG BusyCount;
+    PHID_REPORT_ITEM* Items;
+
 }HID_REPORT, *PHID_REPORT;
 
 typedef struct
@@ -250,19 +248,14 @@
     PHID_COLLECTION RootCollection;
 
     //
-    // report count
-    //
-    ULONG ReportCount;
-
-    //
-    // reports
-    //
-    PHID_REPORT * Reports;
-
-    //
     // uses report ids
     //
     UCHAR UseReportIDs;
+
+    //
+    // collection index
+    //
+    ULONG CollectionIndex;
 
 }HID_PARSER_CONTEXT, *PHID_PARSER_CONTEXT;
 
@@ -280,11 +273,6 @@
 #define HID_REPORT_TYPE_OUTPUT		0x02
 #define HID_REPORT_TYPE_FEATURE		0x04
 
-ULONG
-HidParser_NumberOfReports(
-    IN PHID_PARSER Parser,
-    IN ULONG ReportType);
-
 HIDPARSER_STATUS
 HidParser_GetCollectionUsagePage(
     IN PHID_PARSER Parser,
@@ -295,6 +283,7 @@
 ULONG
 HidParser_GetReportLength(
     IN PHID_PARSER Parser,
+    IN ULONG CollectionIndex,
     IN ULONG ReportType);
 
 UCHAR
@@ -304,17 +293,20 @@
 ULONG
 HidParser_GetReportItemCountFromReportType(
     IN PHID_PARSER Parser,
+    IN ULONG CollectionNumber,
     IN ULONG ReportType);
 
 ULONG
 HidParser_GetReportItemTypeCountFromReportType(
     IN PHID_PARSER Parser,
+    IN ULONG CollectionNumber,
     IN ULONG ReportType,
     IN ULONG bData);
 
 ULONG
 HidParser_GetContextSize(
-    IN PHID_PARSER Parser);
+    IN PHID_PARSER Parser,
+    IN ULONG CollectionNumber);
 
 VOID
 HidParser_FreeContext(
@@ -329,12 +321,14 @@
 ULONG
 HidParser_GetMaxUsageListLengthWithReportAndPage(
     IN PHID_PARSER Parser,
+    IN ULONG CollectionNumber,
     IN ULONG  ReportType,
     IN USAGE  UsagePage  OPTIONAL);
 
 HIDPARSER_STATUS
 HidParser_GetSpecificValueCapsWithReport(
     IN PHID_PARSER Parser,
+    IN ULONG CollectionNumber,
     IN ULONG ReportType,
     IN USHORT UsagePage,
     IN USHORT Usage,
@@ -345,6 +339,7 @@
 HIDPARSER_STATUS
 HidParser_GetUsagesWithReport(
     IN PHID_PARSER Parser,
+    IN ULONG CollectionNumber,
     IN ULONG  ReportType,
     IN USAGE  UsagePage,
     OUT USAGE  *UsageList,
@@ -355,9 +350,15 @@
 HIDPARSER_STATUS
 HidParser_GetScaledUsageValueWithReport(
     IN PHID_PARSER Parser,
+    IN ULONG CollectionNumber,
     IN ULONG ReportType,
     IN USAGE UsagePage,
     IN USAGE  Usage,
     OUT PLONG UsageValue,
     IN PCHAR ReportDescriptor,
     IN ULONG ReportDescriptorLength);
+
+ULONG
+HidParser_GetCollectionNumberFromParserContext(
+    IN PHID_PARSER Parser);
+




More information about the Ros-diffs mailing list