mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
[HIDPARSER] Remove HID_PARSER class, and directly use functions
This commit is contained in:
parent
9df05ba4b6
commit
c151f8a1c7
7 changed files with 118 additions and 338 deletions
|
@ -206,23 +206,6 @@ HidParser_GetReportItemTypeCountFromReportType(
|
|||
return ItemCount;
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
HidParser_InitParser(
|
||||
IN PHIDPARSER_ALLOC_FUNCTION AllocFunction,
|
||||
IN PHIDPARSER_FREE_FUNCTION FreeFunction,
|
||||
IN PHIDPARSER_ZERO_FUNCTION ZeroFunction,
|
||||
IN PHIDPARSER_COPY_FUNCTION CopyFunction,
|
||||
IN PHIDPARSER_DEBUG_FUNCTION DebugFunction,
|
||||
OUT PHID_PARSER Parser)
|
||||
{
|
||||
Parser->Alloc = AllocFunction;
|
||||
Parser->Free = FreeFunction;
|
||||
Parser->Zero = ZeroFunction;
|
||||
Parser->Copy = CopyFunction;
|
||||
Parser->Debug = DebugFunction;
|
||||
}
|
||||
|
||||
ULONG
|
||||
HidParser_GetMaxUsageListLengthWithReportAndPage(
|
||||
IN PVOID CollectionContext,
|
||||
|
@ -269,7 +252,6 @@ HidParser_GetMaxUsageListLengthWithReportAndPage(
|
|||
|
||||
HIDPARSER_STATUS
|
||||
HidParser_GetSpecificValueCapsWithReport(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID CollectionContext,
|
||||
IN UCHAR ReportType,
|
||||
IN USHORT UsagePage,
|
||||
|
@ -313,7 +295,7 @@ HidParser_GetSpecificValueCapsWithReport(
|
|||
//
|
||||
// zero caps
|
||||
//
|
||||
Parser->Zero(&ValueCaps[ItemCount], sizeof(HIDP_VALUE_CAPS));
|
||||
ZeroFunction(&ValueCaps[ItemCount], sizeof(HIDP_VALUE_CAPS));
|
||||
|
||||
//
|
||||
// init caps
|
||||
|
@ -359,7 +341,6 @@ HidParser_GetSpecificValueCapsWithReport(
|
|||
|
||||
HIDPARSER_STATUS
|
||||
HidParser_GetUsagesWithReport(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID CollectionContext,
|
||||
IN UCHAR ReportType,
|
||||
IN USAGE UsagePage,
|
||||
|
@ -517,14 +498,14 @@ HidParser_GetUsagesWithReport(
|
|||
//
|
||||
// success, clear rest of array
|
||||
//
|
||||
Parser->Zero(&UsageAndPage[ItemCount], (*UsageLength - ItemCount) * sizeof(USAGE_AND_PAGE));
|
||||
ZeroFunction(&UsageAndPage[ItemCount], (*UsageLength - ItemCount) * sizeof(USAGE_AND_PAGE));
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// success, clear rest of array
|
||||
//
|
||||
Parser->Zero(&UsageList[ItemCount], (*UsageLength - ItemCount) * sizeof(USAGE));
|
||||
ZeroFunction(&UsageList[ItemCount], (*UsageLength - ItemCount) * sizeof(USAGE));
|
||||
}
|
||||
|
||||
|
||||
|
@ -567,7 +548,6 @@ HidParser_UsesReportId(
|
|||
|
||||
HIDPARSER_STATUS
|
||||
HidParser_GetUsageValueWithReport(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID CollectionContext,
|
||||
IN UCHAR ReportType,
|
||||
IN USAGE UsagePage,
|
||||
|
@ -635,7 +615,7 @@ HidParser_GetUsageValueWithReport(
|
|||
// 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)));
|
||||
CopyFunction(&Data, &ReportDescriptor[ReportItem->ByteOffset + 1], min(sizeof(ULONG), ReportDescriptorLength - (ReportItem->ByteOffset + 1)));
|
||||
|
||||
//
|
||||
// shift data
|
||||
|
@ -664,7 +644,6 @@ HidParser_GetUsageValueWithReport(
|
|||
|
||||
HIDPARSER_STATUS
|
||||
HidParser_GetScaledUsageValueWithReport(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID CollectionContext,
|
||||
IN UCHAR ReportType,
|
||||
IN USAGE UsagePage,
|
||||
|
@ -732,7 +711,7 @@ HidParser_GetScaledUsageValueWithReport(
|
|||
// 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)));
|
||||
CopyFunction(&Data, &ReportDescriptor[ReportItem->ByteOffset + 1], min(sizeof(ULONG), ReportDescriptorLength - (ReportItem->ByteOffset + 1)));
|
||||
|
||||
//
|
||||
// shift data
|
||||
|
@ -870,7 +849,6 @@ HidParser_DispatchKey(
|
|||
|
||||
HIDPARSER_STATUS
|
||||
HidParser_TranslateKbdUsage(
|
||||
IN PHID_PARSER Parser,
|
||||
IN USAGE Usage,
|
||||
IN HIDP_KEYBOARD_DIRECTION KeyAction,
|
||||
IN OUT PHIDP_KEYBOARD_MODIFIER_STATE ModifierState,
|
||||
|
@ -933,7 +911,6 @@ HidParser_TranslateKbdUsage(
|
|||
|
||||
HIDPARSER_STATUS
|
||||
HidParser_TranslateCustUsage(
|
||||
IN PHID_PARSER Parser,
|
||||
IN USAGE Usage,
|
||||
IN HIDP_KEYBOARD_DIRECTION KeyAction,
|
||||
IN OUT PHIDP_KEYBOARD_MODIFIER_STATE ModifierState,
|
||||
|
|
|
@ -81,7 +81,6 @@ HidParser_CalculateContextSize(
|
|||
|
||||
ULONG
|
||||
HidParser_StoreCollection(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PHID_COLLECTION Collection,
|
||||
IN PHID_COLLECTION_CONTEXT CollectionContext,
|
||||
IN ULONG CurrentOffset)
|
||||
|
@ -105,7 +104,7 @@ HidParser_StoreCollection(
|
|||
//
|
||||
// first copy the collection details
|
||||
//
|
||||
Parser->Copy(TargetCollection, Collection, sizeof(HID_COLLECTION));
|
||||
CopyFunction(TargetCollection, Collection, sizeof(HID_COLLECTION));
|
||||
|
||||
//
|
||||
// calulcate collection size
|
||||
|
@ -140,7 +139,7 @@ HidParser_StoreCollection(
|
|||
//
|
||||
// copy report item
|
||||
//
|
||||
Parser->Copy(&CollectionContext->RawData[CurrentOffset], Collection->Reports[Index], ReportSize);
|
||||
CopyFunction(&CollectionContext->RawData[CurrentOffset], Collection->Reports[Index], ReportSize);
|
||||
|
||||
//
|
||||
// store offset to report item
|
||||
|
@ -168,7 +167,7 @@ HidParser_StoreCollection(
|
|||
//
|
||||
// store sub collections
|
||||
//
|
||||
CurrentOffset += HidParser_StoreCollection(Parser, Collection->Nodes[Index], CollectionContext, CurrentOffset);
|
||||
CurrentOffset += HidParser_StoreCollection(Collection->Nodes[Index], CollectionContext, CurrentOffset);
|
||||
|
||||
//
|
||||
// sanity check
|
||||
|
@ -184,7 +183,6 @@ HidParser_StoreCollection(
|
|||
|
||||
HIDPARSER_STATUS
|
||||
HidParser_BuildCollectionContext(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PHID_COLLECTION RootCollection,
|
||||
IN PVOID Context,
|
||||
IN ULONG ContextSize)
|
||||
|
@ -201,7 +199,7 @@ HidParser_BuildCollectionContext(
|
|||
//
|
||||
// store collections
|
||||
//
|
||||
CollectionSize = HidParser_StoreCollection(Parser, RootCollection, CollectionContext, 0);
|
||||
CollectionSize = HidParser_StoreCollection(RootCollection, CollectionContext, 0);
|
||||
|
||||
//
|
||||
// sanity check
|
||||
|
|
|
@ -13,17 +13,10 @@ NTAPI
|
|||
HidP_FreeCollectionDescription(
|
||||
IN PHIDP_DEVICE_DESC DeviceDescription)
|
||||
{
|
||||
HID_PARSER Parser;
|
||||
|
||||
//
|
||||
// init parser
|
||||
//
|
||||
HidParser_InitParser(AllocFunction, FreeFunction, ZeroFunction, CopyFunction, DebugFunction, &Parser);
|
||||
|
||||
//
|
||||
// free collection
|
||||
//
|
||||
HidParser_FreeCollectionDescription(&Parser, DeviceDescription);
|
||||
HidParser_FreeCollectionDescription(DeviceDescription);
|
||||
}
|
||||
|
||||
|
||||
|
@ -34,17 +27,10 @@ HidP_GetCaps(
|
|||
IN PHIDP_PREPARSED_DATA PreparsedData,
|
||||
OUT PHIDP_CAPS Capabilities)
|
||||
{
|
||||
HID_PARSER Parser;
|
||||
|
||||
//
|
||||
// init parser
|
||||
//
|
||||
HidParser_InitParser(AllocFunction, FreeFunction, ZeroFunction, CopyFunction, DebugFunction, &Parser);
|
||||
|
||||
//
|
||||
// get caps
|
||||
//
|
||||
return HidParser_GetCaps(&Parser, PreparsedData, Capabilities);
|
||||
return HidParser_GetCaps(PreparsedData, Capabilities);
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
|
@ -78,18 +64,12 @@ HidP_GetCollectionDescription(
|
|||
IN POOL_TYPE PoolType,
|
||||
OUT PHIDP_DEVICE_DESC DeviceDescription)
|
||||
{
|
||||
HID_PARSER Parser;
|
||||
NTSTATUS Status;
|
||||
|
||||
//
|
||||
// init parser
|
||||
//
|
||||
HidParser_InitParser(AllocFunction, FreeFunction, ZeroFunction, CopyFunction, DebugFunction, &Parser);
|
||||
|
||||
//
|
||||
// get description;
|
||||
//
|
||||
Status = HidParser_GetCollectionDescription(&Parser, ReportDesc, DescLength, PoolType, DeviceDescription);
|
||||
Status = HidParser_GetCollectionDescription(ReportDesc, DescLength, PoolType, DeviceDescription);
|
||||
return TranslateStatusForUpperLayer(Status);
|
||||
}
|
||||
|
||||
|
@ -101,23 +81,15 @@ HidP_MaxUsageListLength(
|
|||
IN USAGE UsagePage OPTIONAL,
|
||||
IN PHIDP_PREPARSED_DATA PreparsedData)
|
||||
{
|
||||
HID_PARSER Parser;
|
||||
|
||||
//
|
||||
// sanity check
|
||||
//
|
||||
ASSERT(ReportType == HidP_Input || ReportType == HidP_Output || ReportType == HidP_Feature);
|
||||
|
||||
//
|
||||
// init parser
|
||||
//
|
||||
HidParser_InitParser(AllocFunction, FreeFunction, ZeroFunction, CopyFunction, DebugFunction, &Parser);
|
||||
|
||||
|
||||
//
|
||||
// get usage length
|
||||
//
|
||||
return HidParser_MaxUsageListLength(&Parser, PreparsedData, ReportType, UsagePage);
|
||||
return HidParser_MaxUsageListLength(PreparsedData, ReportType, UsagePage);
|
||||
}
|
||||
|
||||
HIDAPI
|
||||
|
@ -132,22 +104,15 @@ HidP_GetSpecificValueCaps(
|
|||
IN OUT PUSHORT ValueCapsLength,
|
||||
IN PHIDP_PREPARSED_DATA PreparsedData)
|
||||
{
|
||||
HID_PARSER Parser;
|
||||
|
||||
//
|
||||
// sanity check
|
||||
//
|
||||
ASSERT(ReportType == HidP_Input || ReportType == HidP_Output || ReportType == HidP_Feature);
|
||||
|
||||
//
|
||||
// init parser
|
||||
//
|
||||
HidParser_InitParser(AllocFunction, FreeFunction, ZeroFunction, CopyFunction, DebugFunction, &Parser);
|
||||
|
||||
//
|
||||
// get value caps
|
||||
//
|
||||
return HidParser_GetSpecificValueCaps(&Parser, PreparsedData, ReportType, UsagePage, LinkCollection, Usage, ValueCaps, ValueCapsLength);
|
||||
return HidParser_GetSpecificValueCaps(PreparsedData, ReportType, UsagePage, LinkCollection, Usage, ValueCaps, ValueCapsLength);
|
||||
}
|
||||
|
||||
HIDAPI
|
||||
|
@ -163,22 +128,15 @@ HidP_GetUsages(
|
|||
IN PCHAR Report,
|
||||
IN ULONG ReportLength)
|
||||
{
|
||||
HID_PARSER Parser;
|
||||
|
||||
//
|
||||
// sanity check
|
||||
//
|
||||
ASSERT(ReportType == HidP_Input || ReportType == HidP_Output || ReportType == HidP_Feature);
|
||||
|
||||
//
|
||||
// init parser
|
||||
//
|
||||
HidParser_InitParser(AllocFunction, FreeFunction, ZeroFunction, CopyFunction, DebugFunction, &Parser);
|
||||
|
||||
//
|
||||
// get usages
|
||||
//
|
||||
return HidParser_GetUsages(&Parser, PreparsedData, ReportType, UsagePage, LinkCollection, UsageList, UsageLength, Report, ReportLength);
|
||||
return HidParser_GetUsages(PreparsedData, ReportType, UsagePage, LinkCollection, UsageList, UsageLength, Report, ReportLength);
|
||||
}
|
||||
|
||||
|
||||
|
@ -238,22 +196,15 @@ HidP_GetScaledUsageValue(
|
|||
IN PCHAR Report,
|
||||
IN ULONG ReportLength)
|
||||
{
|
||||
HID_PARSER Parser;
|
||||
|
||||
//
|
||||
// sanity check
|
||||
//
|
||||
ASSERT(ReportType == HidP_Input || ReportType == HidP_Output || ReportType == HidP_Feature);
|
||||
|
||||
//
|
||||
// init parser
|
||||
//
|
||||
HidParser_InitParser(AllocFunction, FreeFunction, ZeroFunction, CopyFunction, DebugFunction, &Parser);
|
||||
|
||||
//
|
||||
// get scaled usage value
|
||||
//
|
||||
return HidParser_GetScaledUsageValue(&Parser, PreparsedData, ReportType, UsagePage, LinkCollection, Usage, UsageValue, Report, ReportLength);
|
||||
return HidParser_GetScaledUsageValue(PreparsedData, ReportType, UsagePage, LinkCollection, Usage, UsageValue, Report, ReportLength);
|
||||
}
|
||||
|
||||
HIDAPI
|
||||
|
@ -269,22 +220,15 @@ HidP_GetUsageValue(
|
|||
IN PCHAR Report,
|
||||
IN ULONG ReportLength)
|
||||
{
|
||||
HID_PARSER Parser;
|
||||
|
||||
//
|
||||
// sanity check
|
||||
//
|
||||
ASSERT(ReportType == HidP_Input || ReportType == HidP_Output || ReportType == HidP_Feature);
|
||||
|
||||
//
|
||||
// init parser
|
||||
//
|
||||
HidParser_InitParser(AllocFunction, FreeFunction, ZeroFunction, CopyFunction, DebugFunction, &Parser);
|
||||
|
||||
//
|
||||
// get scaled usage value
|
||||
//
|
||||
return HidParser_GetUsageValue(&Parser, PreparsedData, ReportType, UsagePage, LinkCollection, Usage, UsageValue, Report, ReportLength);
|
||||
return HidParser_GetUsageValue(PreparsedData, ReportType, UsagePage, LinkCollection, Usage, UsageValue, Report, ReportLength);
|
||||
}
|
||||
|
||||
|
||||
|
@ -299,17 +243,10 @@ HidP_TranslateUsageAndPagesToI8042ScanCodes(
|
|||
IN PHIDP_INSERT_SCANCODES InsertCodesProcedure,
|
||||
IN PVOID InsertCodesContext)
|
||||
{
|
||||
HID_PARSER Parser;
|
||||
|
||||
//
|
||||
// init parser
|
||||
//
|
||||
HidParser_InitParser(AllocFunction, FreeFunction, ZeroFunction, CopyFunction, DebugFunction, &Parser);
|
||||
|
||||
//
|
||||
// translate usage pages
|
||||
//
|
||||
return HidParser_TranslateUsageAndPagesToI8042ScanCodes(&Parser, ChangedUsageList, UsageListLength, KeyAction, ModifierState, InsertCodesProcedure, InsertCodesContext);
|
||||
return HidParser_TranslateUsageAndPagesToI8042ScanCodes(ChangedUsageList, UsageListLength, KeyAction, ModifierState, InsertCodesProcedure, InsertCodesContext);
|
||||
}
|
||||
|
||||
HIDAPI
|
||||
|
|
|
@ -47,7 +47,6 @@ TranslateHidParserStatus(
|
|||
NTSTATUS
|
||||
NTAPI
|
||||
HidParser_GetCollectionDescription(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PHIDP_REPORT_DESCRIPTOR ReportDesc,
|
||||
IN ULONG DescLength,
|
||||
IN POOL_TYPE PoolType,
|
||||
|
@ -61,13 +60,13 @@ HidParser_GetCollectionDescription(
|
|||
//
|
||||
// first parse the report descriptor
|
||||
//
|
||||
ParserStatus = HidParser_ParseReportDescriptor(Parser, ReportDesc, DescLength, &ParserContext);
|
||||
ParserStatus = HidParser_ParseReportDescriptor(ReportDesc, DescLength, &ParserContext);
|
||||
if (ParserStatus != HIDPARSER_STATUS_SUCCESS)
|
||||
{
|
||||
//
|
||||
// failed to parse report descriptor
|
||||
//
|
||||
Parser->Debug("[HIDPARSER] Failed to parse report descriptor with %x\n", ParserStatus);
|
||||
DebugFunction("[HIDPARSER] Failed to parse report descriptor with %x\n", ParserStatus);
|
||||
return ParserStatus;
|
||||
}
|
||||
|
||||
|
@ -87,12 +86,12 @@ HidParser_GetCollectionDescription(
|
|||
//
|
||||
// zero description
|
||||
//
|
||||
Parser->Zero(DeviceDescription, sizeof(HIDP_DEVICE_DESC));
|
||||
ZeroFunction(DeviceDescription, sizeof(HIDP_DEVICE_DESC));
|
||||
|
||||
//
|
||||
// allocate collection
|
||||
//
|
||||
DeviceDescription->CollectionDesc = (PHIDP_COLLECTION_DESC)Parser->Alloc(sizeof(HIDP_COLLECTION_DESC) * CollectionCount);
|
||||
DeviceDescription->CollectionDesc = (PHIDP_COLLECTION_DESC)AllocFunction(sizeof(HIDP_COLLECTION_DESC) * CollectionCount);
|
||||
if (!DeviceDescription->CollectionDesc)
|
||||
{
|
||||
//
|
||||
|
@ -104,13 +103,13 @@ HidParser_GetCollectionDescription(
|
|||
//
|
||||
// allocate report description
|
||||
//
|
||||
DeviceDescription->ReportIDs = (PHIDP_REPORT_IDS)Parser->Alloc(sizeof(HIDP_REPORT_IDS) * CollectionCount);
|
||||
DeviceDescription->ReportIDs = (PHIDP_REPORT_IDS)AllocFunction(sizeof(HIDP_REPORT_IDS) * CollectionCount);
|
||||
if (!DeviceDescription->ReportIDs)
|
||||
{
|
||||
//
|
||||
// no memory
|
||||
//
|
||||
Parser->Free(DeviceDescription->CollectionDesc);
|
||||
FreeFunction(DeviceDescription->CollectionDesc);
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
|
@ -119,15 +118,15 @@ HidParser_GetCollectionDescription(
|
|||
//
|
||||
// set preparsed data length
|
||||
//
|
||||
DeviceDescription->CollectionDesc[Index].PreparsedDataLength = HidParser_GetContextSize(Parser, ParserContext, Index);
|
||||
ParserStatus = HidParser_BuildContext(Parser, ParserContext, Index, DeviceDescription->CollectionDesc[Index].PreparsedDataLength, (PVOID*)&DeviceDescription->CollectionDesc[Index].PreparsedData);
|
||||
DeviceDescription->CollectionDesc[Index].PreparsedDataLength = HidParser_GetContextSize(ParserContext, Index);
|
||||
ParserStatus = HidParser_BuildContext(ParserContext, Index, DeviceDescription->CollectionDesc[Index].PreparsedDataLength, (PVOID*)&DeviceDescription->CollectionDesc[Index].PreparsedData);
|
||||
if (ParserStatus != HIDPARSER_STATUS_SUCCESS)
|
||||
{
|
||||
//
|
||||
// no memory
|
||||
//
|
||||
Parser->Free(DeviceDescription->CollectionDesc);
|
||||
Parser->Free(DeviceDescription->ReportIDs);
|
||||
FreeFunction(DeviceDescription->CollectionDesc);
|
||||
FreeFunction(DeviceDescription->ReportIDs);
|
||||
return ParserStatus;
|
||||
}
|
||||
|
||||
|
@ -158,8 +157,8 @@ HidParser_GetCollectionDescription(
|
|||
if (ParserStatus != HIDPARSER_STATUS_SUCCESS)
|
||||
{
|
||||
// collection not found
|
||||
Parser->Free(DeviceDescription->CollectionDesc);
|
||||
Parser->Free(DeviceDescription->ReportIDs);
|
||||
FreeFunction(DeviceDescription->CollectionDesc);
|
||||
FreeFunction(DeviceDescription->ReportIDs);
|
||||
return ParserStatus;
|
||||
}
|
||||
|
||||
|
@ -193,7 +192,6 @@ HidParser_GetCollectionDescription(
|
|||
VOID
|
||||
NTAPI
|
||||
HidParser_FreeCollectionDescription(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PHIDP_DEVICE_DESC DeviceDescription)
|
||||
{
|
||||
ULONG Index;
|
||||
|
@ -206,32 +204,31 @@ HidParser_FreeCollectionDescription(
|
|||
//
|
||||
// free collection context
|
||||
//
|
||||
Parser->Free(DeviceDescription->CollectionDesc[Index].PreparsedData);
|
||||
FreeFunction(DeviceDescription->CollectionDesc[Index].PreparsedData);
|
||||
}
|
||||
|
||||
//
|
||||
// now free collection description
|
||||
//
|
||||
Parser->Free(DeviceDescription->CollectionDesc);
|
||||
FreeFunction(DeviceDescription->CollectionDesc);
|
||||
|
||||
//
|
||||
// free report description
|
||||
//
|
||||
Parser->Free(DeviceDescription->ReportIDs);
|
||||
FreeFunction(DeviceDescription->ReportIDs);
|
||||
}
|
||||
|
||||
HIDAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
HidParser_GetCaps(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID CollectionContext,
|
||||
OUT PHIDP_CAPS Capabilities)
|
||||
{
|
||||
//
|
||||
// zero capabilities
|
||||
//
|
||||
Parser->Zero(Capabilities, sizeof(HIDP_CAPS));
|
||||
ZeroFunction(Capabilities, sizeof(HIDP_CAPS));
|
||||
|
||||
//
|
||||
// init capabilities
|
||||
|
@ -285,7 +282,6 @@ HIDAPI
|
|||
ULONG
|
||||
NTAPI
|
||||
HidParser_MaxUsageListLength(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID CollectionContext,
|
||||
IN HIDP_REPORT_TYPE ReportType,
|
||||
IN USAGE UsagePage OPTIONAL)
|
||||
|
@ -342,20 +338,18 @@ HIDAPI
|
|||
NTSTATUS
|
||||
NTAPI
|
||||
HidParser_GetButtonCaps(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID CollectionContext,
|
||||
IN HIDP_REPORT_TYPE ReportType,
|
||||
IN PHIDP_BUTTON_CAPS ButtonCaps,
|
||||
IN PUSHORT ButtonCapsLength)
|
||||
{
|
||||
return HidParser_GetSpecificButtonCaps(Parser, CollectionContext, ReportType, HID_USAGE_PAGE_UNDEFINED, HIDP_LINK_COLLECTION_UNSPECIFIED, HID_USAGE_PAGE_UNDEFINED, ButtonCaps, (PULONG)ButtonCapsLength);
|
||||
return HidParser_GetSpecificButtonCaps(CollectionContext, ReportType, HID_USAGE_PAGE_UNDEFINED, HIDP_LINK_COLLECTION_UNSPECIFIED, HID_USAGE_PAGE_UNDEFINED, ButtonCaps, (PULONG)ButtonCapsLength);
|
||||
}
|
||||
|
||||
HIDAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
HidParser_GetSpecificValueCaps(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID CollectionContext,
|
||||
IN HIDP_REPORT_TYPE ReportType,
|
||||
IN USAGE UsagePage,
|
||||
|
@ -376,21 +370,21 @@ HidParser_GetSpecificValueCaps(
|
|||
//
|
||||
// input report
|
||||
//
|
||||
ParserStatus = HidParser_GetSpecificValueCapsWithReport(Parser, CollectionContext, HID_REPORT_TYPE_INPUT, UsagePage, Usage, ValueCaps, ValueCapsLength);
|
||||
ParserStatus = HidParser_GetSpecificValueCapsWithReport(CollectionContext, HID_REPORT_TYPE_INPUT, UsagePage, Usage, ValueCaps, ValueCapsLength);
|
||||
}
|
||||
else if (ReportType == HidP_Output)
|
||||
{
|
||||
//
|
||||
// input report
|
||||
//
|
||||
ParserStatus = HidParser_GetSpecificValueCapsWithReport(Parser, CollectionContext, HID_REPORT_TYPE_OUTPUT, UsagePage, Usage, ValueCaps, ValueCapsLength);
|
||||
ParserStatus = HidParser_GetSpecificValueCapsWithReport(CollectionContext, HID_REPORT_TYPE_OUTPUT, UsagePage, Usage, ValueCaps, ValueCapsLength);
|
||||
}
|
||||
else if (ReportType == HidP_Feature)
|
||||
{
|
||||
//
|
||||
// input report
|
||||
//
|
||||
ParserStatus = HidParser_GetSpecificValueCapsWithReport(Parser, CollectionContext, HID_REPORT_TYPE_FEATURE, UsagePage, Usage, ValueCaps, ValueCapsLength);
|
||||
ParserStatus = HidParser_GetSpecificValueCapsWithReport(CollectionContext, HID_REPORT_TYPE_FEATURE, UsagePage, Usage, ValueCaps, ValueCapsLength);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -548,7 +542,6 @@ HIDAPI
|
|||
NTSTATUS
|
||||
NTAPI
|
||||
HidParser_GetUsages(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID CollectionContext,
|
||||
IN HIDP_REPORT_TYPE ReportType,
|
||||
IN USAGE UsagePage,
|
||||
|
@ -570,21 +563,21 @@ HidParser_GetUsages(
|
|||
//
|
||||
// input report
|
||||
//
|
||||
ParserStatus = HidParser_GetUsagesWithReport(Parser, CollectionContext, HID_REPORT_TYPE_INPUT, UsagePage, UsageList, UsageLength, Report, ReportLength);
|
||||
ParserStatus = HidParser_GetUsagesWithReport(CollectionContext, HID_REPORT_TYPE_INPUT, UsagePage, UsageList, UsageLength, Report, ReportLength);
|
||||
}
|
||||
else if (ReportType == HidP_Output)
|
||||
{
|
||||
//
|
||||
// input report
|
||||
//
|
||||
ParserStatus = HidParser_GetUsagesWithReport(Parser, CollectionContext, HID_REPORT_TYPE_OUTPUT, UsagePage, UsageList, UsageLength, Report, ReportLength);
|
||||
ParserStatus = HidParser_GetUsagesWithReport(CollectionContext, HID_REPORT_TYPE_OUTPUT, UsagePage, UsageList, UsageLength, Report, ReportLength);
|
||||
}
|
||||
else if (ReportType == HidP_Feature)
|
||||
{
|
||||
//
|
||||
// input report
|
||||
//
|
||||
ParserStatus = HidParser_GetUsagesWithReport(Parser, CollectionContext, HID_REPORT_TYPE_FEATURE, UsagePage, UsageList, UsageLength, Report, ReportLength);
|
||||
ParserStatus = HidParser_GetUsagesWithReport(CollectionContext, HID_REPORT_TYPE_FEATURE, UsagePage, UsageList, UsageLength, Report, ReportLength);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -612,7 +605,6 @@ HIDAPI
|
|||
NTSTATUS
|
||||
NTAPI
|
||||
HidParser_GetScaledUsageValue(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID CollectionContext,
|
||||
IN HIDP_REPORT_TYPE ReportType,
|
||||
IN USAGE UsagePage,
|
||||
|
@ -634,21 +626,21 @@ HidParser_GetScaledUsageValue(
|
|||
//
|
||||
// input report
|
||||
//
|
||||
ParserStatus = HidParser_GetScaledUsageValueWithReport(Parser, CollectionContext, HID_REPORT_TYPE_INPUT, UsagePage, Usage, UsageValue, Report, ReportLength);
|
||||
ParserStatus = HidParser_GetScaledUsageValueWithReport(CollectionContext, HID_REPORT_TYPE_INPUT, UsagePage, Usage, UsageValue, Report, ReportLength);
|
||||
}
|
||||
else if (ReportType == HidP_Output)
|
||||
{
|
||||
//
|
||||
// input report
|
||||
//
|
||||
ParserStatus = HidParser_GetScaledUsageValueWithReport(Parser, CollectionContext, HID_REPORT_TYPE_OUTPUT, UsagePage, Usage, UsageValue, Report, ReportLength);
|
||||
ParserStatus = HidParser_GetScaledUsageValueWithReport(CollectionContext, HID_REPORT_TYPE_OUTPUT, UsagePage, Usage, UsageValue, Report, ReportLength);
|
||||
}
|
||||
else if (ReportType == HidP_Feature)
|
||||
{
|
||||
//
|
||||
// input report
|
||||
//
|
||||
ParserStatus = HidParser_GetScaledUsageValueWithReport(Parser, CollectionContext, HID_REPORT_TYPE_FEATURE, UsagePage, Usage, UsageValue, Report, ReportLength);
|
||||
ParserStatus = HidParser_GetScaledUsageValueWithReport(CollectionContext, HID_REPORT_TYPE_FEATURE, UsagePage, Usage, UsageValue, Report, ReportLength);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -676,7 +668,6 @@ HIDAPI
|
|||
NTSTATUS
|
||||
NTAPI
|
||||
HidParser_TranslateUsageAndPagesToI8042ScanCodes(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PUSAGE_AND_PAGE ChangedUsageList,
|
||||
IN ULONG UsageListLength,
|
||||
IN HIDP_KEYBOARD_DIRECTION KeyAction,
|
||||
|
@ -697,14 +688,14 @@ HidParser_TranslateUsageAndPagesToI8042ScanCodes(
|
|||
//
|
||||
// process keyboard usage
|
||||
//
|
||||
Status = HidParser_TranslateKbdUsage(Parser, ChangedUsageList[Index].Usage, KeyAction, ModifierState, InsertCodesProcedure, InsertCodesContext);
|
||||
Status = HidParser_TranslateKbdUsage(ChangedUsageList[Index].Usage, KeyAction, ModifierState, InsertCodesProcedure, InsertCodesContext);
|
||||
}
|
||||
else if (ChangedUsageList[Index].UsagePage == HID_USAGE_PAGE_CONSUMER)
|
||||
{
|
||||
//
|
||||
// process consumer usage
|
||||
//
|
||||
Status = HidParser_TranslateCustUsage(Parser, ChangedUsageList[Index].Usage, KeyAction, ModifierState, InsertCodesProcedure, InsertCodesContext);
|
||||
Status = HidParser_TranslateCustUsage(ChangedUsageList[Index].Usage, KeyAction, ModifierState, InsertCodesProcedure, InsertCodesContext);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -745,7 +736,6 @@ HIDAPI
|
|||
NTSTATUS
|
||||
NTAPI
|
||||
HidParser_GetUsagesEx(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID CollectionContext,
|
||||
IN HIDP_REPORT_TYPE ReportType,
|
||||
IN USHORT LinkCollection,
|
||||
|
@ -754,7 +744,7 @@ HidParser_GetUsagesEx(
|
|||
IN PCHAR Report,
|
||||
IN ULONG ReportLength)
|
||||
{
|
||||
return HidParser_GetUsages(Parser, CollectionContext, ReportType, HID_USAGE_PAGE_UNDEFINED, LinkCollection, (PUSAGE)ButtonList, UsageLength, Report, ReportLength);
|
||||
return HidParser_GetUsages(CollectionContext, ReportType, HID_USAGE_PAGE_UNDEFINED, LinkCollection, (PUSAGE)ButtonList, UsageLength, Report, ReportLength);
|
||||
}
|
||||
|
||||
HIDAPI
|
||||
|
@ -890,7 +880,6 @@ HIDAPI
|
|||
NTSTATUS
|
||||
NTAPI
|
||||
HidParser_GetSpecificButtonCaps(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID CollectionContext,
|
||||
IN HIDP_REPORT_TYPE ReportType,
|
||||
IN USAGE UsagePage,
|
||||
|
@ -909,7 +898,6 @@ HIDAPI
|
|||
NTSTATUS
|
||||
NTAPI
|
||||
HidParser_GetData(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID CollectionContext,
|
||||
IN HIDP_REPORT_TYPE ReportType,
|
||||
OUT PHIDP_DATA DataList,
|
||||
|
@ -926,7 +914,6 @@ HIDAPI
|
|||
NTSTATUS
|
||||
NTAPI
|
||||
HidParser_GetExtendedAttributes(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID CollectionContext,
|
||||
IN HIDP_REPORT_TYPE ReportType,
|
||||
IN USHORT DataIndex,
|
||||
|
@ -942,7 +929,6 @@ HIDAPI
|
|||
NTSTATUS
|
||||
NTAPI
|
||||
HidParser_GetLinkCollectionNodes(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID CollectionContext,
|
||||
OUT PHIDP_LINK_COLLECTION_NODE LinkCollectionNodes,
|
||||
IN OUT PULONG LinkCollectionNodesLength)
|
||||
|
@ -956,7 +942,6 @@ HIDAPI
|
|||
NTSTATUS
|
||||
NTAPI
|
||||
HidParser_GetUsageValue(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID CollectionContext,
|
||||
IN HIDP_REPORT_TYPE ReportType,
|
||||
IN USAGE UsagePage,
|
||||
|
@ -978,21 +963,21 @@ HidParser_GetUsageValue(
|
|||
//
|
||||
// input report
|
||||
//
|
||||
ParserStatus = HidParser_GetUsageValueWithReport(Parser, CollectionContext, HID_REPORT_TYPE_INPUT, UsagePage, Usage, UsageValue, Report, ReportLength);
|
||||
ParserStatus = HidParser_GetUsageValueWithReport(CollectionContext, HID_REPORT_TYPE_INPUT, UsagePage, Usage, UsageValue, Report, ReportLength);
|
||||
}
|
||||
else if (ReportType == HidP_Output)
|
||||
{
|
||||
//
|
||||
// input report
|
||||
//
|
||||
ParserStatus = HidParser_GetUsageValueWithReport(Parser, CollectionContext, HID_REPORT_TYPE_OUTPUT, UsagePage, Usage, UsageValue, Report, ReportLength);
|
||||
ParserStatus = HidParser_GetUsageValueWithReport(CollectionContext, HID_REPORT_TYPE_OUTPUT, UsagePage, Usage, UsageValue, Report, ReportLength);
|
||||
}
|
||||
else if (ReportType == HidP_Feature)
|
||||
{
|
||||
//
|
||||
// input report
|
||||
//
|
||||
ParserStatus = HidParser_GetUsageValueWithReport(Parser, CollectionContext, HID_REPORT_TYPE_FEATURE, UsagePage, Usage, UsageValue, Report, ReportLength);
|
||||
ParserStatus = HidParser_GetUsageValueWithReport(CollectionContext, HID_REPORT_TYPE_FEATURE, UsagePage, Usage, UsageValue, Report, ReportLength);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1019,7 +1004,6 @@ HidParser_GetUsageValue(
|
|||
NTSTATUS
|
||||
NTAPI
|
||||
HidParser_SysPowerEvent(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID CollectionContext,
|
||||
IN PCHAR HidPacket,
|
||||
IN USHORT HidPacketLength,
|
||||
|
@ -1033,7 +1017,6 @@ HidParser_SysPowerEvent(
|
|||
NTSTATUS
|
||||
NTAPI
|
||||
HidParser_SysPowerCaps (
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID CollectionContext,
|
||||
OUT PULONG OutputBuffer)
|
||||
{
|
||||
|
@ -1046,7 +1029,6 @@ HIDAPI
|
|||
NTSTATUS
|
||||
NTAPI
|
||||
HidParser_GetUsageValueArray(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID CollectionContext,
|
||||
IN HIDP_REPORT_TYPE ReportType,
|
||||
IN USAGE UsagePage,
|
||||
|
@ -1066,7 +1048,6 @@ HIDAPI
|
|||
NTSTATUS
|
||||
NTAPI
|
||||
HidParser_UnsetUsages(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID CollectionContext,
|
||||
IN HIDP_REPORT_TYPE ReportType,
|
||||
IN USAGE UsagePage,
|
||||
|
@ -1101,7 +1082,6 @@ HIDAPI
|
|||
NTSTATUS
|
||||
NTAPI
|
||||
HidParser_SetUsages(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID CollectionContext,
|
||||
IN HIDP_REPORT_TYPE ReportType,
|
||||
IN USAGE UsagePage,
|
||||
|
@ -1120,7 +1100,6 @@ HIDAPI
|
|||
NTSTATUS
|
||||
NTAPI
|
||||
HidParser_SetUsageValueArray(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID CollectionContext,
|
||||
IN HIDP_REPORT_TYPE ReportType,
|
||||
IN USAGE UsagePage,
|
||||
|
@ -1140,7 +1119,6 @@ HIDAPI
|
|||
NTSTATUS
|
||||
NTAPI
|
||||
HidParser_SetUsageValue(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID CollectionContext,
|
||||
IN HIDP_REPORT_TYPE ReportType,
|
||||
IN USAGE UsagePage,
|
||||
|
@ -1159,7 +1137,6 @@ HIDAPI
|
|||
NTSTATUS
|
||||
NTAPI
|
||||
HidParser_SetScaledUsageValue(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID CollectionContext,
|
||||
IN HIDP_REPORT_TYPE ReportType,
|
||||
IN USAGE UsagePage,
|
||||
|
@ -1178,7 +1155,6 @@ HIDAPI
|
|||
NTSTATUS
|
||||
NTAPI
|
||||
HidParser_SetData(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID CollectionContext,
|
||||
IN HIDP_REPORT_TYPE ReportType,
|
||||
IN PHIDP_DATA DataList,
|
||||
|
@ -1195,7 +1171,6 @@ HIDAPI
|
|||
ULONG
|
||||
NTAPI
|
||||
HidParser_MaxDataListLength(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID CollectionContext,
|
||||
IN HIDP_REPORT_TYPE ReportType)
|
||||
{
|
||||
|
@ -1208,7 +1183,6 @@ HIDAPI
|
|||
NTSTATUS
|
||||
NTAPI
|
||||
HidParser_InitializeReportForID(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID CollectionContext,
|
||||
IN HIDP_REPORT_TYPE ReportType,
|
||||
IN UCHAR ReportID,
|
||||
|
@ -1226,7 +1200,6 @@ HIDAPI
|
|||
NTSTATUS
|
||||
NTAPI
|
||||
HidParser_GetValueCaps(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID CollectionContext,
|
||||
HIDP_REPORT_TYPE ReportType,
|
||||
PHIDP_VALUE_CAPS ValueCaps,
|
||||
|
|
|
@ -10,15 +10,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
//
|
||||
// function prototypes
|
||||
//
|
||||
typedef PVOID (NTAPI *PHIDPARSER_ALLOC_FUNCTION)(ULONG Size);
|
||||
typedef VOID (NTAPI *PHIDPARSER_FREE_FUNCTION)(PVOID Item);
|
||||
typedef VOID (NTAPI *PHIDPARSER_ZERO_FUNCTION)(PVOID Item, ULONG Size);
|
||||
typedef VOID (NTAPI *PHIDPARSER_COPY_FUNCTION)(PVOID Target, PVOID Source, ULONG Size);
|
||||
typedef VOID (__cdecl *PHIDPARSER_DEBUG_FUNCTION)(LPCSTR Src, ...);
|
||||
|
||||
//
|
||||
// status code
|
||||
//
|
||||
|
@ -42,52 +33,9 @@ typedef enum
|
|||
HIDPARSER_STATUS_BAD_LOG_PHY_VALUES = -10
|
||||
}HIDPARSER_STATUS_CODES;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
//
|
||||
// size of struct
|
||||
//
|
||||
unsigned long Size;
|
||||
|
||||
//
|
||||
// allocation function
|
||||
//
|
||||
PHIDPARSER_ALLOC_FUNCTION Alloc;
|
||||
|
||||
//
|
||||
// free function
|
||||
//
|
||||
PHIDPARSER_FREE_FUNCTION Free;
|
||||
|
||||
//
|
||||
// zero function
|
||||
//
|
||||
PHIDPARSER_ZERO_FUNCTION Zero;
|
||||
|
||||
//
|
||||
// copy function
|
||||
//
|
||||
PHIDPARSER_COPY_FUNCTION Copy;
|
||||
|
||||
//
|
||||
// debug function
|
||||
//
|
||||
PHIDPARSER_DEBUG_FUNCTION Debug;
|
||||
}HID_PARSER, *PHID_PARSER;
|
||||
|
||||
VOID
|
||||
HidParser_InitParser(
|
||||
IN PHIDPARSER_ALLOC_FUNCTION AllocFunction,
|
||||
IN PHIDPARSER_FREE_FUNCTION FreeFunction,
|
||||
IN PHIDPARSER_ZERO_FUNCTION ZeroFunction,
|
||||
IN PHIDPARSER_COPY_FUNCTION CopyFunction,
|
||||
IN PHIDPARSER_DEBUG_FUNCTION DebugFunction,
|
||||
OUT PHID_PARSER Parser);
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
HidParser_GetCollectionDescription(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PHIDP_REPORT_DESCRIPTOR ReportDesc,
|
||||
IN ULONG DescLength,
|
||||
IN POOL_TYPE PoolType,
|
||||
|
@ -96,14 +44,12 @@ HidParser_GetCollectionDescription(
|
|||
VOID
|
||||
NTAPI
|
||||
HidParser_FreeCollectionDescription(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PHIDP_DEVICE_DESC DeviceDescription);
|
||||
|
||||
HIDAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
HidParser_GetCaps(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID CollectionContext,
|
||||
OUT PHIDP_CAPS Capabilities);
|
||||
|
||||
|
@ -111,7 +57,6 @@ HIDAPI
|
|||
NTSTATUS
|
||||
NTAPI
|
||||
HidParser_GetSpecificValueCaps(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID CollectionContext,
|
||||
IN HIDP_REPORT_TYPE ReportType,
|
||||
IN USAGE UsagePage,
|
||||
|
@ -125,7 +70,6 @@ HIDAPI
|
|||
NTSTATUS
|
||||
NTAPI
|
||||
HidParser_GetButtonCaps(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID CollectionContext,
|
||||
HIDP_REPORT_TYPE ReportType,
|
||||
PHIDP_BUTTON_CAPS ButtonCaps,
|
||||
|
@ -135,7 +79,6 @@ HIDAPI
|
|||
NTSTATUS
|
||||
NTAPI
|
||||
HidParser_GetSpecificButtonCaps(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID CollectionContext,
|
||||
IN HIDP_REPORT_TYPE ReportType,
|
||||
IN USAGE UsagePage,
|
||||
|
@ -148,7 +91,6 @@ HIDAPI
|
|||
NTSTATUS
|
||||
NTAPI
|
||||
HidParser_GetScaledUsageValue(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID CollectionContext,
|
||||
IN HIDP_REPORT_TYPE ReportType,
|
||||
IN USAGE UsagePage,
|
||||
|
@ -163,7 +105,6 @@ HIDAPI
|
|||
NTSTATUS
|
||||
NTAPI
|
||||
HidParser_GetData(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID CollectionContext,
|
||||
IN HIDP_REPORT_TYPE ReportType,
|
||||
OUT PHIDP_DATA DataList,
|
||||
|
@ -175,7 +116,6 @@ HIDAPI
|
|||
NTSTATUS
|
||||
NTAPI
|
||||
HidParser_GetExtendedAttributes(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID CollectionContext,
|
||||
IN HIDP_REPORT_TYPE ReportType,
|
||||
IN USHORT DataIndex,
|
||||
|
@ -186,7 +126,6 @@ HIDAPI
|
|||
NTSTATUS
|
||||
NTAPI
|
||||
HidParser_GetLinkCollectionNodes(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID CollectionContext,
|
||||
OUT PHIDP_LINK_COLLECTION_NODE LinkCollectionNodes,
|
||||
IN OUT PULONG LinkCollectionNodesLength);
|
||||
|
@ -196,7 +135,6 @@ HIDAPI
|
|||
NTSTATUS
|
||||
NTAPI
|
||||
HidParser_GetUsageValue(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID CollectionContext,
|
||||
IN HIDP_REPORT_TYPE ReportType,
|
||||
IN USAGE UsagePage,
|
||||
|
@ -221,7 +159,6 @@ HIDAPI
|
|||
ULONG
|
||||
NTAPI
|
||||
HidParser_MaxUsageListLength(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID CollectionContext,
|
||||
IN HIDP_REPORT_TYPE ReportType,
|
||||
IN USAGE UsagePage OPTIONAL);
|
||||
|
@ -230,7 +167,6 @@ HIDAPI
|
|||
NTSTATUS
|
||||
NTAPI
|
||||
HidParser_GetUsages(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID CollectionContext,
|
||||
IN HIDP_REPORT_TYPE ReportType,
|
||||
IN USAGE UsagePage,
|
||||
|
@ -244,7 +180,6 @@ HIDAPI
|
|||
NTSTATUS
|
||||
NTAPI
|
||||
HidParser_GetUsagesEx(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID CollectionContext,
|
||||
IN HIDP_REPORT_TYPE ReportType,
|
||||
IN USHORT LinkCollection,
|
||||
|
@ -257,7 +192,6 @@ HidParser_GetUsagesEx(
|
|||
NTSTATUS
|
||||
NTAPI
|
||||
HidParser_SysPowerEvent (
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID CollectionContext,
|
||||
IN PCHAR HidPacket,
|
||||
IN USHORT HidPacketLength,
|
||||
|
@ -266,7 +200,6 @@ HidParser_SysPowerEvent (
|
|||
NTSTATUS
|
||||
NTAPI
|
||||
HidParser_SysPowerCaps (
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID CollectionContext,
|
||||
OUT PULONG OutputBuffer);
|
||||
|
||||
|
@ -274,7 +207,6 @@ HIDAPI
|
|||
NTSTATUS
|
||||
NTAPI
|
||||
HidParser_GetUsageValueArray(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID CollectionContext,
|
||||
IN HIDP_REPORT_TYPE ReportType,
|
||||
IN USAGE UsagePage,
|
||||
|
@ -300,7 +232,6 @@ HIDAPI
|
|||
NTSTATUS
|
||||
NTAPI
|
||||
HidParser_UnsetUsages(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID CollectionContext,
|
||||
IN HIDP_REPORT_TYPE ReportType,
|
||||
IN USAGE UsagePage,
|
||||
|
@ -325,7 +256,6 @@ HIDAPI
|
|||
NTSTATUS
|
||||
NTAPI
|
||||
HidParser_TranslateUsageAndPagesToI8042ScanCodes(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PUSAGE_AND_PAGE ChangedUsageList,
|
||||
IN ULONG UsageListLength,
|
||||
IN HIDP_KEYBOARD_DIRECTION KeyAction,
|
||||
|
@ -337,7 +267,6 @@ HIDAPI
|
|||
NTSTATUS
|
||||
NTAPI
|
||||
HidParser_SetUsages(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID CollectionContext,
|
||||
IN HIDP_REPORT_TYPE ReportType,
|
||||
IN USAGE UsagePage,
|
||||
|
@ -351,7 +280,6 @@ HIDAPI
|
|||
NTSTATUS
|
||||
NTAPI
|
||||
HidParser_SetUsageValueArray(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID CollectionContext,
|
||||
IN HIDP_REPORT_TYPE ReportType,
|
||||
IN USAGE UsagePage,
|
||||
|
@ -366,7 +294,6 @@ HIDAPI
|
|||
NTSTATUS
|
||||
NTAPI
|
||||
HidParser_SetUsageValue(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID CollectionContext,
|
||||
IN HIDP_REPORT_TYPE ReportType,
|
||||
IN USAGE UsagePage,
|
||||
|
@ -380,7 +307,6 @@ HIDAPI
|
|||
NTSTATUS
|
||||
NTAPI
|
||||
HidParser_SetScaledUsageValue(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID CollectionContext,
|
||||
IN HIDP_REPORT_TYPE ReportType,
|
||||
IN USAGE UsagePage,
|
||||
|
@ -394,7 +320,6 @@ HIDAPI
|
|||
NTSTATUS
|
||||
NTAPI
|
||||
HidParser_SetData(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID CollectionContext,
|
||||
IN HIDP_REPORT_TYPE ReportType,
|
||||
IN PHIDP_DATA DataList,
|
||||
|
@ -406,7 +331,6 @@ HIDAPI
|
|||
ULONG
|
||||
NTAPI
|
||||
HidParser_MaxDataListLength(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID CollectionContext,
|
||||
IN HIDP_REPORT_TYPE ReportType);
|
||||
|
||||
|
@ -414,7 +338,6 @@ HIDAPI
|
|||
NTSTATUS
|
||||
NTAPI
|
||||
HidParser_InitializeReportForID(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID CollectionContext,
|
||||
IN HIDP_REPORT_TYPE ReportType,
|
||||
IN UCHAR ReportID,
|
||||
|
@ -423,7 +346,6 @@ HidParser_InitializeReportForID(
|
|||
|
||||
HIDPARSER_STATUS
|
||||
HidParser_TranslateKbdUsage(
|
||||
IN PHID_PARSER Parser,
|
||||
IN USAGE Usage,
|
||||
IN HIDP_KEYBOARD_DIRECTION KeyAction,
|
||||
IN OUT PHIDP_KEYBOARD_MODIFIER_STATE ModifierState,
|
||||
|
@ -432,7 +354,6 @@ HidParser_TranslateKbdUsage(
|
|||
|
||||
HIDPARSER_STATUS
|
||||
HidParser_TranslateCustUsage(
|
||||
IN PHID_PARSER Parser,
|
||||
IN USAGE Usage,
|
||||
IN HIDP_KEYBOARD_DIRECTION KeyAction,
|
||||
IN OUT PHIDP_KEYBOARD_MODIFIER_STATE ModifierState,
|
||||
|
@ -443,7 +364,6 @@ HIDAPI
|
|||
NTSTATUS
|
||||
NTAPI
|
||||
HidParser_GetValueCaps(
|
||||
PHID_PARSER Parser,
|
||||
IN PVOID CollectionContext,
|
||||
HIDP_REPORT_TYPE ReportType,
|
||||
PHIDP_VALUE_CAPS ValueCaps,
|
||||
|
|
|
@ -17,7 +17,6 @@ static UCHAR ItemSize[4] = { 0, 1, 2, 4 };
|
|||
|
||||
VOID
|
||||
HidParser_DeleteReport(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PHID_REPORT Report)
|
||||
{
|
||||
//
|
||||
|
@ -27,7 +26,6 @@ HidParser_DeleteReport(
|
|||
|
||||
VOID
|
||||
HidParser_FreeCollection(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PHID_COLLECTION Collection)
|
||||
{
|
||||
//
|
||||
|
@ -37,7 +35,6 @@ HidParser_FreeCollection(
|
|||
|
||||
HIDPARSER_STATUS
|
||||
HidParser_AllocateCollection(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PHID_COLLECTION ParentCollection,
|
||||
IN UCHAR Type,
|
||||
IN PLOCAL_ITEM_STATE LocalItemState,
|
||||
|
@ -49,7 +46,7 @@ HidParser_AllocateCollection(
|
|||
//
|
||||
// first allocate the collection
|
||||
//
|
||||
Collection = (PHID_COLLECTION)Parser->Alloc(sizeof(HID_COLLECTION));
|
||||
Collection = (PHID_COLLECTION)AllocFunction(sizeof(HID_COLLECTION));
|
||||
if (!Collection)
|
||||
{
|
||||
//
|
||||
|
@ -105,7 +102,7 @@ HidParser_AllocateCollection(
|
|||
//
|
||||
// no usage set
|
||||
//
|
||||
Parser->Debug("HIDPARSE] No usage set\n");
|
||||
DebugFunction("HIDPARSE] No usage set\n");
|
||||
UsageValue.u.Extended = 0;
|
||||
}
|
||||
|
||||
|
@ -127,7 +124,6 @@ HidParser_AllocateCollection(
|
|||
|
||||
HIDPARSER_STATUS
|
||||
HidParser_AddCollection(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PHID_COLLECTION CurrentCollection,
|
||||
IN PHID_COLLECTION NewCollection)
|
||||
{
|
||||
|
@ -142,7 +138,7 @@ HidParser_AddCollection(
|
|||
//
|
||||
// allocate new collection
|
||||
//
|
||||
NewAllocCollection = (PHID_COLLECTION*)Parser->Alloc(sizeof(PHID_COLLECTION) * CollectionCount);
|
||||
NewAllocCollection = (PHID_COLLECTION*)AllocFunction(sizeof(PHID_COLLECTION) * CollectionCount);
|
||||
if (!NewAllocCollection)
|
||||
{
|
||||
//
|
||||
|
@ -156,12 +152,12 @@ HidParser_AddCollection(
|
|||
//
|
||||
// copy old array
|
||||
//
|
||||
Parser->Copy(NewAllocCollection, CurrentCollection->Nodes, CurrentCollection->NodeCount * sizeof(PHID_COLLECTION));
|
||||
CopyFunction(NewAllocCollection, CurrentCollection->Nodes, CurrentCollection->NodeCount * sizeof(PHID_COLLECTION));
|
||||
|
||||
//
|
||||
// delete old array
|
||||
//
|
||||
Parser->Free(CurrentCollection->Nodes);
|
||||
FreeFunction(CurrentCollection->Nodes);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -227,7 +223,6 @@ HidParser_FindReportInCollection(
|
|||
|
||||
HIDPARSER_STATUS
|
||||
HidParser_FindReport(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PHID_PARSER_CONTEXT ParserContext,
|
||||
IN UCHAR ReportType,
|
||||
IN UCHAR ReportID,
|
||||
|
@ -241,7 +236,6 @@ HidParser_FindReport(
|
|||
|
||||
HIDPARSER_STATUS
|
||||
HidParser_AllocateReport(
|
||||
IN PHID_PARSER Parser,
|
||||
IN UCHAR ReportType,
|
||||
IN UCHAR ReportID,
|
||||
OUT PHID_REPORT *OutReport)
|
||||
|
@ -251,7 +245,7 @@ HidParser_AllocateReport(
|
|||
//
|
||||
// allocate report
|
||||
//
|
||||
Report = (PHID_REPORT)Parser->Alloc(sizeof(HID_REPORT));
|
||||
Report = (PHID_REPORT)AllocFunction(sizeof(HID_REPORT));
|
||||
if (!Report)
|
||||
{
|
||||
//
|
||||
|
@ -275,7 +269,6 @@ HidParser_AllocateReport(
|
|||
|
||||
HIDPARSER_STATUS
|
||||
HidParser_AddReportToCollection(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PHID_PARSER_CONTEXT ParserContext,
|
||||
IN PHID_COLLECTION CurrentCollection,
|
||||
IN PHID_REPORT NewReport)
|
||||
|
@ -285,7 +278,7 @@ HidParser_AddReportToCollection(
|
|||
//
|
||||
// allocate new report array
|
||||
//
|
||||
NewReportArray = (PHID_REPORT*)Parser->Alloc(sizeof(PHID_REPORT) * (CurrentCollection->ReportCount + 1));
|
||||
NewReportArray = (PHID_REPORT*)AllocFunction(sizeof(PHID_REPORT) * (CurrentCollection->ReportCount + 1));
|
||||
if (!NewReportArray)
|
||||
{
|
||||
//
|
||||
|
@ -299,12 +292,12 @@ HidParser_AddReportToCollection(
|
|||
//
|
||||
// copy old array contents
|
||||
//
|
||||
Parser->Copy(NewReportArray, CurrentCollection->Reports, sizeof(PHID_REPORT) * CurrentCollection->ReportCount);
|
||||
CopyFunction(NewReportArray, CurrentCollection->Reports, sizeof(PHID_REPORT) * CurrentCollection->ReportCount);
|
||||
|
||||
//
|
||||
// free old array
|
||||
//
|
||||
Parser->Free(CurrentCollection->Reports);
|
||||
FreeFunction(CurrentCollection->Reports);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -322,7 +315,6 @@ HidParser_AddReportToCollection(
|
|||
|
||||
HIDPARSER_STATUS
|
||||
HidParser_GetReport(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PHID_PARSER_CONTEXT ParserContext,
|
||||
IN PHID_COLLECTION Collection,
|
||||
IN UCHAR ReportType,
|
||||
|
@ -335,7 +327,7 @@ HidParser_GetReport(
|
|||
//
|
||||
// try finding existing report
|
||||
//
|
||||
Status = HidParser_FindReport(Parser, ParserContext, ReportType, ReportID, OutReport);
|
||||
Status = HidParser_FindReport(ParserContext, ReportType, ReportID, OutReport);
|
||||
if (Status == HIDPARSER_STATUS_SUCCESS || CreateIfNotExists == FALSE)
|
||||
{
|
||||
//
|
||||
|
@ -347,7 +339,7 @@ HidParser_GetReport(
|
|||
//
|
||||
// allocate new report
|
||||
//
|
||||
Status = HidParser_AllocateReport(Parser, ReportType, ReportID, OutReport);
|
||||
Status = HidParser_AllocateReport(ReportType, ReportID, OutReport);
|
||||
if (Status != HIDPARSER_STATUS_SUCCESS)
|
||||
{
|
||||
//
|
||||
|
@ -359,13 +351,13 @@ HidParser_GetReport(
|
|||
//
|
||||
// add report
|
||||
//
|
||||
Status = HidParser_AddReportToCollection(Parser, ParserContext, Collection, *OutReport);
|
||||
Status = HidParser_AddReportToCollection(ParserContext, Collection, *OutReport);
|
||||
if (Status != HIDPARSER_STATUS_SUCCESS)
|
||||
{
|
||||
//
|
||||
// failed to allocate report
|
||||
//
|
||||
Parser->Free(*OutReport);
|
||||
FreeFunction(*OutReport);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -376,7 +368,6 @@ HidParser_GetReport(
|
|||
|
||||
HIDPARSER_STATUS
|
||||
HidParser_ReserveReportItems(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PHID_REPORT Report,
|
||||
IN ULONG ReportCount,
|
||||
OUT PHID_REPORT *OutReport)
|
||||
|
@ -402,7 +393,7 @@ HidParser_ReserveReportItems(
|
|||
//
|
||||
// allocate memory
|
||||
//
|
||||
NewReport = (PHID_REPORT)Parser->Alloc(Size + OldSize);
|
||||
NewReport = (PHID_REPORT)AllocFunction(Size + OldSize);
|
||||
if (!NewReport)
|
||||
{
|
||||
//
|
||||
|
@ -415,7 +406,7 @@ HidParser_ReserveReportItems(
|
|||
//
|
||||
// copy old report
|
||||
//
|
||||
Parser->Copy(NewReport, Report, OldSize);
|
||||
CopyFunction(NewReport, Report, OldSize);
|
||||
|
||||
//
|
||||
// increase array size
|
||||
|
@ -651,7 +642,6 @@ HidParser_UpdateCollectionReport(
|
|||
|
||||
HIDPARSER_STATUS
|
||||
HidParser_AddMainItem(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PHID_PARSER_CONTEXT ParserContext,
|
||||
IN PHID_REPORT Report,
|
||||
IN PGLOBAL_ITEM_STATE GlobalItemState,
|
||||
|
@ -667,7 +657,7 @@ HidParser_AddMainItem(
|
|||
//
|
||||
// first grow report item array
|
||||
//
|
||||
Status = HidParser_ReserveReportItems(Parser, Report, GlobalItemState->ReportCount, &NewReport);
|
||||
Status = HidParser_ReserveReportItems(Report, GlobalItemState->ReportCount, &NewReport);
|
||||
if (Status != HIDPARSER_STATUS_SUCCESS)
|
||||
{
|
||||
//
|
||||
|
@ -715,7 +705,6 @@ HidParser_AddMainItem(
|
|||
|
||||
HIDPARSER_STATUS
|
||||
HidParser_ParseReportDescriptor(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PUCHAR ReportDescriptor,
|
||||
IN ULONG ReportLength,
|
||||
OUT PVOID *OutParser)
|
||||
|
@ -745,7 +734,7 @@ HidParser_ParseReportDescriptor(
|
|||
//
|
||||
// allocate parser
|
||||
//
|
||||
ParserContext = Parser->Alloc(sizeof(HID_PARSER_CONTEXT));;
|
||||
ParserContext = AllocFunction(sizeof(HID_PARSER_CONTEXT));
|
||||
if (!ParserContext)
|
||||
return HIDPARSER_STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
||||
|
@ -754,28 +743,28 @@ HidParser_ParseReportDescriptor(
|
|||
// allocate usage stack
|
||||
//
|
||||
ParserContext->LocalItemState.UsageStackAllocated = 10;
|
||||
ParserContext->LocalItemState.UsageStack = (PUSAGE_VALUE)Parser->Alloc(ParserContext->LocalItemState.UsageStackAllocated * sizeof(USAGE_VALUE));
|
||||
ParserContext->LocalItemState.UsageStack = (PUSAGE_VALUE)AllocFunction(ParserContext->LocalItemState.UsageStackAllocated * sizeof(USAGE_VALUE));
|
||||
if (!ParserContext->LocalItemState.UsageStack)
|
||||
{
|
||||
//
|
||||
// no memory
|
||||
//
|
||||
Parser->Free(ParserContext);
|
||||
FreeFunction(ParserContext);
|
||||
return HIDPARSER_STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
//
|
||||
// now allocate root collection
|
||||
//
|
||||
Status = HidParser_AllocateCollection(Parser, NULL, COLLECTION_LOGICAL, &ParserContext->LocalItemState, &ParserContext->RootCollection);
|
||||
Status = HidParser_AllocateCollection(NULL, COLLECTION_LOGICAL, &ParserContext->LocalItemState, &ParserContext->RootCollection);
|
||||
if (Status != HIDPARSER_STATUS_SUCCESS)
|
||||
{
|
||||
//
|
||||
// no memory
|
||||
//
|
||||
Parser->Free(ParserContext->LocalItemState.UsageStack);
|
||||
FreeFunction(ParserContext->LocalItemState.UsageStack);
|
||||
ParserContext->LocalItemState.UsageStack = NULL;
|
||||
Parser->Free(ParserContext);
|
||||
FreeFunction(ParserContext);
|
||||
return HIDPARSER_STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
|
@ -827,11 +816,11 @@ HidParser_ParseReportDescriptor(
|
|||
//
|
||||
// invalid item size
|
||||
//
|
||||
//Parser->Debug("CurrentItem invalid item size %lu\n", CurrentItemSize);
|
||||
//DebugFunction("CurrentItem invalid item size %lu\n", CurrentItemSize);
|
||||
}
|
||||
|
||||
}
|
||||
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);
|
||||
DebugFunction("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
|
||||
//
|
||||
|
@ -880,13 +869,13 @@ HidParser_ParseReportDescriptor(
|
|||
//
|
||||
// allocate new collection
|
||||
//
|
||||
Status = HidParser_AllocateCollection(Parser, CurrentCollection, (UCHAR)Data, &ParserContext->LocalItemState, &NewCollection);
|
||||
Status = HidParser_AllocateCollection(CurrentCollection, (UCHAR)Data, &ParserContext->LocalItemState, &NewCollection);
|
||||
ASSERT(Status == HIDPARSER_STATUS_SUCCESS);
|
||||
|
||||
//
|
||||
// add new collection to current collection
|
||||
//
|
||||
Status = HidParser_AddCollection(Parser, CurrentCollection, NewCollection);
|
||||
Status = HidParser_AddCollection(CurrentCollection, NewCollection);
|
||||
ASSERT(Status == HIDPARSER_STATUS_SUCCESS);
|
||||
|
||||
//
|
||||
|
@ -925,7 +914,7 @@ HidParser_ParseReportDescriptor(
|
|||
break;
|
||||
|
||||
default:
|
||||
Parser->Debug("[HIDPARSE] Unknown ReportType Tag %x Type %x Size %x CurrentItemSize %x\n", CurrentItem->Tag, CurrentItem->Type, CurrentItem->Size, CurrentItemSize);
|
||||
DebugFunction("[HIDPARSE] Unknown ReportType Tag %x Type %x Size %x CurrentItemSize %x\n", CurrentItem->Tag, CurrentItem->Type, CurrentItem->Size, CurrentItemSize);
|
||||
ASSERT(FALSE);
|
||||
break;
|
||||
}
|
||||
|
@ -936,7 +925,7 @@ HidParser_ParseReportDescriptor(
|
|||
//
|
||||
// get report
|
||||
//
|
||||
Status = HidParser_GetReport(Parser, ParserContext, CurrentCollection, ReportType, ParserContext->GlobalItemState.ReportId, TRUE, &Report);
|
||||
Status = HidParser_GetReport(ParserContext, CurrentCollection, ReportType, ParserContext->GlobalItemState.ReportId, TRUE, &Report);
|
||||
ASSERT(Status == HIDPARSER_STATUS_SUCCESS);
|
||||
|
||||
// fill in a sensible default if the index isn't set
|
||||
|
@ -956,7 +945,7 @@ HidParser_ParseReportDescriptor(
|
|||
//
|
||||
// add states & data to the report
|
||||
//
|
||||
Status = HidParser_AddMainItem(Parser, ParserContext, Report, &ParserContext->GlobalItemState, &ParserContext->LocalItemState, MainItemData, CurrentCollection);
|
||||
Status = HidParser_AddMainItem(ParserContext, Report, &ParserContext->GlobalItemState, &ParserContext->LocalItemState, MainItemData, CurrentCollection);
|
||||
ASSERT(Status == HIDPARSER_STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
@ -969,7 +958,7 @@ HidParser_ParseReportDescriptor(
|
|||
//
|
||||
// reset the local item state and clear the usage stack
|
||||
//
|
||||
Parser->Zero(&ParserContext->LocalItemState, sizeof(LOCAL_ITEM_STATE));
|
||||
ZeroFunction(&ParserContext->LocalItemState, sizeof(LOCAL_ITEM_STATE));
|
||||
|
||||
//
|
||||
// restore stack
|
||||
|
@ -982,68 +971,68 @@ HidParser_ParseReportDescriptor(
|
|||
{
|
||||
switch (CurrentItem->Tag) {
|
||||
case ITEM_TAG_GLOBAL_USAGE_PAGE:
|
||||
Parser->Debug("[HIDPARSE] ITEM_TAG_GLOBAL_USAGE_PAGE %x\n", Data);
|
||||
DebugFunction("[HIDPARSE] ITEM_TAG_GLOBAL_USAGE_PAGE %x\n", Data);
|
||||
ParserContext->GlobalItemState.UsagePage = Data;
|
||||
break;
|
||||
case ITEM_TAG_GLOBAL_LOGICAL_MINIMUM:
|
||||
Parser->Debug("[HIDPARSE] ITEM_TAG_GLOBAL_LOGICAL_MINIMUM %x\n", Data);
|
||||
DebugFunction("[HIDPARSE] ITEM_TAG_GLOBAL_LOGICAL_MINIMUM %x\n", Data);
|
||||
ParserContext->GlobalItemState.LogicalMinimum = Data;
|
||||
break;
|
||||
|
||||
case ITEM_TAG_GLOBAL_LOGICAL_MAXIMUM:
|
||||
Parser->Debug("[HIDPARSE] ITEM_TAG_GLOBAL_LOCAL_MAXIMUM %x\n", Data);
|
||||
DebugFunction("[HIDPARSE] ITEM_TAG_GLOBAL_LOCAL_MAXIMUM %x\n", Data);
|
||||
ParserContext->GlobalItemState.LogicialMaximum = Data;
|
||||
break;
|
||||
|
||||
case ITEM_TAG_GLOBAL_PHYSICAL_MINIMUM:
|
||||
Parser->Debug("[HIDPARSE] ITEM_TAG_GLOBAL_PHYSICAL_MINIMUM %x\n", Data);
|
||||
DebugFunction("[HIDPARSE] ITEM_TAG_GLOBAL_PHYSICAL_MINIMUM %x\n", Data);
|
||||
ParserContext->GlobalItemState.PhysicalMinimum = Data;
|
||||
break;
|
||||
|
||||
case ITEM_TAG_GLOBAL_PHYSICAL_MAXIMUM:
|
||||
Parser->Debug("[HIDPARSE] ITEM_TAG_GLOBAL_PHYSICAL_MAXIMUM %x\n", Data);
|
||||
DebugFunction("[HIDPARSE] ITEM_TAG_GLOBAL_PHYSICAL_MAXIMUM %x\n", Data);
|
||||
ParserContext->GlobalItemState.PhysicalMaximum = Data;
|
||||
break;
|
||||
|
||||
case ITEM_TAG_GLOBAL_UNIT_EXPONENT:
|
||||
Parser->Debug("[HIDPARSE] ITEM_TAG_GLOBAL_REPORT_UNIT_EXPONENT %x\n", Data);
|
||||
DebugFunction("[HIDPARSE] ITEM_TAG_GLOBAL_REPORT_UNIT_EXPONENT %x\n", Data);
|
||||
ParserContext->GlobalItemState.UnitExponent = Data;
|
||||
break;
|
||||
|
||||
case ITEM_TAG_GLOBAL_UNIT:
|
||||
Parser->Debug("[HIDPARSE] ITEM_TAG_GLOBAL_REPORT_UNIT %x\n", Data);
|
||||
DebugFunction("[HIDPARSE] ITEM_TAG_GLOBAL_REPORT_UNIT %x\n", Data);
|
||||
ParserContext->GlobalItemState.Unit = Data;
|
||||
break;
|
||||
|
||||
case ITEM_TAG_GLOBAL_REPORT_SIZE:
|
||||
Parser->Debug("[HIDPARSE] ITEM_TAG_GLOBAL_REPORT_SIZE %x\n", Data);
|
||||
DebugFunction("[HIDPARSE] ITEM_TAG_GLOBAL_REPORT_SIZE %x\n", Data);
|
||||
ParserContext->GlobalItemState.ReportSize = Data;
|
||||
break;
|
||||
|
||||
case ITEM_TAG_GLOBAL_REPORT_ID:
|
||||
Parser->Debug("[HIDPARSE] ITEM_TAG_GLOBAL_REPORT_ID %x\n", Data);
|
||||
DebugFunction("[HIDPARSE] ITEM_TAG_GLOBAL_REPORT_ID %x\n", Data);
|
||||
ParserContext->GlobalItemState.ReportId = Data;
|
||||
ParserContext->UseReportIDs = TRUE;
|
||||
break;
|
||||
|
||||
case ITEM_TAG_GLOBAL_REPORT_COUNT:
|
||||
Parser->Debug("[HIDPARSE] ITEM_TAG_GLOBAL_REPORT_COUNT %x\n", Data);
|
||||
DebugFunction("[HIDPARSE] ITEM_TAG_GLOBAL_REPORT_COUNT %x\n", Data);
|
||||
ParserContext->GlobalItemState.ReportCount = Data;
|
||||
break;
|
||||
|
||||
case ITEM_TAG_GLOBAL_PUSH:
|
||||
{
|
||||
Parser->Debug("[HIDPARSE] ITEM_TAG_GLOBAL_PUSH\n");
|
||||
DebugFunction("[HIDPARSE] ITEM_TAG_GLOBAL_PUSH\n");
|
||||
//
|
||||
// allocate global item state
|
||||
//
|
||||
LinkedGlobalItemState = (PGLOBAL_ITEM_STATE)Parser->Alloc(sizeof(GLOBAL_ITEM_STATE));
|
||||
LinkedGlobalItemState = (PGLOBAL_ITEM_STATE)AllocFunction(sizeof(GLOBAL_ITEM_STATE));
|
||||
ASSERT(LinkedGlobalItemState);
|
||||
|
||||
//
|
||||
// copy global item state
|
||||
//
|
||||
Parser->Copy(LinkedGlobalItemState, &ParserContext->GlobalItemState, sizeof(GLOBAL_ITEM_STATE));
|
||||
CopyFunction(LinkedGlobalItemState, &ParserContext->GlobalItemState, sizeof(GLOBAL_ITEM_STATE));
|
||||
|
||||
//
|
||||
// store pushed item in link member
|
||||
|
@ -1053,7 +1042,7 @@ HidParser_ParseReportDescriptor(
|
|||
}
|
||||
case ITEM_TAG_GLOBAL_POP:
|
||||
{
|
||||
Parser->Debug("[HIDPARSE] ITEM_TAG_GLOBAL_POP\n");
|
||||
DebugFunction("[HIDPARSE] ITEM_TAG_GLOBAL_POP\n");
|
||||
if (ParserContext->GlobalItemState.Next == NULL)
|
||||
{
|
||||
//
|
||||
|
@ -1071,12 +1060,12 @@ HidParser_ParseReportDescriptor(
|
|||
//
|
||||
// replace current item with linked one
|
||||
//
|
||||
Parser->Copy(&ParserContext->GlobalItemState, LinkedGlobalItemState, sizeof(GLOBAL_ITEM_STATE));
|
||||
CopyFunction(&ParserContext->GlobalItemState, LinkedGlobalItemState, sizeof(GLOBAL_ITEM_STATE));
|
||||
|
||||
//
|
||||
// free item
|
||||
//
|
||||
Parser->Free(LinkedGlobalItemState);
|
||||
FreeFunction(LinkedGlobalItemState);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1106,18 +1095,18 @@ HidParser_ParseReportDescriptor(
|
|||
//
|
||||
// build new usage stack
|
||||
//
|
||||
NewUsageStack = (PUSAGE_VALUE)Parser->Alloc(sizeof(USAGE_VALUE) * ParserContext->LocalItemState.UsageStackAllocated);
|
||||
NewUsageStack = (PUSAGE_VALUE)AllocFunction(sizeof(USAGE_VALUE) * ParserContext->LocalItemState.UsageStackAllocated);
|
||||
ASSERT(NewUsageStack);
|
||||
|
||||
//
|
||||
// copy old usage stack
|
||||
//
|
||||
Parser->Copy(NewUsageStack, ParserContext->LocalItemState.UsageStack, sizeof(USAGE_VALUE) * (ParserContext->LocalItemState.UsageStackAllocated - 10));
|
||||
CopyFunction(NewUsageStack, ParserContext->LocalItemState.UsageStack, sizeof(USAGE_VALUE) * (ParserContext->LocalItemState.UsageStackAllocated - 10));
|
||||
|
||||
//
|
||||
// free old usage stack
|
||||
//
|
||||
Parser->Free(ParserContext->LocalItemState.UsageStack);
|
||||
FreeFunction(ParserContext->LocalItemState.UsageStack);
|
||||
|
||||
//
|
||||
// replace with new usage stack
|
||||
|
@ -1144,7 +1133,7 @@ HidParser_ParseReportDescriptor(
|
|||
}
|
||||
|
||||
case ITEM_TAG_LOCAL_USAGE_MINIMUM:
|
||||
Parser->Debug("[HIDPARSE] ITEM_TAG_LOCAL_USAGE_MINIMUM Data %x\n", Data);
|
||||
DebugFunction("[HIDPARSE] ITEM_TAG_LOCAL_USAGE_MINIMUM Data %x\n", Data);
|
||||
ParserContext->LocalItemState.UsageMinimum.u.Extended = Data;
|
||||
ParserContext->LocalItemState.UsageMinimum.IsExtended
|
||||
= CurrentItemSize == sizeof(ULONG);
|
||||
|
@ -1152,7 +1141,7 @@ HidParser_ParseReportDescriptor(
|
|||
break;
|
||||
|
||||
case ITEM_TAG_LOCAL_USAGE_MAXIMUM:
|
||||
Parser->Debug("[HIDPARSE] ITEM_TAG_LOCAL_USAGE_MAXIMUM Data %x ItemSize %x %x\n", Data, CurrentItemSize, CurrentItem->Size);
|
||||
DebugFunction("[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);
|
||||
|
@ -1160,39 +1149,39 @@ HidParser_ParseReportDescriptor(
|
|||
break;
|
||||
|
||||
case ITEM_TAG_LOCAL_DESIGNATOR_INDEX:
|
||||
Parser->Debug("[HIDPARSE] ITEM_TAG_LOCAL_DESIGNATOR_INDEX Data %x\n", Data);
|
||||
DebugFunction("[HIDPARSE] ITEM_TAG_LOCAL_DESIGNATOR_INDEX Data %x\n", Data);
|
||||
ParserContext->LocalItemState.DesignatorIndex = Data;
|
||||
ParserContext->LocalItemState.DesignatorIndexSet = TRUE;
|
||||
break;
|
||||
|
||||
case ITEM_TAG_LOCAL_DESIGNATOR_MINIMUM:
|
||||
Parser->Debug("[HIDPARSE] ITEM_TAG_LOCAL_DESIGNATOR_MINIMUM Data %x\n", Data);
|
||||
DebugFunction("[HIDPARSE] ITEM_TAG_LOCAL_DESIGNATOR_MINIMUM Data %x\n", Data);
|
||||
ParserContext->LocalItemState.DesignatorMinimum = Data;
|
||||
break;
|
||||
|
||||
case ITEM_TAG_LOCAL_DESIGNATOR_MAXIMUM:
|
||||
Parser->Debug("[HIDPARSE] ITEM_TAG_LOCAL_DESIGNATOR_MAXIMUM Data %x\n", Data);
|
||||
DebugFunction("[HIDPARSE] ITEM_TAG_LOCAL_DESIGNATOR_MAXIMUM Data %x\n", Data);
|
||||
ParserContext->LocalItemState.DesignatorMaximum = Data;
|
||||
break;
|
||||
|
||||
case ITEM_TAG_LOCAL_STRING_INDEX:
|
||||
Parser->Debug("[HIDPARSE] ITEM_TAG_LOCAL_STRING_INDEX Data %x\n", Data);
|
||||
DebugFunction("[HIDPARSE] ITEM_TAG_LOCAL_STRING_INDEX Data %x\n", Data);
|
||||
ParserContext->LocalItemState.StringIndex = Data;
|
||||
ParserContext->LocalItemState.StringIndexSet = TRUE;
|
||||
break;
|
||||
|
||||
case ITEM_TAG_LOCAL_STRING_MINIMUM:
|
||||
Parser->Debug("[HIDPARSE] ITEM_TAG_LOCAL_STRING_MINIMUM Data %x\n", Data);
|
||||
DebugFunction("[HIDPARSE] ITEM_TAG_LOCAL_STRING_MINIMUM Data %x\n", Data);
|
||||
ParserContext->LocalItemState.StringMinimum = Data;
|
||||
break;
|
||||
|
||||
case ITEM_TAG_LOCAL_STRING_MAXIMUM:
|
||||
Parser->Debug("[HIDPARSE] ITEM_TAG_LOCAL_STRING_MAXIMUM Data %x\n", Data);
|
||||
DebugFunction("[HIDPARSE] ITEM_TAG_LOCAL_STRING_MAXIMUM Data %x\n", Data);
|
||||
ParserContext->LocalItemState.StringMaximum = Data;
|
||||
break;
|
||||
|
||||
default:
|
||||
Parser->Debug("Unknown Local Item Tag %x\n", CurrentItem->Tag);
|
||||
DebugFunction("Unknown Local Item Tag %x\n", CurrentItem->Tag);
|
||||
ASSERT(FALSE);
|
||||
break;
|
||||
}
|
||||
|
@ -1202,7 +1191,7 @@ HidParser_ParseReportDescriptor(
|
|||
case ITEM_TYPE_LONG:
|
||||
{
|
||||
CurrentLongItem = (PLONG_ITEM)CurrentItem;
|
||||
Parser->Debug("Unsupported ITEM_TYPE_LONG Tag %x\n", CurrentLongItem->LongItemTag);
|
||||
DebugFunction("Unsupported ITEM_TYPE_LONG Tag %x\n", CurrentLongItem->LongItemTag);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1221,7 +1210,7 @@ HidParser_ParseReportDescriptor(
|
|||
LinkedGlobalItemState = (PGLOBAL_ITEM_STATE)ParserContext->GlobalItemState.Next;
|
||||
while(LinkedGlobalItemState != NULL)
|
||||
{
|
||||
Parser->Debug("[HIDPARSE] Freeing GlobalState %p\n", LinkedGlobalItemState);
|
||||
DebugFunction("[HIDPARSE] Freeing GlobalState %p\n", LinkedGlobalItemState);
|
||||
//
|
||||
// free global item state
|
||||
//
|
||||
|
@ -1230,7 +1219,7 @@ HidParser_ParseReportDescriptor(
|
|||
//
|
||||
// free state
|
||||
//
|
||||
Parser->Free(LinkedGlobalItemState);
|
||||
FreeFunction(LinkedGlobalItemState);
|
||||
|
||||
//
|
||||
// move to next global state
|
||||
|
@ -1241,7 +1230,7 @@ HidParser_ParseReportDescriptor(
|
|||
//
|
||||
// free usage stack
|
||||
//
|
||||
Parser->Free(ParserContext->LocalItemState.UsageStack);
|
||||
FreeFunction(ParserContext->LocalItemState.UsageStack);
|
||||
ParserContext->LocalItemState.UsageStack = NULL;
|
||||
|
||||
//
|
||||
|
@ -1257,7 +1246,6 @@ HidParser_ParseReportDescriptor(
|
|||
|
||||
PHID_COLLECTION
|
||||
HidParser_GetCollection(
|
||||
IN PHID_PARSER Parser,
|
||||
PHID_PARSER_CONTEXT ParserContext,
|
||||
IN ULONG CollectionNumber)
|
||||
{
|
||||
|
@ -1282,7 +1270,7 @@ HidParser_GetCollection(
|
|||
//
|
||||
// no such collection
|
||||
//
|
||||
Parser->Debug("HIDPARSE] No such collection %lu\n", CollectionNumber);
|
||||
DebugFunction("HIDPARSE] No such collection %lu\n", CollectionNumber);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1313,7 +1301,6 @@ HidParser_NumberOfTopCollections(
|
|||
|
||||
HIDPARSER_STATUS
|
||||
HidParser_BuildContext(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID ParserContext,
|
||||
IN ULONG CollectionIndex,
|
||||
IN ULONG ContextSize,
|
||||
|
@ -1326,13 +1313,13 @@ HidParser_BuildContext(
|
|||
//
|
||||
// lets get the collection
|
||||
//
|
||||
Collection = HidParser_GetCollection(Parser, (PHID_PARSER_CONTEXT)ParserContext, CollectionIndex);
|
||||
Collection = HidParser_GetCollection((PHID_PARSER_CONTEXT)ParserContext, CollectionIndex);
|
||||
ASSERT(Collection);
|
||||
|
||||
//
|
||||
// lets allocate the context
|
||||
//
|
||||
Context = Parser->Alloc(ContextSize);
|
||||
Context = AllocFunction(ContextSize);
|
||||
if (Context == NULL)
|
||||
{
|
||||
//
|
||||
|
@ -1344,7 +1331,7 @@ HidParser_BuildContext(
|
|||
//
|
||||
// lets build the context
|
||||
//
|
||||
Status = HidParser_BuildCollectionContext(Parser, Collection, Context, ContextSize);
|
||||
Status = HidParser_BuildCollectionContext(Collection, Context, ContextSize);
|
||||
if (Status == HIDPARSER_STATUS_SUCCESS)
|
||||
{
|
||||
//
|
||||
|
@ -1362,7 +1349,6 @@ HidParser_BuildContext(
|
|||
|
||||
ULONG
|
||||
HidParser_GetContextSize(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID ParserContext,
|
||||
IN ULONG CollectionIndex)
|
||||
{
|
||||
|
@ -1372,7 +1358,7 @@ HidParser_GetContextSize(
|
|||
//
|
||||
// lets get the collection
|
||||
//
|
||||
Collection = HidParser_GetCollection(Parser, (PHID_PARSER_CONTEXT)ParserContext, CollectionIndex);
|
||||
Collection = HidParser_GetCollection((PHID_PARSER_CONTEXT)ParserContext, CollectionIndex);
|
||||
|
||||
//
|
||||
// calculate size
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <hidpddi.h>
|
||||
|
||||
#include "hidparser.h"
|
||||
#include "hidp.h"
|
||||
|
||||
/*
|
||||
* Copyright 2007, Haiku, Inc. All Rights Reserved.
|
||||
|
@ -276,10 +277,6 @@ HidParser_GetReportLength(
|
|||
IN PVOID CollectionContext,
|
||||
IN UCHAR ReportType);
|
||||
|
||||
UCHAR
|
||||
HidParser_IsReportIDUsed(
|
||||
IN PHID_PARSER Parser);
|
||||
|
||||
ULONG
|
||||
HidParser_GetReportItemCountFromReportType(
|
||||
IN PVOID CollectionContext,
|
||||
|
@ -299,7 +296,6 @@ HidParser_GetMaxUsageListLengthWithReportAndPage(
|
|||
|
||||
HIDPARSER_STATUS
|
||||
HidParser_GetSpecificValueCapsWithReport(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID CollectionContext,
|
||||
IN UCHAR ReportType,
|
||||
IN USHORT UsagePage,
|
||||
|
@ -310,7 +306,6 @@ HidParser_GetSpecificValueCapsWithReport(
|
|||
|
||||
HIDPARSER_STATUS
|
||||
HidParser_GetUsagesWithReport(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID CollectionContext,
|
||||
IN UCHAR ReportType,
|
||||
IN USAGE UsagePage,
|
||||
|
@ -321,7 +316,6 @@ HidParser_GetUsagesWithReport(
|
|||
|
||||
HIDPARSER_STATUS
|
||||
HidParser_GetScaledUsageValueWithReport(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID CollectionContext,
|
||||
IN UCHAR ReportType,
|
||||
IN USAGE UsagePage,
|
||||
|
@ -332,7 +326,6 @@ HidParser_GetScaledUsageValueWithReport(
|
|||
|
||||
HIDPARSER_STATUS
|
||||
HidParser_GetUsageValueWithReport(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID CollectionContext,
|
||||
IN UCHAR ReportType,
|
||||
IN USAGE UsagePage,
|
||||
|
@ -345,7 +338,6 @@ HidParser_GetUsageValueWithReport(
|
|||
|
||||
HIDPARSER_STATUS
|
||||
HidParser_BuildContext(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID ParserContext,
|
||||
IN ULONG CollectionIndex,
|
||||
IN ULONG ContextSize,
|
||||
|
@ -357,7 +349,6 @@ HidParser_CalculateContextSize(
|
|||
|
||||
HIDPARSER_STATUS
|
||||
HidParser_ParseReportDescriptor(
|
||||
PHID_PARSER Parser,
|
||||
PUCHAR Report,
|
||||
ULONG ReportSize,
|
||||
OUT PVOID *ParserContext);
|
||||
|
@ -368,7 +359,6 @@ HidParser_NumberOfTopCollections(
|
|||
|
||||
ULONG
|
||||
HidParser_GetContextSize(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PVOID ParserContext,
|
||||
IN ULONG CollectionNumber);
|
||||
|
||||
|
@ -385,7 +375,6 @@ HidParser_GetTotalCollectionCount(
|
|||
|
||||
HIDPARSER_STATUS
|
||||
HidParser_BuildCollectionContext(
|
||||
IN PHID_PARSER Parser,
|
||||
IN PHID_COLLECTION RootCollection,
|
||||
IN PVOID Context,
|
||||
IN ULONG ContextSize);
|
||||
|
|
Loading…
Reference in a new issue