2 * PROJECT: ReactOS HID Parser Library
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: lib/drivers/hidparser/hidparser.c
7 * Michael Martin (michael.martin@reactos.org)
8 * Johannes Anderwald (johannes.anderwald@reactos.org)
14 TranslateHidParserStatus(
15 IN HIDPARSER_STATUS Status
)
19 case HIDPARSER_STATUS_INSUFFICIENT_RESOURCES
:
20 return HIDP_STATUS_INTERNAL_ERROR
;
21 case HIDPARSER_STATUS_NOT_IMPLEMENTED
:
22 return HIDP_STATUS_NOT_IMPLEMENTED
;
23 case HIDPARSER_STATUS_REPORT_NOT_FOUND
:
24 return HIDP_STATUS_REPORT_DOES_NOT_EXIST
;
25 case HIDPARSER_STATUS_INVALID_REPORT_LENGTH
:
26 return HIDP_STATUS_INVALID_REPORT_LENGTH
;
27 case HIDPARSER_STATUS_INVALID_REPORT_TYPE
:
28 return HIDP_STATUS_INVALID_REPORT_TYPE
;
29 case HIDPARSER_STATUS_BUFFER_TOO_SMALL
:
30 return HIDP_STATUS_BUFFER_TOO_SMALL
;
31 case HIDPARSER_STATUS_USAGE_NOT_FOUND
:
32 return HIDP_STATUS_USAGE_NOT_FOUND
;
33 case HIDPARSER_STATUS_I8042_TRANS_UNKNOWN
:
34 return HIDP_STATUS_I8042_TRANS_UNKNOWN
;
35 case HIDPARSER_STATUS_COLLECTION_NOT_FOUND
:
36 return HIDP_STATUS_NOT_IMPLEMENTED
; //FIXME
38 DPRINT1("TranslateHidParserStatus Status %ld not implemented\n", Status
);
39 return HIDP_STATUS_NOT_IMPLEMENTED
;
44 HidParser_GetCollectionDescription(
45 IN PHID_PARSER Parser
,
46 IN PHIDP_REPORT_DESCRIPTOR ReportDesc
,
48 IN POOL_TYPE PoolType
,
49 OUT PHIDP_DEVICE_DESC DeviceDescription
)
51 HIDPARSER_STATUS ParserStatus
;
52 ULONG CollectionCount
;
56 // first parse the report descriptor
58 ParserStatus
= HidParser_ParseReportDescriptor(Parser
, ReportDesc
, DescLength
);
59 if (ParserStatus
!= HIDPARSER_STATUS_SUCCESS
)
62 // failed to parse report descriptor
64 Parser
->Debug("[HIDPARSER] Failed to parse report descriptor with %x\n", ParserStatus
);
65 return TranslateHidParserStatus(ParserStatus
);
69 // get collection count
71 CollectionCount
= HidParser_NumberOfTopCollections(Parser
);
72 if (CollectionCount
== 0)
75 // no top level collections found
78 return STATUS_NO_DATA_DETECTED
;
84 Parser
->Zero(DeviceDescription
, sizeof(HIDP_DEVICE_DESC
));
87 // allocate collection
89 DeviceDescription
->CollectionDesc
= (PHIDP_COLLECTION_DESC
)Parser
->Alloc(sizeof(HIDP_COLLECTION_DESC
) * CollectionCount
);
90 if (!DeviceDescription
->CollectionDesc
)
95 return STATUS_INSUFFICIENT_RESOURCES
;
99 // allocate report description
101 DeviceDescription
->ReportIDs
= (PHIDP_REPORT_IDS
)Parser
->Alloc(sizeof(HIDP_REPORT_IDS
) * CollectionCount
);
102 if (!DeviceDescription
->ReportIDs
)
107 Parser
->Free(DeviceDescription
->CollectionDesc
);
108 return STATUS_INSUFFICIENT_RESOURCES
;
111 for(Index
= 0; Index
< CollectionCount
; Index
++)
114 // init report description
116 DeviceDescription
->ReportIDs
[Index
].CollectionNumber
= Index
+ 1;
117 DeviceDescription
->ReportIDs
[Index
].ReportID
= Index
; //FIXME
118 DeviceDescription
->ReportIDs
[Index
].InputLength
= HidParser_GetReportLength(Parser
, Index
, HID_REPORT_TYPE_INPUT
);
119 DeviceDescription
->ReportIDs
[Index
].OutputLength
= HidParser_GetReportLength(Parser
, Index
, HID_REPORT_TYPE_OUTPUT
);
120 DeviceDescription
->ReportIDs
[Index
].FeatureLength
= HidParser_GetReportLength(Parser
, Index
, HID_REPORT_TYPE_FEATURE
);
123 // init collection description
125 DeviceDescription
->CollectionDesc
[Index
].CollectionNumber
= Index
+ 1;
128 // get collection usage page
130 ParserStatus
= HidParser_GetCollectionUsagePage(Parser
, Index
, &DeviceDescription
->CollectionDesc
[Index
].Usage
, &DeviceDescription
->CollectionDesc
[Index
].UsagePage
);
133 // windows seems to prepend the report id, regardless if it is required
135 DeviceDescription
->CollectionDesc
[Index
].InputLength
= (DeviceDescription
->ReportIDs
[Index
].InputLength
> 0 ? DeviceDescription
->ReportIDs
[Index
].InputLength
+ 1 : 0);
136 DeviceDescription
->CollectionDesc
[Index
].OutputLength
= (DeviceDescription
->ReportIDs
[Index
].OutputLength
> 0 ? DeviceDescription
->ReportIDs
[Index
].OutputLength
+ 1 : 0);
137 DeviceDescription
->CollectionDesc
[Index
].FeatureLength
= (DeviceDescription
->ReportIDs
[Index
].FeatureLength
> 0 ? DeviceDescription
->ReportIDs
[Index
].FeatureLength
+ 1 : 0);
140 // set preparsed data length
142 DeviceDescription
->CollectionDesc
[Index
].PreparsedDataLength
= HidParser_GetContextSize(Parser
, Index
);
143 DeviceDescription
->CollectionDesc
[Index
].PreparsedData
= Parser
->Alloc(DeviceDescription
->CollectionDesc
[Index
].PreparsedDataLength
);
144 if (!DeviceDescription
->CollectionDesc
[Index
].PreparsedData
)
149 return STATUS_INSUFFICIENT_RESOURCES
;
155 Parser
->Copy(DeviceDescription
->CollectionDesc
[Index
].PreparsedData
, Parser
->ParserContext
, DeviceDescription
->CollectionDesc
[Index
].PreparsedDataLength
);
159 // store collection & report count
161 DeviceDescription
->CollectionDescLength
= CollectionCount
;
162 DeviceDescription
->ReportIDsLength
= CollectionCount
;
167 return STATUS_SUCCESS
;
172 HidParser_FreeCollectionDescription(
173 IN PHID_PARSER Parser
,
174 IN PHIDP_DEVICE_DESC DeviceDescription
)
179 // first free all context
181 for(Index
= 0; Index
< DeviceDescription
->CollectionDescLength
; Index
++)
184 // free parser context
186 HidParser_FreeContext(Parser
, (PUCHAR
)DeviceDescription
->CollectionDesc
[Index
].PreparsedData
, DeviceDescription
->CollectionDesc
[Index
].PreparsedDataLength
);
190 // now free collection description
192 Parser
->Free(DeviceDescription
->CollectionDesc
);
195 // free report description
197 ExFreePool(DeviceDescription
->ReportIDs
);
204 IN PHID_PARSER Parser
,
205 OUT PHIDP_CAPS Capabilities
)
207 ULONG CollectionNumber
;
210 // get collection number from context
212 CollectionNumber
= HidParser_GetCollectionNumberFromParserContext(Parser
);
217 Parser
->Zero(Capabilities
, sizeof(HIDP_CAPS
));
222 HidParser_GetCollectionUsagePage(Parser
, CollectionNumber
, &Capabilities
->Usage
, &Capabilities
->UsagePage
);
223 Capabilities
->InputReportByteLength
= HidParser_GetReportLength(Parser
, CollectionNumber
, HID_REPORT_TYPE_INPUT
);
224 Capabilities
->OutputReportByteLength
= HidParser_GetReportLength(Parser
, CollectionNumber
, HID_REPORT_TYPE_OUTPUT
);
225 Capabilities
->FeatureReportByteLength
= HidParser_GetReportLength(Parser
, CollectionNumber
, HID_REPORT_TYPE_FEATURE
);
228 // always pre-prend report id
230 Capabilities
->InputReportByteLength
= (Capabilities
->InputReportByteLength
> 0 ? Capabilities
->InputReportByteLength
+ 1 : 0);
231 Capabilities
->OutputReportByteLength
= (Capabilities
->OutputReportByteLength
> 0 ? Capabilities
->OutputReportByteLength
+ 1 : 0);
232 Capabilities
->FeatureReportByteLength
= (Capabilities
->FeatureReportByteLength
> 0 ? Capabilities
->FeatureReportByteLength
+ 1 : 0);
235 // get number of link collection nodes
237 Capabilities
->NumberLinkCollectionNodes
= HidParser_GetTotalCollectionCount(Parser
, CollectionNumber
);
242 Capabilities
->NumberInputDataIndices
= HidParser_GetReportItemTypeCountFromReportType(Parser
, CollectionNumber
, HID_REPORT_TYPE_INPUT
, TRUE
);
243 Capabilities
->NumberOutputDataIndices
= HidParser_GetReportItemTypeCountFromReportType(Parser
, CollectionNumber
, HID_REPORT_TYPE_OUTPUT
, TRUE
);
244 Capabilities
->NumberFeatureDataIndices
= HidParser_GetReportItemTypeCountFromReportType(Parser
, CollectionNumber
, HID_REPORT_TYPE_FEATURE
, TRUE
);
249 Capabilities
->NumberInputValueCaps
= HidParser_GetReportItemTypeCountFromReportType(Parser
, CollectionNumber
, HID_REPORT_TYPE_INPUT
, FALSE
);
250 Capabilities
->NumberOutputValueCaps
= HidParser_GetReportItemTypeCountFromReportType(Parser
, CollectionNumber
, HID_REPORT_TYPE_OUTPUT
, FALSE
);
251 Capabilities
->NumberFeatureValueCaps
= HidParser_GetReportItemTypeCountFromReportType(Parser
, CollectionNumber
, HID_REPORT_TYPE_FEATURE
, FALSE
);
257 Capabilities
->NumberInputButtonCaps
= HidParser_GetReportItemCountFromReportType(Parser
, CollectionNumber
, HID_REPORT_TYPE_INPUT
);
258 Capabilities
->NumberOutputButtonCaps
= HidParser_GetReportItemCountFromReportType(Parser
, CollectionNumber
, HID_REPORT_TYPE_OUTPUT
);
259 Capabilities
->NumberFeatureButtonCaps
= HidParser_GetReportItemCountFromReportType(Parser
, CollectionNumber
, HID_REPORT_TYPE_FEATURE
);
264 return HIDP_STATUS_SUCCESS
;
270 HidParser_MaxUsageListLength(
271 IN PHID_PARSER Parser
,
272 IN HIDP_REPORT_TYPE ReportType
,
273 IN USAGE UsagePage OPTIONAL
)
275 ULONG CollectionNumber
;
278 // get collection number from context
280 CollectionNumber
= HidParser_GetCollectionNumberFromParserContext(Parser
);
284 // FIXME test what should be returned when usage page is not defined
286 if (UsagePage
== HID_USAGE_PAGE_UNDEFINED
)
299 if (ReportType
== HidP_Input
)
304 return HidParser_GetMaxUsageListLengthWithReportAndPage(Parser
, CollectionNumber
, HID_REPORT_TYPE_INPUT
, UsagePage
);
306 else if (ReportType
== HidP_Output
)
311 return HidParser_GetMaxUsageListLengthWithReportAndPage(Parser
, CollectionNumber
, HID_REPORT_TYPE_OUTPUT
, UsagePage
);
313 else if (ReportType
== HidP_Feature
)
318 return HidParser_GetMaxUsageListLengthWithReportAndPage(Parser
, CollectionNumber
, HID_REPORT_TYPE_FEATURE
, UsagePage
);
323 // invalid report type
329 #undef HidParser_GetButtonCaps
334 HidParser_GetButtonCaps(
335 IN PHID_PARSER Parser
,
336 IN HIDP_REPORT_TYPE ReportType
,
337 IN PHIDP_BUTTON_CAPS ButtonCaps
,
338 IN PUSHORT ButtonCapsLength
)
340 return HidParser_GetSpecificButtonCaps(Parser
, ReportType
, HID_USAGE_PAGE_UNDEFINED
, HIDP_LINK_COLLECTION_UNSPECIFIED
, HID_USAGE_PAGE_UNDEFINED
, ButtonCaps
, (PULONG
)ButtonCapsLength
);
346 HidParser_GetSpecificValueCaps(
347 IN PHID_PARSER Parser
,
348 IN HIDP_REPORT_TYPE ReportType
,
350 IN USHORT LinkCollection
,
352 OUT PHIDP_VALUE_CAPS ValueCaps
,
353 IN OUT PULONG ValueCapsLength
)
355 HIDPARSER_STATUS ParserStatus
;
356 ULONG CollectionNumber
;
359 // get collection number from context
361 CollectionNumber
= HidParser_GetCollectionNumberFromParserContext(Parser
);
366 // FIXME: implement searching in specific collection
368 ASSERT(LinkCollection
== HIDP_LINK_COLLECTION_UNSPECIFIED
);
370 if (ReportType
== HidP_Input
)
375 ParserStatus
= HidParser_GetSpecificValueCapsWithReport(Parser
, CollectionNumber
, HID_REPORT_TYPE_INPUT
, UsagePage
, Usage
, ValueCaps
, ValueCapsLength
);
377 else if (ReportType
== HidP_Output
)
382 ParserStatus
= HidParser_GetSpecificValueCapsWithReport(Parser
, CollectionNumber
, HID_REPORT_TYPE_OUTPUT
, UsagePage
, Usage
, ValueCaps
, ValueCapsLength
);
384 else if (ReportType
== HidP_Feature
)
389 ParserStatus
= HidParser_GetSpecificValueCapsWithReport(Parser
, CollectionNumber
, HID_REPORT_TYPE_FEATURE
, UsagePage
, Usage
, ValueCaps
, ValueCapsLength
);
394 // invalid report type
396 return HIDP_STATUS_INVALID_REPORT_TYPE
;
400 if (ParserStatus
== HIDPARSER_STATUS_SUCCESS
)
405 return HIDP_STATUS_SUCCESS
;
411 return TranslateHidParserStatus(ParserStatus
);
417 HidParser_UsageListDifference(
418 IN PUSAGE PreviousUsageList
,
419 IN PUSAGE CurrentUsageList
,
420 OUT PUSAGE BreakUsageList
,
421 OUT PUSAGE MakeUsageList
,
422 IN ULONG UsageListLength
)
424 ULONG Index
, SubIndex
, bFound
, BreakUsageIndex
= 0, MakeUsageIndex
= 0;
425 USAGE CurrentUsage
, Usage
;
432 /* get current usage */
433 CurrentUsage
= PreviousUsageList
[Index
];
435 /* is the end of list reached? */
439 /* start searching in current usage list */
444 /* get usage of current list */
445 Usage
= CurrentUsageList
[SubIndex
];
447 /* end of list reached? */
451 /* check if it matches the current one */
452 if (CurrentUsage
== Usage
)
459 /* move to next usage */
461 }while(SubIndex
< UsageListLength
);
463 /* was the usage found ?*/
466 /* store it in the break usage list */
467 BreakUsageList
[BreakUsageIndex
] = CurrentUsage
;
471 /* move to next usage */
474 }while(Index
< UsageListLength
);
476 /* now process the new items */
480 /* get current usage */
481 CurrentUsage
= CurrentUsageList
[Index
];
483 /* is the end of list reached? */
487 /* start searching in current usage list */
492 /* get usage of previous list */
493 Usage
= PreviousUsageList
[SubIndex
];
495 /* end of list reached? */
499 /* check if it matches the current one */
500 if (CurrentUsage
== Usage
)
507 /* move to next usage */
509 }while(SubIndex
< UsageListLength
);
511 /* was the usage found ?*/
514 /* store it in the make usage list */
515 MakeUsageList
[MakeUsageIndex
] = CurrentUsage
;
519 /* move to next usage */
522 }while(Index
< UsageListLength
);
525 /* does the break list contain empty entries */
526 if (BreakUsageIndex
< UsageListLength
)
528 /* zeroize entries */
529 RtlZeroMemory(&BreakUsageList
[BreakUsageIndex
], sizeof(USAGE
) * (UsageListLength
- BreakUsageIndex
));
532 /* does the make usage list contain empty entries */
533 if (MakeUsageIndex
< UsageListLength
)
535 /* zeroize entries */
536 RtlZeroMemory(&MakeUsageList
[MakeUsageIndex
], sizeof(USAGE
) * (UsageListLength
- MakeUsageIndex
));
540 return HIDP_STATUS_SUCCESS
;
547 IN PHID_PARSER Parser
,
548 IN HIDP_REPORT_TYPE ReportType
,
550 IN USHORT LinkCollection OPTIONAL
,
551 OUT USAGE
*UsageList
,
552 IN OUT PULONG UsageLength
,
554 IN ULONG ReportLength
)
556 HIDPARSER_STATUS ParserStatus
;
557 ULONG CollectionNumber
;
560 // get collection number from context
562 CollectionNumber
= HidParser_GetCollectionNumberFromParserContext(Parser
);
565 // FIXME: implement searching in specific collection
567 ASSERT(LinkCollection
== HIDP_LINK_COLLECTION_UNSPECIFIED
);
569 if (ReportType
== HidP_Input
)
574 ParserStatus
= HidParser_GetUsagesWithReport(Parser
, CollectionNumber
, HID_REPORT_TYPE_INPUT
, UsagePage
, UsageList
, UsageLength
, Report
, ReportLength
);
576 else if (ReportType
== HidP_Output
)
581 ParserStatus
= HidParser_GetUsagesWithReport(Parser
, CollectionNumber
, HID_REPORT_TYPE_OUTPUT
, UsagePage
, UsageList
, UsageLength
, Report
, ReportLength
);
583 else if (ReportType
== HidP_Feature
)
588 ParserStatus
= HidParser_GetUsagesWithReport(Parser
, CollectionNumber
, HID_REPORT_TYPE_FEATURE
, UsagePage
, UsageList
, UsageLength
, Report
, ReportLength
);
593 // invalid report type
595 return HIDP_STATUS_INVALID_REPORT_TYPE
;
598 if (ParserStatus
== HIDPARSER_STATUS_SUCCESS
)
603 return HIDP_STATUS_SUCCESS
;
609 return TranslateHidParserStatus(ParserStatus
);
615 HidParser_GetScaledUsageValue(
616 IN PHID_PARSER Parser
,
617 IN HIDP_REPORT_TYPE ReportType
,
619 IN USHORT LinkCollection OPTIONAL
,
621 OUT PLONG UsageValue
,
623 IN ULONG ReportLength
)
625 HIDPARSER_STATUS ParserStatus
;
626 ULONG CollectionNumber
;
629 // get collection number from context
631 CollectionNumber
= HidParser_GetCollectionNumberFromParserContext(Parser
);
634 // FIXME: implement searching in specific collection
636 ASSERT(LinkCollection
== HIDP_LINK_COLLECTION_UNSPECIFIED
);
638 if (ReportType
== HidP_Input
)
643 ParserStatus
= HidParser_GetScaledUsageValueWithReport(Parser
, CollectionNumber
, HID_REPORT_TYPE_INPUT
, UsagePage
, Usage
, UsageValue
, Report
, ReportLength
);
645 else if (ReportType
== HidP_Output
)
650 ParserStatus
= HidParser_GetScaledUsageValueWithReport(Parser
, CollectionNumber
, HID_REPORT_TYPE_OUTPUT
, UsagePage
, Usage
, UsageValue
, Report
, ReportLength
);
652 else if (ReportType
== HidP_Feature
)
657 ParserStatus
= HidParser_GetScaledUsageValueWithReport(Parser
, CollectionNumber
, HID_REPORT_TYPE_FEATURE
, UsagePage
, Usage
, UsageValue
, Report
, ReportLength
);
662 // invalid report type
664 return HIDP_STATUS_INVALID_REPORT_TYPE
;
667 if (ParserStatus
== HIDPARSER_STATUS_SUCCESS
)
672 return HIDP_STATUS_SUCCESS
;
678 return TranslateHidParserStatus(ParserStatus
);
684 HidParser_TranslateUsageAndPagesToI8042ScanCodes(
685 IN PHID_PARSER Parser
,
686 IN PUSAGE_AND_PAGE ChangedUsageList
,
687 IN ULONG UsageListLength
,
688 IN HIDP_KEYBOARD_DIRECTION KeyAction
,
689 IN OUT PHIDP_KEYBOARD_MODIFIER_STATE ModifierState
,
690 IN PHIDP_INSERT_SCANCODES InsertCodesProcedure
,
691 IN PVOID InsertCodesContext
)
694 HIDPARSER_STATUS Status
= HIDPARSER_STATUS_SUCCESS
;
695 ULONG CollectionNumber
;
698 // get collection number from context
700 CollectionNumber
= HidParser_GetCollectionNumberFromParserContext(Parser
);
702 for(Index
= 0; Index
< UsageListLength
; Index
++)
705 // check current usage
707 if (ChangedUsageList
[Index
].UsagePage
== HID_USAGE_PAGE_KEYBOARD
)
712 Status
= HidParser_TranslateUsage(Parser
, CollectionNumber
, ChangedUsageList
[Index
].Usage
, KeyAction
, ModifierState
, InsertCodesProcedure
, InsertCodesContext
);
714 else if (ChangedUsageList
[Index
].UsagePage
== HID_USAGE_PAGE_CONSUMER
)
717 // FIXME: implement me
720 Status
= HIDPARSER_STATUS_NOT_IMPLEMENTED
;
727 DPRINT1("[HIDPARSE] Error unexpected usage page %x\n", ChangedUsageList
[Index
].UsagePage
);
728 return HIDP_STATUS_I8042_TRANS_UNKNOWN
;
734 if (Status
!= HIDPARSER_STATUS_SUCCESS
)
739 return TranslateHidParserStatus(Status
);
743 if (Status
!= HIDPARSER_STATUS_SUCCESS
)
748 return TranslateHidParserStatus(Status
);
754 return HIDP_STATUS_SUCCESS
;
761 HidParser_GetUsagesEx(
762 IN PHID_PARSER Parser
,
763 IN HIDP_REPORT_TYPE ReportType
,
764 IN USHORT LinkCollection
,
765 OUT PUSAGE_AND_PAGE ButtonList
,
766 IN OUT ULONG
*UsageLength
,
768 IN ULONG ReportLength
)
770 return HidParser_GetUsages(Parser
, ReportType
, HID_USAGE_PAGE_UNDEFINED
, LinkCollection
, (PUSAGE
)ButtonList
, UsageLength
, Report
, ReportLength
);
776 HidParser_UsageAndPageListDifference(
777 IN PUSAGE_AND_PAGE PreviousUsageList
,
778 IN PUSAGE_AND_PAGE CurrentUsageList
,
779 OUT PUSAGE_AND_PAGE BreakUsageList
,
780 OUT PUSAGE_AND_PAGE MakeUsageList
,
781 IN ULONG UsageListLength
)
783 ULONG Index
, SubIndex
, BreakUsageListIndex
= 0, MakeUsageListIndex
= 0, bFound
;
784 PUSAGE_AND_PAGE CurrentUsage
, Usage
;
788 /* process removed usages */
792 /* get usage from current index */
793 CurrentUsage
= &PreviousUsageList
[Index
];
795 /* end of list reached? */
796 if (CurrentUsage
->Usage
== 0 && CurrentUsage
->UsagePage
== 0)
799 /* search in current list */
805 Usage
= &CurrentUsageList
[SubIndex
];
807 /* end of list reached? */
808 if (Usage
->Usage
== 0 && Usage
->UsagePage
== 0)
812 if (Usage
->Usage
== CurrentUsage
->Usage
&& Usage
->UsagePage
== CurrentUsage
->UsagePage
)
818 /* move to next index */
821 }while(SubIndex
< UsageListLength
);
825 /* store it in break usage list */
826 BreakUsageList
[BreakUsageListIndex
].Usage
= CurrentUsage
->Usage
;
827 BreakUsageList
[BreakUsageListIndex
].UsagePage
= CurrentUsage
->UsagePage
;
828 BreakUsageListIndex
++;
831 /* move to next index */
834 }while(Index
< UsageListLength
);
836 /* process new usages */
840 /* get usage from current index */
841 CurrentUsage
= &CurrentUsageList
[Index
];
843 /* end of list reached? */
844 if (CurrentUsage
->Usage
== 0 && CurrentUsage
->UsagePage
== 0)
847 /* search in current list */
853 Usage
= &PreviousUsageList
[SubIndex
];
855 /* end of list reached? */
856 if (Usage
->Usage
== 0 && Usage
->UsagePage
== 0)
860 if (Usage
->Usage
== CurrentUsage
->Usage
&& Usage
->UsagePage
== CurrentUsage
->UsagePage
)
866 /* move to next index */
869 }while(SubIndex
< UsageListLength
);
873 /* store it in break usage list */
874 MakeUsageList
[MakeUsageListIndex
].Usage
= CurrentUsage
->Usage
;
875 MakeUsageList
[MakeUsageListIndex
].UsagePage
= CurrentUsage
->UsagePage
;
876 MakeUsageListIndex
++;
879 /* move to next index */
881 }while(Index
< UsageListLength
);
884 /* are there remaining free list entries */
885 if (BreakUsageListIndex
< UsageListLength
)
888 RtlZeroMemory(&BreakUsageList
[BreakUsageListIndex
], (UsageListLength
- BreakUsageListIndex
) * sizeof(USAGE_AND_PAGE
));
891 /* are there remaining free list entries */
892 if (MakeUsageListIndex
< UsageListLength
)
895 RtlZeroMemory(&MakeUsageList
[MakeUsageListIndex
], (UsageListLength
- MakeUsageListIndex
) * sizeof(USAGE_AND_PAGE
));
899 return HIDP_STATUS_SUCCESS
;
905 HidParser_GetSpecificButtonCaps(
906 IN PHID_PARSER Parser
,
907 IN HIDP_REPORT_TYPE ReportType
,
909 IN USHORT LinkCollection
,
911 OUT PHIDP_BUTTON_CAPS ButtonCaps
,
912 IN OUT PULONG ButtonCapsLength
)
916 return STATUS_NOT_IMPLEMENTED
;
924 IN PHID_PARSER Parser
,
925 IN HIDP_REPORT_TYPE ReportType
,
926 OUT PHIDP_DATA DataList
,
927 IN OUT PULONG DataLength
,
929 IN ULONG ReportLength
)
933 return STATUS_NOT_IMPLEMENTED
;
939 HidParser_GetExtendedAttributes(
940 IN PHID_PARSER Parser
,
941 IN HIDP_REPORT_TYPE ReportType
,
943 OUT PHIDP_EXTENDED_ATTRIBUTES Attributes
,
944 IN OUT PULONG LengthAttributes
)
948 return STATUS_NOT_IMPLEMENTED
;
954 HidParser_GetLinkCollectionNodes(
955 IN PHID_PARSER Parser
,
956 OUT PHIDP_LINK_COLLECTION_NODE LinkCollectionNodes
,
957 IN OUT PULONG LinkCollectionNodesLength
)
961 return STATUS_NOT_IMPLEMENTED
;
967 HidParser_GetUsageValue(
968 IN PHID_PARSER Parser
,
969 IN HIDP_REPORT_TYPE ReportType
,
971 IN USHORT LinkCollection
,
973 OUT PULONG UsageValue
,
975 IN ULONG ReportLength
)
979 return STATUS_NOT_IMPLEMENTED
;
984 HidParser_SysPowerEvent(
985 IN PHID_PARSER Parser
,
987 IN USHORT HidPacketLength
,
988 OUT PULONG OutputBuffer
)
992 return STATUS_NOT_IMPLEMENTED
;
997 HidParser_SysPowerCaps (
998 IN PHID_PARSER Parser
,
999 OUT PULONG OutputBuffer
)
1003 return STATUS_NOT_IMPLEMENTED
;
1009 HidParser_GetUsageValueArray(
1010 IN PHID_PARSER Parser
,
1011 IN HIDP_REPORT_TYPE ReportType
,
1013 IN USHORT LinkCollection OPTIONAL
,
1015 OUT PCHAR UsageValue
,
1016 IN USHORT UsageValueByteLength
,
1018 IN ULONG ReportLength
)
1022 return STATUS_NOT_IMPLEMENTED
;
1028 HidParser_UnsetUsages(
1029 IN PHID_PARSER Parser
,
1030 IN HIDP_REPORT_TYPE ReportType
,
1032 IN USHORT LinkCollection
,
1033 IN PUSAGE UsageList
,
1034 IN OUT PULONG UsageLength
,
1035 IN OUT PCHAR Report
,
1036 IN ULONG ReportLength
)
1040 return STATUS_NOT_IMPLEMENTED
;
1046 HidParser_TranslateUsagesToI8042ScanCodes(
1047 IN PUSAGE ChangedUsageList
,
1048 IN ULONG UsageListLength
,
1049 IN HIDP_KEYBOARD_DIRECTION KeyAction
,
1050 IN OUT PHIDP_KEYBOARD_MODIFIER_STATE ModifierState
,
1051 IN PHIDP_INSERT_SCANCODES InsertCodesProcedure
,
1052 IN PVOID InsertCodesContext
)
1056 return STATUS_NOT_IMPLEMENTED
;
1062 HidParser_SetUsages(
1063 IN PHID_PARSER Parser
,
1064 IN HIDP_REPORT_TYPE ReportType
,
1066 IN USHORT LinkCollection
,
1067 IN PUSAGE UsageList
,
1068 IN OUT PULONG UsageLength
,
1069 IN OUT PCHAR Report
,
1070 IN ULONG ReportLength
)
1074 return STATUS_NOT_IMPLEMENTED
;
1080 HidParser_SetUsageValueArray(
1081 IN PHID_PARSER Parser
,
1082 IN HIDP_REPORT_TYPE ReportType
,
1084 IN USHORT LinkCollection OPTIONAL
,
1086 IN PCHAR UsageValue
,
1087 IN USHORT UsageValueByteLength
,
1089 IN ULONG ReportLength
)
1093 return STATUS_NOT_IMPLEMENTED
;
1099 HidParser_SetUsageValue(
1100 IN PHID_PARSER Parser
,
1101 IN HIDP_REPORT_TYPE ReportType
,
1103 IN USHORT LinkCollection
,
1105 IN ULONG UsageValue
,
1106 IN OUT PCHAR Report
,
1107 IN ULONG ReportLength
)
1111 return STATUS_NOT_IMPLEMENTED
;
1117 HidParser_SetScaledUsageValue(
1118 IN PHID_PARSER Parser
,
1119 IN HIDP_REPORT_TYPE ReportType
,
1121 IN USHORT LinkCollection OPTIONAL
,
1124 IN OUT PCHAR Report
,
1125 IN ULONG ReportLength
)
1129 return STATUS_NOT_IMPLEMENTED
;
1136 IN PHID_PARSER Parser
,
1137 IN HIDP_REPORT_TYPE ReportType
,
1138 IN PHIDP_DATA DataList
,
1139 IN OUT PULONG DataLength
,
1140 IN OUT PCHAR Report
,
1141 IN ULONG ReportLength
)
1145 return STATUS_NOT_IMPLEMENTED
;
1151 HidParser_MaxDataListLength(
1152 IN PHID_PARSER Parser
,
1153 IN HIDP_REPORT_TYPE ReportType
)
1157 return STATUS_NOT_IMPLEMENTED
;
1163 HidParser_InitializeReportForID(
1164 IN PHID_PARSER Parser
,
1165 IN HIDP_REPORT_TYPE ReportType
,
1167 IN OUT PCHAR Report
,
1168 IN ULONG ReportLength
)
1172 return STATUS_NOT_IMPLEMENTED
;
1175 #undef HidParser_GetValueCaps
1180 HidParser_GetValueCaps(
1181 IN PHID_PARSER Parser
,
1182 HIDP_REPORT_TYPE ReportType
,
1183 PHIDP_VALUE_CAPS ValueCaps
,
1184 PULONG ValueCapsLength
)
1188 return STATUS_NOT_IMPLEMENTED
;