xref: /reactos/sdk/lib/drivers/hidparser/hidparser.c (revision c4055c45)
1c2c66affSColin Finck /*
2c2c66affSColin Finck  * PROJECT:     ReactOS HID Parser Library
3c2c66affSColin Finck  * LICENSE:     GPL - See COPYING in the top level directory
4c2c66affSColin Finck  * FILE:        lib/drivers/hidparser/hidparser.c
5c2c66affSColin Finck  * PURPOSE:     HID Parser
6c2c66affSColin Finck  * PROGRAMMERS:
7c2c66affSColin Finck  *              Michael Martin (michael.martin@reactos.org)
8c2c66affSColin Finck  *              Johannes Anderwald (johannes.anderwald@reactos.org)
9c2c66affSColin Finck  */
10c2c66affSColin Finck 
11c2c66affSColin Finck #include "parser.h"
12c2c66affSColin Finck 
13c2c66affSColin Finck #define NDEBUG
14c2c66affSColin Finck #include <debug.h>
15c2c66affSColin Finck 
16c2c66affSColin Finck NTSTATUS
17c2c66affSColin Finck NTAPI
HidParser_GetCollectionDescription(IN PHIDP_REPORT_DESCRIPTOR ReportDesc,IN ULONG DescLength,IN POOL_TYPE PoolType,OUT PHIDP_DEVICE_DESC DeviceDescription)18c2c66affSColin Finck HidParser_GetCollectionDescription(
19c2c66affSColin Finck     IN PHIDP_REPORT_DESCRIPTOR ReportDesc,
20c2c66affSColin Finck     IN ULONG DescLength,
21c2c66affSColin Finck     IN POOL_TYPE PoolType,
22c2c66affSColin Finck     OUT PHIDP_DEVICE_DESC DeviceDescription)
23c2c66affSColin Finck {
24*c4055c45SHervé Poussineau     NTSTATUS ParserStatus;
25c2c66affSColin Finck     ULONG CollectionCount;
26c2c66affSColin Finck     ULONG Index;
27c2c66affSColin Finck     PVOID ParserContext;
28c2c66affSColin Finck 
29c2c66affSColin Finck     //
30c2c66affSColin Finck     // first parse the report descriptor
31c2c66affSColin Finck     //
32c151f8a1SHervé Poussineau     ParserStatus = HidParser_ParseReportDescriptor(ReportDesc, DescLength, &ParserContext);
33*c4055c45SHervé Poussineau     if (ParserStatus != HIDP_STATUS_SUCCESS)
34c2c66affSColin Finck     {
35c2c66affSColin Finck         //
36c2c66affSColin Finck         // failed to parse report descriptor
37c2c66affSColin Finck         //
38c151f8a1SHervé Poussineau         DebugFunction("[HIDPARSER] Failed to parse report descriptor with %x\n", ParserStatus);
39c2c66affSColin Finck         return ParserStatus;
40c2c66affSColin Finck     }
41c2c66affSColin Finck 
42c2c66affSColin Finck     //
43c2c66affSColin Finck     // get collection count
44c2c66affSColin Finck     //
45c2c66affSColin Finck     CollectionCount = HidParser_NumberOfTopCollections(ParserContext);
46c2c66affSColin Finck     if (CollectionCount == 0)
47c2c66affSColin Finck     {
48c2c66affSColin Finck         //
49c2c66affSColin Finck         // no top level collections found
50c2c66affSColin Finck         //
51c2c66affSColin Finck         ASSERT(FALSE);
52c2c66affSColin Finck         return STATUS_NO_DATA_DETECTED;
53c2c66affSColin Finck     }
54c2c66affSColin Finck 
55c2c66affSColin Finck     //
56c2c66affSColin Finck     // zero description
57c2c66affSColin Finck     //
58c151f8a1SHervé Poussineau     ZeroFunction(DeviceDescription, sizeof(HIDP_DEVICE_DESC));
59c2c66affSColin Finck 
60c2c66affSColin Finck     //
61c2c66affSColin Finck     // allocate collection
62c2c66affSColin Finck     //
63c151f8a1SHervé Poussineau     DeviceDescription->CollectionDesc = (PHIDP_COLLECTION_DESC)AllocFunction(sizeof(HIDP_COLLECTION_DESC) * CollectionCount);
64c2c66affSColin Finck     if (!DeviceDescription->CollectionDesc)
65c2c66affSColin Finck     {
66c2c66affSColin Finck         //
67c2c66affSColin Finck         // no memory
68c2c66affSColin Finck         //
69c2c66affSColin Finck         return STATUS_INSUFFICIENT_RESOURCES;
70c2c66affSColin Finck     }
71c2c66affSColin Finck 
72c2c66affSColin Finck     //
73c2c66affSColin Finck     // allocate report description
74c2c66affSColin Finck     //
75c151f8a1SHervé Poussineau     DeviceDescription->ReportIDs = (PHIDP_REPORT_IDS)AllocFunction(sizeof(HIDP_REPORT_IDS) * CollectionCount);
76c2c66affSColin Finck     if (!DeviceDescription->ReportIDs)
77c2c66affSColin Finck     {
78c2c66affSColin Finck         //
79c2c66affSColin Finck         // no memory
80c2c66affSColin Finck         //
81c151f8a1SHervé Poussineau         FreeFunction(DeviceDescription->CollectionDesc);
82c2c66affSColin Finck         return STATUS_INSUFFICIENT_RESOURCES;
83c2c66affSColin Finck     }
84c2c66affSColin Finck 
85c2c66affSColin Finck     for(Index = 0; Index < CollectionCount; Index++)
86c2c66affSColin Finck     {
87c2c66affSColin Finck         //
88c2c66affSColin Finck         // set preparsed data length
89c2c66affSColin Finck         //
90c151f8a1SHervé Poussineau         DeviceDescription->CollectionDesc[Index].PreparsedDataLength = HidParser_GetContextSize(ParserContext, Index);
91c151f8a1SHervé Poussineau         ParserStatus = HidParser_BuildContext(ParserContext, Index, DeviceDescription->CollectionDesc[Index].PreparsedDataLength, (PVOID*)&DeviceDescription->CollectionDesc[Index].PreparsedData);
92*c4055c45SHervé Poussineau         if (ParserStatus != HIDP_STATUS_SUCCESS)
93c2c66affSColin Finck         {
94c2c66affSColin Finck             //
95c2c66affSColin Finck             // no memory
96c2c66affSColin Finck             //
97c151f8a1SHervé Poussineau             FreeFunction(DeviceDescription->CollectionDesc);
98c151f8a1SHervé Poussineau             FreeFunction(DeviceDescription->ReportIDs);
99c2c66affSColin Finck             return ParserStatus;
100c2c66affSColin Finck         }
101c2c66affSColin Finck 
102c2c66affSColin Finck         //
103c2c66affSColin Finck         // init report description
104c2c66affSColin Finck         //
105c2c66affSColin Finck         DeviceDescription->ReportIDs[Index].CollectionNumber = Index + 1;
106c2c66affSColin Finck         DeviceDescription->ReportIDs[Index].ReportID = Index; //FIXME
107c2c66affSColin Finck         DeviceDescription->ReportIDs[Index].InputLength = HidParser_GetReportLength((PVOID)DeviceDescription->CollectionDesc[Index].PreparsedData, HID_REPORT_TYPE_INPUT);
108c2c66affSColin Finck         DeviceDescription->ReportIDs[Index].OutputLength = HidParser_GetReportLength((PVOID)DeviceDescription->CollectionDesc[Index].PreparsedData, HID_REPORT_TYPE_OUTPUT);
109c2c66affSColin Finck         DeviceDescription->ReportIDs[Index].FeatureLength = HidParser_GetReportLength((PVOID)DeviceDescription->CollectionDesc[Index].PreparsedData, HID_REPORT_TYPE_FEATURE);
110c2c66affSColin Finck 
111c2c66affSColin Finck 
112c2c66affSColin Finck         DeviceDescription->ReportIDs[Index].InputLength += (HidParser_UsesReportId((PVOID)DeviceDescription->CollectionDesc[Index].PreparsedData, HID_REPORT_TYPE_INPUT) ? 1 : 0);
113c2c66affSColin Finck         DeviceDescription->ReportIDs[Index].OutputLength += (HidParser_UsesReportId((PVOID)DeviceDescription->CollectionDesc[Index].PreparsedData, HID_REPORT_TYPE_OUTPUT) ? 1 : 0);
114c2c66affSColin Finck         DeviceDescription->ReportIDs[Index].FeatureLength += (HidParser_UsesReportId((PVOID)DeviceDescription->CollectionDesc[Index].PreparsedData, HID_REPORT_TYPE_FEATURE) ? 1 : 0);
115c2c66affSColin Finck 
116c2c66affSColin Finck 
117c2c66affSColin Finck         //
118c2c66affSColin Finck         // init collection description
119c2c66affSColin Finck         //
120c2c66affSColin Finck         DeviceDescription->CollectionDesc[Index].CollectionNumber = Index + 1;
121c2c66affSColin Finck 
122c2c66affSColin Finck         //
123c2c66affSColin Finck         // get collection usage page
124c2c66affSColin Finck         //
125c2c66affSColin Finck         ParserStatus = HidParser_GetCollectionUsagePage((PVOID)DeviceDescription->CollectionDesc[Index].PreparsedData, &DeviceDescription->CollectionDesc[Index].Usage, &DeviceDescription->CollectionDesc[Index].UsagePage);
126*c4055c45SHervé Poussineau         if (ParserStatus != HIDP_STATUS_SUCCESS)
127c2c66affSColin Finck         {
128c2c66affSColin Finck             // collection not found
129c151f8a1SHervé Poussineau             FreeFunction(DeviceDescription->CollectionDesc);
130c151f8a1SHervé Poussineau             FreeFunction(DeviceDescription->ReportIDs);
131c2c66affSColin Finck             return ParserStatus;
132c2c66affSColin Finck         }
133c2c66affSColin Finck 
134c2c66affSColin Finck         //
135c2c66affSColin Finck         // windows seems to prepend the report id, regardless if it is required
136c2c66affSColin Finck         //
137c2c66affSColin Finck         DeviceDescription->CollectionDesc[Index].CollectionNumber = Index + 1;
138c2c66affSColin Finck         DeviceDescription->CollectionDesc[Index].InputLength = DeviceDescription->ReportIDs[Index].InputLength;
139c2c66affSColin Finck         DeviceDescription->CollectionDesc[Index].OutputLength = DeviceDescription->ReportIDs[Index].OutputLength;
140c2c66affSColin Finck         DeviceDescription->CollectionDesc[Index].FeatureLength = DeviceDescription->ReportIDs[Index].FeatureLength;
141c2c66affSColin Finck 
142c2c66affSColin Finck         DeviceDescription->CollectionDesc[Index].InputLength += (HidParser_UsesReportId((PVOID)DeviceDescription->CollectionDesc[Index].PreparsedData, HID_REPORT_TYPE_INPUT) == FALSE ? 1 : 0);
143c2c66affSColin Finck         DeviceDescription->CollectionDesc[Index].OutputLength += (HidParser_UsesReportId((PVOID)DeviceDescription->CollectionDesc[Index].PreparsedData, HID_REPORT_TYPE_OUTPUT) == FALSE ? 1 : 0);
144c2c66affSColin Finck         DeviceDescription->CollectionDesc[Index].FeatureLength += (HidParser_UsesReportId((PVOID)DeviceDescription->CollectionDesc[Index].PreparsedData, HID_REPORT_TYPE_FEATURE) == FALSE ? 1 : 0);
145c2c66affSColin Finck 
146c2c66affSColin Finck 
147c2c66affSColin Finck     }
148c2c66affSColin Finck 
149c2c66affSColin Finck     //
150c2c66affSColin Finck     // store collection & report count
151c2c66affSColin Finck     //
152c2c66affSColin Finck     DeviceDescription->CollectionDescLength = CollectionCount;
153c2c66affSColin Finck     DeviceDescription->ReportIDsLength = CollectionCount;
154c2c66affSColin Finck 
155c2c66affSColin Finck     //
156c2c66affSColin Finck     // done
157c2c66affSColin Finck     //
158c2c66affSColin Finck     return STATUS_SUCCESS;
159c2c66affSColin Finck }
160c2c66affSColin Finck 
161c2c66affSColin Finck VOID
162c2c66affSColin Finck NTAPI
HidParser_FreeCollectionDescription(IN PHIDP_DEVICE_DESC DeviceDescription)163c2c66affSColin Finck HidParser_FreeCollectionDescription(
164c2c66affSColin Finck     IN PHIDP_DEVICE_DESC   DeviceDescription)
165c2c66affSColin Finck {
166c2c66affSColin Finck     ULONG Index;
167c2c66affSColin Finck 
168c2c66affSColin Finck     //
169c2c66affSColin Finck     // first free all context
170c2c66affSColin Finck     //
171c2c66affSColin Finck     for(Index = 0; Index < DeviceDescription->CollectionDescLength; Index++)
172c2c66affSColin Finck     {
173c2c66affSColin Finck         //
174c2c66affSColin Finck         // free collection context
175c2c66affSColin Finck         //
176c151f8a1SHervé Poussineau         FreeFunction(DeviceDescription->CollectionDesc[Index].PreparsedData);
177c2c66affSColin Finck     }
178c2c66affSColin Finck 
179c2c66affSColin Finck     //
180c2c66affSColin Finck     // now free collection description
181c2c66affSColin Finck     //
182c151f8a1SHervé Poussineau     FreeFunction(DeviceDescription->CollectionDesc);
183c2c66affSColin Finck 
184c2c66affSColin Finck     //
185c2c66affSColin Finck     // free report description
186c2c66affSColin Finck     //
187c151f8a1SHervé Poussineau     FreeFunction(DeviceDescription->ReportIDs);
188c2c66affSColin Finck }
189c2c66affSColin Finck 
190c2c66affSColin Finck HIDAPI
191c2c66affSColin Finck NTSTATUS
192c2c66affSColin Finck NTAPI
HidParser_GetCaps(IN PVOID CollectionContext,OUT PHIDP_CAPS Capabilities)193c2c66affSColin Finck HidParser_GetCaps(
194c2c66affSColin Finck     IN PVOID CollectionContext,
195c2c66affSColin Finck     OUT PHIDP_CAPS  Capabilities)
196c2c66affSColin Finck {
197c2c66affSColin Finck     //
198c2c66affSColin Finck     // zero capabilities
199c2c66affSColin Finck     //
200c151f8a1SHervé Poussineau     ZeroFunction(Capabilities, sizeof(HIDP_CAPS));
201c2c66affSColin Finck 
202c2c66affSColin Finck     //
203c2c66affSColin Finck     // init capabilities
204c2c66affSColin Finck     //
205c2c66affSColin Finck     HidParser_GetCollectionUsagePage(CollectionContext, &Capabilities->Usage, &Capabilities->UsagePage);
206c2c66affSColin Finck     Capabilities->InputReportByteLength = HidParser_GetReportLength(CollectionContext, HID_REPORT_TYPE_INPUT);
207c2c66affSColin Finck     Capabilities->OutputReportByteLength = HidParser_GetReportLength(CollectionContext, HID_REPORT_TYPE_OUTPUT);
208c2c66affSColin Finck     Capabilities->FeatureReportByteLength = HidParser_GetReportLength(CollectionContext, HID_REPORT_TYPE_FEATURE);
209c2c66affSColin Finck 
210c2c66affSColin Finck     //
211c2c66affSColin Finck     // always pre-prend report id
212c2c66affSColin Finck     //
213c2c66affSColin Finck     Capabilities->InputReportByteLength = (Capabilities->InputReportByteLength > 0 ? Capabilities->InputReportByteLength + 1 : 0);
214c2c66affSColin Finck     Capabilities->OutputReportByteLength = (Capabilities->OutputReportByteLength > 0 ? Capabilities->OutputReportByteLength + 1 : 0);
215c2c66affSColin Finck     Capabilities->FeatureReportByteLength = (Capabilities->FeatureReportByteLength > 0 ? Capabilities->FeatureReportByteLength + 1 : 0);
216c2c66affSColin Finck 
217c2c66affSColin Finck     //
218c2c66affSColin Finck     // get number of link collection nodes
219c2c66affSColin Finck     //
220c2c66affSColin Finck     Capabilities->NumberLinkCollectionNodes = HidParser_GetTotalCollectionCount(CollectionContext);
221c2c66affSColin Finck 
222c2c66affSColin Finck     //
223c2c66affSColin Finck     // get data indices
224c2c66affSColin Finck     //
225c2c66affSColin Finck     Capabilities->NumberInputDataIndices = HidParser_GetReportItemTypeCountFromReportType(CollectionContext, HID_REPORT_TYPE_INPUT, TRUE);
226c2c66affSColin Finck     Capabilities->NumberOutputDataIndices = HidParser_GetReportItemTypeCountFromReportType(CollectionContext, HID_REPORT_TYPE_OUTPUT, TRUE);
227c2c66affSColin Finck     Capabilities->NumberFeatureDataIndices = HidParser_GetReportItemTypeCountFromReportType(CollectionContext, HID_REPORT_TYPE_FEATURE, TRUE);
228c2c66affSColin Finck 
229c2c66affSColin Finck     //
230c2c66affSColin Finck     // get value caps
231c2c66affSColin Finck     //
232c2c66affSColin Finck     Capabilities->NumberInputValueCaps = HidParser_GetReportItemTypeCountFromReportType(CollectionContext, HID_REPORT_TYPE_INPUT, FALSE);
233c2c66affSColin Finck     Capabilities->NumberOutputValueCaps = HidParser_GetReportItemTypeCountFromReportType(CollectionContext, HID_REPORT_TYPE_OUTPUT, FALSE);
234c2c66affSColin Finck     Capabilities->NumberFeatureValueCaps = HidParser_GetReportItemTypeCountFromReportType(CollectionContext, HID_REPORT_TYPE_FEATURE, FALSE);
235c2c66affSColin Finck 
236c2c66affSColin Finck 
237c2c66affSColin Finck     //
238c2c66affSColin Finck     // get button caps
239c2c66affSColin Finck     //
240c2c66affSColin Finck     Capabilities->NumberInputButtonCaps = HidParser_GetReportItemCountFromReportType(CollectionContext, HID_REPORT_TYPE_INPUT);
241c2c66affSColin Finck     Capabilities->NumberOutputButtonCaps = HidParser_GetReportItemCountFromReportType(CollectionContext, HID_REPORT_TYPE_OUTPUT);
242c2c66affSColin Finck     Capabilities->NumberFeatureButtonCaps = HidParser_GetReportItemCountFromReportType(CollectionContext, HID_REPORT_TYPE_FEATURE);
243c2c66affSColin Finck 
244c2c66affSColin Finck     //
245c2c66affSColin Finck     // done
246c2c66affSColin Finck     //
247c2c66affSColin Finck     return HIDP_STATUS_SUCCESS;
248c2c66affSColin Finck }
249c2c66affSColin Finck 
250c2c66affSColin Finck HIDAPI
251c2c66affSColin Finck ULONG
252c2c66affSColin Finck NTAPI
HidParser_MaxUsageListLength(IN PVOID CollectionContext,IN HIDP_REPORT_TYPE ReportType,IN USAGE UsagePage OPTIONAL)253c2c66affSColin Finck HidParser_MaxUsageListLength(
254c2c66affSColin Finck     IN PVOID CollectionContext,
255c2c66affSColin Finck     IN HIDP_REPORT_TYPE  ReportType,
256c2c66affSColin Finck     IN USAGE  UsagePage  OPTIONAL)
257c2c66affSColin Finck {
258c2c66affSColin Finck     //
259c2c66affSColin Finck     // FIXME test what should be returned when usage page is not defined
260c2c66affSColin Finck     //
261c2c66affSColin Finck     if (UsagePage == HID_USAGE_PAGE_UNDEFINED)
262c2c66affSColin Finck     {
263c2c66affSColin Finck         //
264c2c66affSColin Finck         // implement me
265c2c66affSColin Finck         //
266c2c66affSColin Finck         UNIMPLEMENTED;
267c2c66affSColin Finck 
268c2c66affSColin Finck         //
269c2c66affSColin Finck         // invalid report
270c2c66affSColin Finck         //
271c2c66affSColin Finck         return 0;
272c2c66affSColin Finck     }
273c2c66affSColin Finck 
274c2c66affSColin Finck     if (ReportType == HidP_Input)
275c2c66affSColin Finck     {
276c2c66affSColin Finck         //
277c2c66affSColin Finck         // input report
278c2c66affSColin Finck         //
279c2c66affSColin Finck         return HidParser_GetMaxUsageListLengthWithReportAndPage(CollectionContext, HID_REPORT_TYPE_INPUT, UsagePage);
280c2c66affSColin Finck     }
281c2c66affSColin Finck     else if (ReportType == HidP_Output)
282c2c66affSColin Finck     {
283c2c66affSColin Finck         //
284c2c66affSColin Finck         // input report
285c2c66affSColin Finck         //
286c2c66affSColin Finck         return HidParser_GetMaxUsageListLengthWithReportAndPage(CollectionContext, HID_REPORT_TYPE_OUTPUT, UsagePage);
287c2c66affSColin Finck     }
288c2c66affSColin Finck     else if (ReportType == HidP_Feature)
289c2c66affSColin Finck     {
290c2c66affSColin Finck         //
291c2c66affSColin Finck         // input report
292c2c66affSColin Finck         //
293c2c66affSColin Finck         return HidParser_GetMaxUsageListLengthWithReportAndPage(CollectionContext, HID_REPORT_TYPE_FEATURE, UsagePage);
294c2c66affSColin Finck     }
295c2c66affSColin Finck     else
296c2c66affSColin Finck     {
297c2c66affSColin Finck         //
298c2c66affSColin Finck         // invalid report type
299c2c66affSColin Finck         //
300c2c66affSColin Finck         return 0;
301c2c66affSColin Finck     }
302c2c66affSColin Finck }
303c2c66affSColin Finck 
304c2c66affSColin Finck #undef HidParser_GetButtonCaps
305c2c66affSColin Finck 
306c2c66affSColin Finck HIDAPI
307c2c66affSColin Finck NTSTATUS
308c2c66affSColin Finck NTAPI
HidParser_GetButtonCaps(IN PVOID CollectionContext,IN HIDP_REPORT_TYPE ReportType,IN PHIDP_BUTTON_CAPS ButtonCaps,IN PUSHORT ButtonCapsLength)309c2c66affSColin Finck HidParser_GetButtonCaps(
310c2c66affSColin Finck     IN PVOID CollectionContext,
311c2c66affSColin Finck     IN HIDP_REPORT_TYPE ReportType,
312c2c66affSColin Finck     IN PHIDP_BUTTON_CAPS ButtonCaps,
313c2c66affSColin Finck     IN PUSHORT ButtonCapsLength)
314c2c66affSColin Finck {
315c151f8a1SHervé Poussineau     return HidParser_GetSpecificButtonCaps(CollectionContext, ReportType, HID_USAGE_PAGE_UNDEFINED, HIDP_LINK_COLLECTION_UNSPECIFIED, HID_USAGE_PAGE_UNDEFINED, ButtonCaps, (PULONG)ButtonCapsLength);
316c2c66affSColin Finck }
317c2c66affSColin Finck 
318c2c66affSColin Finck HIDAPI
319c2c66affSColin Finck NTSTATUS
320c2c66affSColin Finck NTAPI
HidParser_GetSpecificValueCaps(IN PVOID CollectionContext,IN HIDP_REPORT_TYPE ReportType,IN USAGE UsagePage,IN USHORT LinkCollection,IN USAGE Usage,OUT PHIDP_VALUE_CAPS ValueCaps,IN OUT PUSHORT ValueCapsLength)321c2c66affSColin Finck HidParser_GetSpecificValueCaps(
322c2c66affSColin Finck     IN PVOID CollectionContext,
323c2c66affSColin Finck     IN HIDP_REPORT_TYPE  ReportType,
324c2c66affSColin Finck     IN USAGE  UsagePage,
325c2c66affSColin Finck     IN USHORT  LinkCollection,
326c2c66affSColin Finck     IN USAGE  Usage,
327c2c66affSColin Finck     OUT PHIDP_VALUE_CAPS  ValueCaps,
328c2c66affSColin Finck     IN OUT PUSHORT  ValueCapsLength)
329c2c66affSColin Finck {
330*c4055c45SHervé Poussineau     NTSTATUS ParserStatus;
331c2c66affSColin Finck 
332c2c66affSColin Finck     //
333c2c66affSColin Finck     // FIXME: implement searching in specific collection
334c2c66affSColin Finck     //
335c2c66affSColin Finck     ASSERT(LinkCollection == HIDP_LINK_COLLECTION_UNSPECIFIED);
336c2c66affSColin Finck 
337c2c66affSColin Finck     if (ReportType == HidP_Input)
338c2c66affSColin Finck     {
339c2c66affSColin Finck         //
340c2c66affSColin Finck         // input report
341c2c66affSColin Finck         //
342c151f8a1SHervé Poussineau         ParserStatus = HidParser_GetSpecificValueCapsWithReport(CollectionContext, HID_REPORT_TYPE_INPUT, UsagePage, Usage, ValueCaps, ValueCapsLength);
343c2c66affSColin Finck     }
344c2c66affSColin Finck     else if (ReportType == HidP_Output)
345c2c66affSColin Finck     {
346c2c66affSColin Finck         //
347c2c66affSColin Finck         // input report
348c2c66affSColin Finck         //
349c151f8a1SHervé Poussineau         ParserStatus = HidParser_GetSpecificValueCapsWithReport(CollectionContext, HID_REPORT_TYPE_OUTPUT, UsagePage, Usage, ValueCaps, ValueCapsLength);
350c2c66affSColin Finck     }
351c2c66affSColin Finck     else if (ReportType == HidP_Feature)
352c2c66affSColin Finck     {
353c2c66affSColin Finck         //
354c2c66affSColin Finck         // input report
355c2c66affSColin Finck         //
356c151f8a1SHervé Poussineau         ParserStatus = HidParser_GetSpecificValueCapsWithReport(CollectionContext, HID_REPORT_TYPE_FEATURE, UsagePage, Usage, ValueCaps, ValueCapsLength);
357c2c66affSColin Finck     }
358c2c66affSColin Finck     else
359c2c66affSColin Finck     {
360c2c66affSColin Finck         //
361c2c66affSColin Finck         // invalid report type
362c2c66affSColin Finck         //
363c2c66affSColin Finck         return HIDP_STATUS_INVALID_REPORT_TYPE;
364c2c66affSColin Finck     }
365c2c66affSColin Finck 
366c2c66affSColin Finck     //
367*c4055c45SHervé Poussineau     // return status
368c2c66affSColin Finck     //
369*c4055c45SHervé Poussineau     return ParserStatus;
370c2c66affSColin Finck }
371c2c66affSColin Finck 
372c2c66affSColin Finck HIDAPI
373c2c66affSColin Finck NTSTATUS
374c2c66affSColin Finck NTAPI
HidParser_UsageListDifference(IN PUSAGE PreviousUsageList,IN PUSAGE CurrentUsageList,OUT PUSAGE BreakUsageList,OUT PUSAGE MakeUsageList,IN ULONG UsageListLength)375c2c66affSColin Finck HidParser_UsageListDifference(
376c2c66affSColin Finck   IN PUSAGE  PreviousUsageList,
377c2c66affSColin Finck   IN PUSAGE  CurrentUsageList,
378c2c66affSColin Finck   OUT PUSAGE  BreakUsageList,
379c2c66affSColin Finck   OUT PUSAGE  MakeUsageList,
380c2c66affSColin Finck   IN ULONG  UsageListLength)
381c2c66affSColin Finck {
382c2c66affSColin Finck     ULONG Index, SubIndex, bFound, BreakUsageIndex = 0, MakeUsageIndex = 0;
383c2c66affSColin Finck     USAGE CurrentUsage, Usage;
384c2c66affSColin Finck 
385c2c66affSColin Finck     if (UsageListLength)
386c2c66affSColin Finck     {
387c2c66affSColin Finck         Index = 0;
388c2c66affSColin Finck         do
389c2c66affSColin Finck         {
390c2c66affSColin Finck             /* get current usage */
391c2c66affSColin Finck             CurrentUsage = PreviousUsageList[Index];
392c2c66affSColin Finck 
393c2c66affSColin Finck             /* is the end of list reached? */
394c2c66affSColin Finck             if (!CurrentUsage)
395c2c66affSColin Finck                 break;
396c2c66affSColin Finck 
397c2c66affSColin Finck             /* start searching in current usage list */
398c2c66affSColin Finck             SubIndex = 0;
399c2c66affSColin Finck             bFound = FALSE;
400c2c66affSColin Finck             do
401c2c66affSColin Finck             {
402c2c66affSColin Finck                 /* get usage of current list */
403c2c66affSColin Finck                 Usage = CurrentUsageList[SubIndex];
404c2c66affSColin Finck 
405c2c66affSColin Finck                 /* end of list reached? */
406c2c66affSColin Finck                 if (!Usage)
407c2c66affSColin Finck                     break;
408c2c66affSColin Finck 
409c2c66affSColin Finck                 /* check if it matches the current one */
410c2c66affSColin Finck                 if (CurrentUsage == Usage)
411c2c66affSColin Finck                 {
412c2c66affSColin Finck                     /* it does */
413c2c66affSColin Finck                     bFound = TRUE;
414c2c66affSColin Finck                     break;
415c2c66affSColin Finck                 }
416c2c66affSColin Finck 
417c2c66affSColin Finck                 /* move to next usage */
418c2c66affSColin Finck                 SubIndex++;
419c2c66affSColin Finck             }while(SubIndex < UsageListLength);
420c2c66affSColin Finck 
421c2c66affSColin Finck             /* was the usage found ?*/
422c2c66affSColin Finck             if (!bFound)
423c2c66affSColin Finck             {
424c2c66affSColin Finck                 /* store it in the break usage list */
425c2c66affSColin Finck                 BreakUsageList[BreakUsageIndex] = CurrentUsage;
426c2c66affSColin Finck                 BreakUsageIndex++;
427c2c66affSColin Finck             }
428c2c66affSColin Finck 
429c2c66affSColin Finck             /* move to next usage */
430c2c66affSColin Finck             Index++;
431c2c66affSColin Finck 
432c2c66affSColin Finck         }while(Index < UsageListLength);
433c2c66affSColin Finck 
434c2c66affSColin Finck         /* now process the new items */
435c2c66affSColin Finck         Index = 0;
436c2c66affSColin Finck         do
437c2c66affSColin Finck         {
438c2c66affSColin Finck             /* get current usage */
439c2c66affSColin Finck             CurrentUsage = CurrentUsageList[Index];
440c2c66affSColin Finck 
441c2c66affSColin Finck             /* is the end of list reached? */
442c2c66affSColin Finck             if (!CurrentUsage)
443c2c66affSColin Finck                 break;
444c2c66affSColin Finck 
445c2c66affSColin Finck             /* start searching in current usage list */
446c2c66affSColin Finck             SubIndex = 0;
447c2c66affSColin Finck             bFound = FALSE;
448c2c66affSColin Finck             do
449c2c66affSColin Finck             {
450c2c66affSColin Finck                 /* get usage of previous list */
451c2c66affSColin Finck                 Usage = PreviousUsageList[SubIndex];
452c2c66affSColin Finck 
453c2c66affSColin Finck                 /* end of list reached? */
454c2c66affSColin Finck                 if (!Usage)
455c2c66affSColin Finck                     break;
456c2c66affSColin Finck 
457c2c66affSColin Finck                 /* check if it matches the current one */
458c2c66affSColin Finck                 if (CurrentUsage == Usage)
459c2c66affSColin Finck                 {
460c2c66affSColin Finck                     /* it does */
461c2c66affSColin Finck                     bFound = TRUE;
462c2c66affSColin Finck                     break;
463c2c66affSColin Finck                 }
464c2c66affSColin Finck 
465c2c66affSColin Finck                 /* move to next usage */
466c2c66affSColin Finck                 SubIndex++;
467c2c66affSColin Finck             }while(SubIndex < UsageListLength);
468c2c66affSColin Finck 
469c2c66affSColin Finck             /* was the usage found ?*/
470c2c66affSColin Finck             if (!bFound)
471c2c66affSColin Finck             {
472c2c66affSColin Finck                 /* store it in the make usage list */
473c2c66affSColin Finck                 MakeUsageList[MakeUsageIndex] = CurrentUsage;
474c2c66affSColin Finck                 MakeUsageIndex++;
475c2c66affSColin Finck             }
476c2c66affSColin Finck 
477c2c66affSColin Finck             /* move to next usage */
478c2c66affSColin Finck             Index++;
479c2c66affSColin Finck 
480c2c66affSColin Finck         }while(Index < UsageListLength);
481c2c66affSColin Finck     }
482c2c66affSColin Finck 
483c2c66affSColin Finck     /* does the break list contain empty entries */
484c2c66affSColin Finck     if (BreakUsageIndex < UsageListLength)
485c2c66affSColin Finck     {
486c2c66affSColin Finck         /* zeroize entries */
487c2c66affSColin Finck         RtlZeroMemory(&BreakUsageList[BreakUsageIndex], sizeof(USAGE) * (UsageListLength - BreakUsageIndex));
488c2c66affSColin Finck     }
489c2c66affSColin Finck 
490c2c66affSColin Finck     /* does the make usage list contain empty entries */
491c2c66affSColin Finck     if (MakeUsageIndex < UsageListLength)
492c2c66affSColin Finck     {
493c2c66affSColin Finck         /* zeroize entries */
494c2c66affSColin Finck         RtlZeroMemory(&MakeUsageList[MakeUsageIndex], sizeof(USAGE) * (UsageListLength - MakeUsageIndex));
495c2c66affSColin Finck     }
496c2c66affSColin Finck 
497c2c66affSColin Finck     /* done */
498c2c66affSColin Finck     return HIDP_STATUS_SUCCESS;
499c2c66affSColin Finck }
500c2c66affSColin Finck 
501c2c66affSColin Finck HIDAPI
502c2c66affSColin Finck NTSTATUS
503c2c66affSColin Finck NTAPI
HidParser_GetUsages(IN PVOID CollectionContext,IN HIDP_REPORT_TYPE ReportType,IN USAGE UsagePage,IN USHORT LinkCollection OPTIONAL,OUT USAGE * UsageList,IN OUT PULONG UsageLength,IN PCHAR Report,IN ULONG ReportLength)504c2c66affSColin Finck HidParser_GetUsages(
505c2c66affSColin Finck     IN PVOID CollectionContext,
506c2c66affSColin Finck     IN HIDP_REPORT_TYPE  ReportType,
507c2c66affSColin Finck     IN USAGE  UsagePage,
508c2c66affSColin Finck     IN USHORT  LinkCollection  OPTIONAL,
509c2c66affSColin Finck     OUT USAGE  *UsageList,
510c2c66affSColin Finck     IN OUT PULONG UsageLength,
511c2c66affSColin Finck     IN PCHAR  Report,
512c2c66affSColin Finck     IN ULONG  ReportLength)
513c2c66affSColin Finck {
514*c4055c45SHervé Poussineau     NTSTATUS ParserStatus;
515c2c66affSColin Finck 
516c2c66affSColin Finck     //
517c2c66affSColin Finck     // FIXME: implement searching in specific collection
518c2c66affSColin Finck     //
519c2c66affSColin Finck     ASSERT(LinkCollection == HIDP_LINK_COLLECTION_UNSPECIFIED);
520c2c66affSColin Finck 
521c2c66affSColin Finck     if (ReportType == HidP_Input)
522c2c66affSColin Finck     {
523c2c66affSColin Finck         //
524c2c66affSColin Finck         // input report
525c2c66affSColin Finck         //
526c151f8a1SHervé Poussineau         ParserStatus = HidParser_GetUsagesWithReport(CollectionContext, HID_REPORT_TYPE_INPUT, UsagePage, UsageList, UsageLength, Report, ReportLength);
527c2c66affSColin Finck     }
528c2c66affSColin Finck     else if (ReportType == HidP_Output)
529c2c66affSColin Finck     {
530c2c66affSColin Finck         //
531c2c66affSColin Finck         // input report
532c2c66affSColin Finck         //
533c151f8a1SHervé Poussineau         ParserStatus = HidParser_GetUsagesWithReport(CollectionContext, HID_REPORT_TYPE_OUTPUT, UsagePage, UsageList, UsageLength, Report, ReportLength);
534c2c66affSColin Finck     }
535c2c66affSColin Finck     else if (ReportType == HidP_Feature)
536c2c66affSColin Finck     {
537c2c66affSColin Finck         //
538c2c66affSColin Finck         // input report
539c2c66affSColin Finck         //
540c151f8a1SHervé Poussineau         ParserStatus = HidParser_GetUsagesWithReport(CollectionContext, HID_REPORT_TYPE_FEATURE, UsagePage, UsageList, UsageLength, Report, ReportLength);
541c2c66affSColin Finck     }
542c2c66affSColin Finck     else
543c2c66affSColin Finck     {
544c2c66affSColin Finck         //
545c2c66affSColin Finck         // invalid report type
546c2c66affSColin Finck         //
547c2c66affSColin Finck         return HIDP_STATUS_INVALID_REPORT_TYPE;
548c2c66affSColin Finck     }
549c2c66affSColin Finck 
550c2c66affSColin Finck     //
551*c4055c45SHervé Poussineau     // return status
552c2c66affSColin Finck     //
553*c4055c45SHervé Poussineau     return ParserStatus;
554c2c66affSColin Finck }
555c2c66affSColin Finck 
556c2c66affSColin Finck HIDAPI
557c2c66affSColin Finck NTSTATUS
558c2c66affSColin Finck NTAPI
HidParser_GetScaledUsageValue(IN PVOID CollectionContext,IN HIDP_REPORT_TYPE ReportType,IN USAGE UsagePage,IN USHORT LinkCollection OPTIONAL,IN USAGE Usage,OUT PLONG UsageValue,IN PCHAR Report,IN ULONG ReportLength)559c2c66affSColin Finck HidParser_GetScaledUsageValue(
560c2c66affSColin Finck     IN PVOID CollectionContext,
561c2c66affSColin Finck     IN HIDP_REPORT_TYPE  ReportType,
562c2c66affSColin Finck     IN USAGE  UsagePage,
563c2c66affSColin Finck     IN USHORT  LinkCollection  OPTIONAL,
564c2c66affSColin Finck     IN USAGE  Usage,
565c2c66affSColin Finck     OUT PLONG  UsageValue,
566c2c66affSColin Finck     IN PCHAR  Report,
567c2c66affSColin Finck     IN ULONG  ReportLength)
568c2c66affSColin Finck {
569*c4055c45SHervé Poussineau     NTSTATUS ParserStatus;
570c2c66affSColin Finck 
571c2c66affSColin Finck     //
572c2c66affSColin Finck     // FIXME: implement searching in specific collection
573c2c66affSColin Finck     //
574c2c66affSColin Finck     ASSERT(LinkCollection == HIDP_LINK_COLLECTION_UNSPECIFIED);
575c2c66affSColin Finck 
576c2c66affSColin Finck     if (ReportType == HidP_Input)
577c2c66affSColin Finck     {
578c2c66affSColin Finck         //
579c2c66affSColin Finck         // input report
580c2c66affSColin Finck         //
581c151f8a1SHervé Poussineau         ParserStatus = HidParser_GetScaledUsageValueWithReport(CollectionContext, HID_REPORT_TYPE_INPUT, UsagePage, Usage, UsageValue, Report, ReportLength);
582c2c66affSColin Finck     }
583c2c66affSColin Finck     else if (ReportType == HidP_Output)
584c2c66affSColin Finck     {
585c2c66affSColin Finck         //
586c2c66affSColin Finck         // input report
587c2c66affSColin Finck         //
588c151f8a1SHervé Poussineau         ParserStatus = HidParser_GetScaledUsageValueWithReport(CollectionContext, HID_REPORT_TYPE_OUTPUT, UsagePage, Usage, UsageValue, Report, ReportLength);
589c2c66affSColin Finck     }
590c2c66affSColin Finck     else if (ReportType == HidP_Feature)
591c2c66affSColin Finck     {
592c2c66affSColin Finck         //
593c2c66affSColin Finck         // input report
594c2c66affSColin Finck         //
595c151f8a1SHervé Poussineau         ParserStatus = HidParser_GetScaledUsageValueWithReport(CollectionContext, HID_REPORT_TYPE_FEATURE,  UsagePage, Usage, UsageValue, Report, ReportLength);
596c2c66affSColin Finck     }
597c2c66affSColin Finck     else
598c2c66affSColin Finck     {
599c2c66affSColin Finck         //
600c2c66affSColin Finck         // invalid report type
601c2c66affSColin Finck         //
602c2c66affSColin Finck         return HIDP_STATUS_INVALID_REPORT_TYPE;
603c2c66affSColin Finck     }
604c2c66affSColin Finck 
605c2c66affSColin Finck     //
606*c4055c45SHervé Poussineau     // return status
607c2c66affSColin Finck     //
608*c4055c45SHervé Poussineau     return ParserStatus;
609c2c66affSColin Finck }
610c2c66affSColin Finck 
611c2c66affSColin Finck HIDAPI
612c2c66affSColin Finck NTSTATUS
613c2c66affSColin Finck NTAPI
HidParser_TranslateUsageAndPagesToI8042ScanCodes(IN PUSAGE_AND_PAGE ChangedUsageList,IN ULONG UsageListLength,IN HIDP_KEYBOARD_DIRECTION KeyAction,IN OUT PHIDP_KEYBOARD_MODIFIER_STATE ModifierState,IN PHIDP_INSERT_SCANCODES InsertCodesProcedure,IN PVOID InsertCodesContext)614c2c66affSColin Finck HidParser_TranslateUsageAndPagesToI8042ScanCodes(
615c2c66affSColin Finck    IN PUSAGE_AND_PAGE  ChangedUsageList,
616c2c66affSColin Finck    IN ULONG  UsageListLength,
617c2c66affSColin Finck    IN HIDP_KEYBOARD_DIRECTION  KeyAction,
618c2c66affSColin Finck    IN OUT PHIDP_KEYBOARD_MODIFIER_STATE  ModifierState,
619c2c66affSColin Finck    IN PHIDP_INSERT_SCANCODES  InsertCodesProcedure,
620c2c66affSColin Finck    IN PVOID  InsertCodesContext)
621c2c66affSColin Finck {
622c2c66affSColin Finck     ULONG Index;
623*c4055c45SHervé Poussineau     NTSTATUS Status = HIDP_STATUS_SUCCESS;
624c2c66affSColin Finck 
625c2c66affSColin Finck     for(Index = 0; Index < UsageListLength; Index++)
626c2c66affSColin Finck     {
627c2c66affSColin Finck         //
628c2c66affSColin Finck         // check current usage
629c2c66affSColin Finck         //
630c2c66affSColin Finck         if (ChangedUsageList[Index].UsagePage == HID_USAGE_PAGE_KEYBOARD)
631c2c66affSColin Finck         {
632c2c66affSColin Finck             //
633c2c66affSColin Finck             // process keyboard usage
634c2c66affSColin Finck             //
635c151f8a1SHervé Poussineau             Status = HidParser_TranslateKbdUsage(ChangedUsageList[Index].Usage, KeyAction, ModifierState, InsertCodesProcedure, InsertCodesContext);
636c2c66affSColin Finck         }
637c2c66affSColin Finck         else if (ChangedUsageList[Index].UsagePage == HID_USAGE_PAGE_CONSUMER)
638c2c66affSColin Finck         {
639c2c66affSColin Finck             //
640c2c66affSColin Finck             // process consumer usage
641c2c66affSColin Finck             //
642c151f8a1SHervé Poussineau             Status = HidParser_TranslateCustUsage(ChangedUsageList[Index].Usage, KeyAction, ModifierState, InsertCodesProcedure, InsertCodesContext);
643c2c66affSColin Finck         }
644c2c66affSColin Finck         else
645c2c66affSColin Finck         {
646c2c66affSColin Finck             //
647c2c66affSColin Finck             // invalid page / end of usage list page
648c2c66affSColin Finck             //
649c2c66affSColin Finck             return HIDP_STATUS_I8042_TRANS_UNKNOWN;
650c2c66affSColin Finck         }
651c2c66affSColin Finck 
652c2c66affSColin Finck         //
653c2c66affSColin Finck         // check status
654c2c66affSColin Finck         //
655*c4055c45SHervé Poussineau         if (Status != HIDP_STATUS_SUCCESS)
656c2c66affSColin Finck         {
657c2c66affSColin Finck             //
658c2c66affSColin Finck             // failed
659c2c66affSColin Finck             //
660*c4055c45SHervé Poussineau             return Status;
661c2c66affSColin Finck         }
662c2c66affSColin Finck     }
663c2c66affSColin Finck 
664c2c66affSColin Finck     //
665*c4055c45SHervé Poussineau     // return status
666c2c66affSColin Finck     //
667*c4055c45SHervé Poussineau     return Status;
668c2c66affSColin Finck }
669c2c66affSColin Finck 
670c2c66affSColin Finck 
671c2c66affSColin Finck HIDAPI
672c2c66affSColin Finck NTSTATUS
673c2c66affSColin Finck NTAPI
HidParser_GetUsagesEx(IN PVOID CollectionContext,IN HIDP_REPORT_TYPE ReportType,IN USHORT LinkCollection,OUT PUSAGE_AND_PAGE ButtonList,IN OUT ULONG * UsageLength,IN PCHAR Report,IN ULONG ReportLength)674c2c66affSColin Finck HidParser_GetUsagesEx(
675c2c66affSColin Finck     IN PVOID CollectionContext,
676c2c66affSColin Finck     IN HIDP_REPORT_TYPE  ReportType,
677c2c66affSColin Finck     IN USHORT  LinkCollection,
678c2c66affSColin Finck     OUT PUSAGE_AND_PAGE  ButtonList,
679c2c66affSColin Finck     IN OUT ULONG  *UsageLength,
680c2c66affSColin Finck     IN PCHAR  Report,
681c2c66affSColin Finck     IN ULONG  ReportLength)
682c2c66affSColin Finck {
683c151f8a1SHervé Poussineau     return HidParser_GetUsages(CollectionContext, ReportType, HID_USAGE_PAGE_UNDEFINED, LinkCollection, (PUSAGE)ButtonList, UsageLength, Report, ReportLength);
684c2c66affSColin Finck }
685c2c66affSColin Finck 
686c2c66affSColin Finck HIDAPI
687c2c66affSColin Finck NTSTATUS
688c2c66affSColin Finck NTAPI
HidParser_UsageAndPageListDifference(IN PUSAGE_AND_PAGE PreviousUsageList,IN PUSAGE_AND_PAGE CurrentUsageList,OUT PUSAGE_AND_PAGE BreakUsageList,OUT PUSAGE_AND_PAGE MakeUsageList,IN ULONG UsageListLength)689c2c66affSColin Finck HidParser_UsageAndPageListDifference(
690c2c66affSColin Finck    IN PUSAGE_AND_PAGE  PreviousUsageList,
691c2c66affSColin Finck    IN PUSAGE_AND_PAGE  CurrentUsageList,
692c2c66affSColin Finck    OUT PUSAGE_AND_PAGE  BreakUsageList,
693c2c66affSColin Finck    OUT PUSAGE_AND_PAGE  MakeUsageList,
694c2c66affSColin Finck    IN ULONG  UsageListLength)
695c2c66affSColin Finck {
696c2c66affSColin Finck     ULONG Index, SubIndex, BreakUsageListIndex = 0, MakeUsageListIndex = 0, bFound;
697c2c66affSColin Finck     PUSAGE_AND_PAGE CurrentUsage, Usage;
698c2c66affSColin Finck 
699c2c66affSColin Finck     if (UsageListLength)
700c2c66affSColin Finck     {
701c2c66affSColin Finck         /* process removed usages */
702c2c66affSColin Finck         Index = 0;
703c2c66affSColin Finck         do
704c2c66affSColin Finck         {
705c2c66affSColin Finck             /* get usage from current index */
706c2c66affSColin Finck             CurrentUsage = &PreviousUsageList[Index];
707c2c66affSColin Finck 
708c2c66affSColin Finck             /* end of list reached? */
709c2c66affSColin Finck             if (CurrentUsage->Usage == 0 && CurrentUsage->UsagePage == 0)
710c2c66affSColin Finck                 break;
711c2c66affSColin Finck 
712c2c66affSColin Finck             /* search in current list */
713c2c66affSColin Finck             SubIndex = 0;
714c2c66affSColin Finck             bFound = FALSE;
715c2c66affSColin Finck             do
716c2c66affSColin Finck             {
717c2c66affSColin Finck                 /* get usage */
718c2c66affSColin Finck                 Usage = &CurrentUsageList[SubIndex];
719c2c66affSColin Finck 
720c2c66affSColin Finck                 /* end of list reached? */
721c2c66affSColin Finck                 if (Usage->Usage == 0 && Usage->UsagePage == 0)
722c2c66affSColin Finck                     break;
723c2c66affSColin Finck 
724c2c66affSColin Finck                 /* does it match */
725c2c66affSColin Finck                 if (Usage->Usage == CurrentUsage->Usage && Usage->UsagePage == CurrentUsage->UsagePage)
726c2c66affSColin Finck                 {
727c2c66affSColin Finck                     /* found match */
728c2c66affSColin Finck                     bFound = TRUE;
729c2c66affSColin Finck                 }
730c2c66affSColin Finck 
731c2c66affSColin Finck                 /* move to next index */
732c2c66affSColin Finck                 SubIndex++;
733c2c66affSColin Finck 
734c2c66affSColin Finck             }while(SubIndex < UsageListLength);
735c2c66affSColin Finck 
736c2c66affSColin Finck             if (!bFound)
737c2c66affSColin Finck             {
738c2c66affSColin Finck                 /* store it in break usage list */
739c2c66affSColin Finck                 BreakUsageList[BreakUsageListIndex].Usage = CurrentUsage->Usage;
740c2c66affSColin Finck                 BreakUsageList[BreakUsageListIndex].UsagePage = CurrentUsage->UsagePage;
741c2c66affSColin Finck                 BreakUsageListIndex++;
742c2c66affSColin Finck             }
743c2c66affSColin Finck 
744c2c66affSColin Finck             /* move to next index */
745c2c66affSColin Finck             Index++;
746c2c66affSColin Finck 
747c2c66affSColin Finck         }while(Index < UsageListLength);
748c2c66affSColin Finck 
749c2c66affSColin Finck         /* process new usages */
750c2c66affSColin Finck         Index = 0;
751c2c66affSColin Finck         do
752c2c66affSColin Finck         {
753c2c66affSColin Finck             /* get usage from current index */
754c2c66affSColin Finck             CurrentUsage = &CurrentUsageList[Index];
755c2c66affSColin Finck 
756c2c66affSColin Finck             /* end of list reached? */
757c2c66affSColin Finck             if (CurrentUsage->Usage == 0 && CurrentUsage->UsagePage == 0)
758c2c66affSColin Finck                 break;
759c2c66affSColin Finck 
760c2c66affSColin Finck             /* search in current list */
761c2c66affSColin Finck             SubIndex = 0;
762c2c66affSColin Finck             bFound = FALSE;
763c2c66affSColin Finck             do
764c2c66affSColin Finck             {
765c2c66affSColin Finck                 /* get usage */
766c2c66affSColin Finck                 Usage = &PreviousUsageList[SubIndex];
767c2c66affSColin Finck 
768c2c66affSColin Finck                 /* end of list reached? */
769c2c66affSColin Finck                 if (Usage->Usage == 0 && Usage->UsagePage == 0)
770c2c66affSColin Finck                     break;
771c2c66affSColin Finck 
772c2c66affSColin Finck                 /* does it match */
773c2c66affSColin Finck                 if (Usage->Usage == CurrentUsage->Usage && Usage->UsagePage == CurrentUsage->UsagePage)
774c2c66affSColin Finck                 {
775c2c66affSColin Finck                     /* found match */
776c2c66affSColin Finck                     bFound = TRUE;
777c2c66affSColin Finck                 }
778c2c66affSColin Finck 
779c2c66affSColin Finck                 /* move to next index */
780c2c66affSColin Finck                 SubIndex++;
781c2c66affSColin Finck 
782c2c66affSColin Finck             }while(SubIndex < UsageListLength);
783c2c66affSColin Finck 
784c2c66affSColin Finck             if (!bFound)
785c2c66affSColin Finck             {
786c2c66affSColin Finck                 /* store it in break usage list */
787c2c66affSColin Finck                 MakeUsageList[MakeUsageListIndex].Usage = CurrentUsage->Usage;
788c2c66affSColin Finck                 MakeUsageList[MakeUsageListIndex].UsagePage = CurrentUsage->UsagePage;
789c2c66affSColin Finck                 MakeUsageListIndex++;
790c2c66affSColin Finck             }
791c2c66affSColin Finck 
792c2c66affSColin Finck             /* move to next index */
793c2c66affSColin Finck             Index++;
794c2c66affSColin Finck         }while(Index < UsageListLength);
795c2c66affSColin Finck     }
796c2c66affSColin Finck 
797c2c66affSColin Finck     /* are there remaining free list entries */
798c2c66affSColin Finck     if (BreakUsageListIndex < UsageListLength)
799c2c66affSColin Finck     {
800c2c66affSColin Finck         /* zero them */
801c2c66affSColin Finck         RtlZeroMemory(&BreakUsageList[BreakUsageListIndex], (UsageListLength - BreakUsageListIndex) * sizeof(USAGE_AND_PAGE));
802c2c66affSColin Finck     }
803c2c66affSColin Finck 
804c2c66affSColin Finck     /* are there remaining free list entries */
805c2c66affSColin Finck     if (MakeUsageListIndex < UsageListLength)
806c2c66affSColin Finck     {
807c2c66affSColin Finck         /* zero them */
808c2c66affSColin Finck         RtlZeroMemory(&MakeUsageList[MakeUsageListIndex], (UsageListLength - MakeUsageListIndex) * sizeof(USAGE_AND_PAGE));
809c2c66affSColin Finck     }
810c2c66affSColin Finck 
811c2c66affSColin Finck     /* done */
812c2c66affSColin Finck     return HIDP_STATUS_SUCCESS;
813c2c66affSColin Finck }
814c2c66affSColin Finck 
815c2c66affSColin Finck HIDAPI
816c2c66affSColin Finck NTSTATUS
817c2c66affSColin Finck NTAPI
HidParser_GetSpecificButtonCaps(IN PVOID CollectionContext,IN HIDP_REPORT_TYPE ReportType,IN USAGE UsagePage,IN USHORT LinkCollection,IN USAGE Usage,OUT PHIDP_BUTTON_CAPS ButtonCaps,IN OUT PULONG ButtonCapsLength)818c2c66affSColin Finck HidParser_GetSpecificButtonCaps(
819c2c66affSColin Finck     IN PVOID CollectionContext,
820c2c66affSColin Finck     IN HIDP_REPORT_TYPE  ReportType,
821c2c66affSColin Finck     IN USAGE  UsagePage,
822c2c66affSColin Finck     IN USHORT  LinkCollection,
823c2c66affSColin Finck     IN USAGE  Usage,
824c2c66affSColin Finck     OUT PHIDP_BUTTON_CAPS  ButtonCaps,
825c2c66affSColin Finck     IN OUT PULONG  ButtonCapsLength)
826c2c66affSColin Finck {
827c2c66affSColin Finck     UNIMPLEMENTED;
828c2c66affSColin Finck     ASSERT(FALSE);
829c2c66affSColin Finck     return STATUS_NOT_IMPLEMENTED;
830c2c66affSColin Finck }
831c2c66affSColin Finck 
832c2c66affSColin Finck 
833c2c66affSColin Finck HIDAPI
834c2c66affSColin Finck NTSTATUS
835c2c66affSColin Finck NTAPI
HidParser_GetData(IN PVOID CollectionContext,IN HIDP_REPORT_TYPE ReportType,OUT PHIDP_DATA DataList,IN OUT PULONG DataLength,IN PCHAR Report,IN ULONG ReportLength)836c2c66affSColin Finck HidParser_GetData(
837c2c66affSColin Finck     IN PVOID CollectionContext,
838c2c66affSColin Finck     IN HIDP_REPORT_TYPE  ReportType,
839c2c66affSColin Finck     OUT PHIDP_DATA  DataList,
840c2c66affSColin Finck     IN OUT PULONG  DataLength,
841c2c66affSColin Finck     IN PCHAR  Report,
842c2c66affSColin Finck     IN ULONG  ReportLength)
843c2c66affSColin Finck {
844c2c66affSColin Finck     UNIMPLEMENTED;
845c2c66affSColin Finck     ASSERT(FALSE);
846c2c66affSColin Finck     return STATUS_NOT_IMPLEMENTED;
847c2c66affSColin Finck }
848c2c66affSColin Finck 
849c2c66affSColin Finck HIDAPI
850c2c66affSColin Finck NTSTATUS
851c2c66affSColin Finck NTAPI
HidParser_GetExtendedAttributes(IN PVOID CollectionContext,IN HIDP_REPORT_TYPE ReportType,IN USHORT DataIndex,OUT PHIDP_EXTENDED_ATTRIBUTES Attributes,IN OUT PULONG LengthAttributes)852c2c66affSColin Finck HidParser_GetExtendedAttributes(
853c2c66affSColin Finck     IN PVOID CollectionContext,
854c2c66affSColin Finck     IN HIDP_REPORT_TYPE  ReportType,
855c2c66affSColin Finck     IN USHORT  DataIndex,
856c2c66affSColin Finck     OUT PHIDP_EXTENDED_ATTRIBUTES  Attributes,
857c2c66affSColin Finck     IN OUT PULONG  LengthAttributes)
858c2c66affSColin Finck {
859c2c66affSColin Finck     UNIMPLEMENTED;
860c2c66affSColin Finck     ASSERT(FALSE);
861c2c66affSColin Finck     return STATUS_NOT_IMPLEMENTED;
862c2c66affSColin Finck }
863c2c66affSColin Finck 
864c2c66affSColin Finck HIDAPI
865c2c66affSColin Finck NTSTATUS
866c2c66affSColin Finck NTAPI
HidParser_GetLinkCollectionNodes(IN PVOID CollectionContext,OUT PHIDP_LINK_COLLECTION_NODE LinkCollectionNodes,IN OUT PULONG LinkCollectionNodesLength)867c2c66affSColin Finck HidParser_GetLinkCollectionNodes(
868c2c66affSColin Finck     IN PVOID CollectionContext,
869c2c66affSColin Finck     OUT PHIDP_LINK_COLLECTION_NODE  LinkCollectionNodes,
870c2c66affSColin Finck     IN OUT PULONG  LinkCollectionNodesLength)
871c2c66affSColin Finck {
872c2c66affSColin Finck     UNIMPLEMENTED;
873c2c66affSColin Finck     ASSERT(FALSE);
874c2c66affSColin Finck     return STATUS_NOT_IMPLEMENTED;
875c2c66affSColin Finck }
876c2c66affSColin Finck 
877c2c66affSColin Finck HIDAPI
878c2c66affSColin Finck NTSTATUS
879c2c66affSColin Finck NTAPI
HidParser_GetUsageValue(IN PVOID CollectionContext,IN HIDP_REPORT_TYPE ReportType,IN USAGE UsagePage,IN USHORT LinkCollection,IN USAGE Usage,OUT PULONG UsageValue,IN PCHAR Report,IN ULONG ReportLength)880c2c66affSColin Finck HidParser_GetUsageValue(
881c2c66affSColin Finck     IN PVOID CollectionContext,
882c2c66affSColin Finck     IN HIDP_REPORT_TYPE  ReportType,
883c2c66affSColin Finck     IN USAGE  UsagePage,
884c2c66affSColin Finck     IN USHORT  LinkCollection,
885c2c66affSColin Finck     IN USAGE  Usage,
886c2c66affSColin Finck     OUT PULONG  UsageValue,
887c2c66affSColin Finck     IN PCHAR  Report,
888c2c66affSColin Finck     IN ULONG  ReportLength)
889c2c66affSColin Finck {
890*c4055c45SHervé Poussineau     NTSTATUS ParserStatus;
891c2c66affSColin Finck 
892c2c66affSColin Finck     //
893c2c66affSColin Finck     // FIXME: implement searching in specific collection
894c2c66affSColin Finck     //
895c2c66affSColin Finck     ASSERT(LinkCollection == HIDP_LINK_COLLECTION_UNSPECIFIED);
896c2c66affSColin Finck 
897c2c66affSColin Finck     if (ReportType == HidP_Input)
898c2c66affSColin Finck     {
899c2c66affSColin Finck         //
900c2c66affSColin Finck         // input report
901c2c66affSColin Finck         //
902c151f8a1SHervé Poussineau         ParserStatus = HidParser_GetUsageValueWithReport(CollectionContext, HID_REPORT_TYPE_INPUT, UsagePage, Usage, UsageValue, Report, ReportLength);
903c2c66affSColin Finck     }
904c2c66affSColin Finck     else if (ReportType == HidP_Output)
905c2c66affSColin Finck     {
906c2c66affSColin Finck         //
907c2c66affSColin Finck         // input report
908c2c66affSColin Finck         //
909c151f8a1SHervé Poussineau         ParserStatus = HidParser_GetUsageValueWithReport(CollectionContext, HID_REPORT_TYPE_OUTPUT, UsagePage, Usage, UsageValue, Report, ReportLength);
910c2c66affSColin Finck     }
911c2c66affSColin Finck     else if (ReportType == HidP_Feature)
912c2c66affSColin Finck     {
913c2c66affSColin Finck         //
914c2c66affSColin Finck         // input report
915c2c66affSColin Finck         //
916c151f8a1SHervé Poussineau         ParserStatus = HidParser_GetUsageValueWithReport(CollectionContext, HID_REPORT_TYPE_FEATURE,  UsagePage, Usage, UsageValue, Report, ReportLength);
917c2c66affSColin Finck     }
918c2c66affSColin Finck     else
919c2c66affSColin Finck     {
920c2c66affSColin Finck         //
921c2c66affSColin Finck         // invalid report type
922c2c66affSColin Finck         //
923c2c66affSColin Finck         return HIDP_STATUS_INVALID_REPORT_TYPE;
924c2c66affSColin Finck     }
925c2c66affSColin Finck 
926c2c66affSColin Finck     //
927*c4055c45SHervé Poussineau     // return status
928c2c66affSColin Finck     //
929*c4055c45SHervé Poussineau     return ParserStatus;
930c2c66affSColin Finck }
931c2c66affSColin Finck 
932c2c66affSColin Finck NTSTATUS
933c2c66affSColin Finck NTAPI
HidParser_SysPowerEvent(IN PVOID CollectionContext,IN PCHAR HidPacket,IN USHORT HidPacketLength,OUT PULONG OutputBuffer)934c2c66affSColin Finck HidParser_SysPowerEvent(
935c2c66affSColin Finck     IN PVOID CollectionContext,
936c2c66affSColin Finck     IN PCHAR HidPacket,
937c2c66affSColin Finck     IN USHORT HidPacketLength,
938c2c66affSColin Finck     OUT PULONG OutputBuffer)
939c2c66affSColin Finck {
940c2c66affSColin Finck     UNIMPLEMENTED;
941c2c66affSColin Finck     ASSERT(FALSE);
942c2c66affSColin Finck     return STATUS_NOT_IMPLEMENTED;
943c2c66affSColin Finck }
944c2c66affSColin Finck 
945c2c66affSColin Finck NTSTATUS
946c2c66affSColin Finck NTAPI
HidParser_SysPowerCaps(IN PVOID CollectionContext,OUT PULONG OutputBuffer)947c2c66affSColin Finck HidParser_SysPowerCaps (
948c2c66affSColin Finck     IN PVOID CollectionContext,
949c2c66affSColin Finck     OUT PULONG OutputBuffer)
950c2c66affSColin Finck {
951c2c66affSColin Finck     UNIMPLEMENTED;
952c2c66affSColin Finck     ASSERT(FALSE);
953c2c66affSColin Finck     return STATUS_NOT_IMPLEMENTED;
954c2c66affSColin Finck }
955c2c66affSColin Finck 
956c2c66affSColin Finck HIDAPI
957c2c66affSColin Finck NTSTATUS
958c2c66affSColin Finck NTAPI
HidParser_GetUsageValueArray(IN PVOID CollectionContext,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)959c2c66affSColin Finck HidParser_GetUsageValueArray(
960c2c66affSColin Finck     IN PVOID CollectionContext,
961c2c66affSColin Finck     IN HIDP_REPORT_TYPE  ReportType,
962c2c66affSColin Finck     IN USAGE  UsagePage,
963c2c66affSColin Finck     IN USHORT  LinkCollection  OPTIONAL,
964c2c66affSColin Finck     IN USAGE  Usage,
965c2c66affSColin Finck     OUT PCHAR  UsageValue,
966c2c66affSColin Finck     IN USHORT  UsageValueByteLength,
967c2c66affSColin Finck     IN PCHAR  Report,
968c2c66affSColin Finck     IN ULONG  ReportLength)
969c2c66affSColin Finck {
970c2c66affSColin Finck     UNIMPLEMENTED;
971c2c66affSColin Finck     ASSERT(FALSE);
972c2c66affSColin Finck     return STATUS_NOT_IMPLEMENTED;
973c2c66affSColin Finck }
974c2c66affSColin Finck 
975c2c66affSColin Finck HIDAPI
976c2c66affSColin Finck NTSTATUS
977c2c66affSColin Finck NTAPI
HidParser_UnsetUsages(IN PVOID CollectionContext,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)978c2c66affSColin Finck HidParser_UnsetUsages(
979c2c66affSColin Finck     IN PVOID CollectionContext,
980c2c66affSColin Finck     IN HIDP_REPORT_TYPE  ReportType,
981c2c66affSColin Finck     IN USAGE  UsagePage,
982c2c66affSColin Finck     IN USHORT  LinkCollection,
983c2c66affSColin Finck     IN PUSAGE  UsageList,
984c2c66affSColin Finck     IN OUT PULONG  UsageLength,
985c2c66affSColin Finck     IN OUT PCHAR  Report,
986c2c66affSColin Finck     IN ULONG  ReportLength)
987c2c66affSColin Finck {
988c2c66affSColin Finck     UNIMPLEMENTED;
989c2c66affSColin Finck     ASSERT(FALSE);
990c2c66affSColin Finck     return STATUS_NOT_IMPLEMENTED;
991c2c66affSColin Finck }
992c2c66affSColin Finck 
993c2c66affSColin Finck HIDAPI
994c2c66affSColin Finck NTSTATUS
995c2c66affSColin Finck NTAPI
HidParser_TranslateUsagesToI8042ScanCodes(IN PUSAGE ChangedUsageList,IN ULONG UsageListLength,IN HIDP_KEYBOARD_DIRECTION KeyAction,IN OUT PHIDP_KEYBOARD_MODIFIER_STATE ModifierState,IN PHIDP_INSERT_SCANCODES InsertCodesProcedure,IN PVOID InsertCodesContext)996c2c66affSColin Finck HidParser_TranslateUsagesToI8042ScanCodes(
997c2c66affSColin Finck   IN PUSAGE  ChangedUsageList,
998c2c66affSColin Finck   IN ULONG  UsageListLength,
999c2c66affSColin Finck   IN HIDP_KEYBOARD_DIRECTION  KeyAction,
1000c2c66affSColin Finck   IN OUT PHIDP_KEYBOARD_MODIFIER_STATE  ModifierState,
1001c2c66affSColin Finck   IN PHIDP_INSERT_SCANCODES  InsertCodesProcedure,
1002c2c66affSColin Finck   IN PVOID  InsertCodesContext)
1003c2c66affSColin Finck {
1004c2c66affSColin Finck     UNIMPLEMENTED;
1005c2c66affSColin Finck     ASSERT(FALSE);
1006c2c66affSColin Finck     return STATUS_NOT_IMPLEMENTED;
1007c2c66affSColin Finck }
1008c2c66affSColin Finck 
1009c2c66affSColin Finck HIDAPI
1010c2c66affSColin Finck NTSTATUS
1011c2c66affSColin Finck NTAPI
HidParser_SetUsages(IN PVOID CollectionContext,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)1012c2c66affSColin Finck HidParser_SetUsages(
1013c2c66affSColin Finck     IN PVOID CollectionContext,
1014c2c66affSColin Finck     IN HIDP_REPORT_TYPE  ReportType,
1015c2c66affSColin Finck     IN USAGE  UsagePage,
1016c2c66affSColin Finck     IN USHORT  LinkCollection,
1017c2c66affSColin Finck     IN PUSAGE  UsageList,
1018c2c66affSColin Finck     IN OUT PULONG  UsageLength,
1019c2c66affSColin Finck     IN OUT PCHAR  Report,
1020c2c66affSColin Finck     IN ULONG  ReportLength)
1021c2c66affSColin Finck {
1022c2c66affSColin Finck     UNIMPLEMENTED;
1023c2c66affSColin Finck     ASSERT(FALSE);
1024c2c66affSColin Finck     return STATUS_NOT_IMPLEMENTED;
1025c2c66affSColin Finck }
1026c2c66affSColin Finck 
1027c2c66affSColin Finck HIDAPI
1028c2c66affSColin Finck NTSTATUS
1029c2c66affSColin Finck NTAPI
HidParser_SetUsageValueArray(IN PVOID CollectionContext,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)1030c2c66affSColin Finck HidParser_SetUsageValueArray(
1031c2c66affSColin Finck     IN PVOID CollectionContext,
1032c2c66affSColin Finck     IN HIDP_REPORT_TYPE  ReportType,
1033c2c66affSColin Finck     IN USAGE  UsagePage,
1034c2c66affSColin Finck     IN USHORT  LinkCollection  OPTIONAL,
1035c2c66affSColin Finck     IN USAGE  Usage,
1036c2c66affSColin Finck     IN PCHAR  UsageValue,
1037c2c66affSColin Finck     IN USHORT  UsageValueByteLength,
1038c2c66affSColin Finck     OUT PCHAR  Report,
1039c2c66affSColin Finck     IN ULONG  ReportLength)
1040c2c66affSColin Finck {
1041c2c66affSColin Finck     UNIMPLEMENTED;
1042c2c66affSColin Finck     ASSERT(FALSE);
1043c2c66affSColin Finck     return STATUS_NOT_IMPLEMENTED;
1044c2c66affSColin Finck }
1045c2c66affSColin Finck 
1046c2c66affSColin Finck HIDAPI
1047c2c66affSColin Finck NTSTATUS
1048c2c66affSColin Finck NTAPI
HidParser_SetUsageValue(IN PVOID CollectionContext,IN HIDP_REPORT_TYPE ReportType,IN USAGE UsagePage,IN USHORT LinkCollection,IN USAGE Usage,IN ULONG UsageValue,IN OUT PCHAR Report,IN ULONG ReportLength)1049c2c66affSColin Finck HidParser_SetUsageValue(
1050c2c66affSColin Finck     IN PVOID CollectionContext,
1051c2c66affSColin Finck     IN HIDP_REPORT_TYPE  ReportType,
1052c2c66affSColin Finck     IN USAGE  UsagePage,
1053c2c66affSColin Finck     IN USHORT  LinkCollection,
1054c2c66affSColin Finck     IN USAGE  Usage,
1055c2c66affSColin Finck     IN ULONG  UsageValue,
1056c2c66affSColin Finck     IN OUT PCHAR  Report,
1057c2c66affSColin Finck     IN ULONG  ReportLength)
1058c2c66affSColin Finck {
1059c2c66affSColin Finck     UNIMPLEMENTED;
1060c2c66affSColin Finck     ASSERT(FALSE);
1061c2c66affSColin Finck     return STATUS_NOT_IMPLEMENTED;
1062c2c66affSColin Finck }
1063c2c66affSColin Finck 
1064c2c66affSColin Finck HIDAPI
1065c2c66affSColin Finck NTSTATUS
1066c2c66affSColin Finck NTAPI
HidParser_SetScaledUsageValue(IN PVOID CollectionContext,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)1067c2c66affSColin Finck HidParser_SetScaledUsageValue(
1068c2c66affSColin Finck     IN PVOID CollectionContext,
1069c2c66affSColin Finck     IN HIDP_REPORT_TYPE  ReportType,
1070c2c66affSColin Finck     IN USAGE  UsagePage,
1071c2c66affSColin Finck     IN USHORT  LinkCollection  OPTIONAL,
1072c2c66affSColin Finck     IN USAGE  Usage,
1073c2c66affSColin Finck     IN LONG  UsageValue,
1074c2c66affSColin Finck     IN OUT PCHAR  Report,
1075c2c66affSColin Finck     IN ULONG  ReportLength)
1076c2c66affSColin Finck {
1077c2c66affSColin Finck     UNIMPLEMENTED;
1078c2c66affSColin Finck     ASSERT(FALSE);
1079c2c66affSColin Finck     return STATUS_NOT_IMPLEMENTED;
1080c2c66affSColin Finck }
1081c2c66affSColin Finck 
1082c2c66affSColin Finck HIDAPI
1083c2c66affSColin Finck NTSTATUS
1084c2c66affSColin Finck NTAPI
HidParser_SetData(IN PVOID CollectionContext,IN HIDP_REPORT_TYPE ReportType,IN PHIDP_DATA DataList,IN OUT PULONG DataLength,IN OUT PCHAR Report,IN ULONG ReportLength)1085c2c66affSColin Finck HidParser_SetData(
1086c2c66affSColin Finck     IN PVOID CollectionContext,
1087c2c66affSColin Finck     IN HIDP_REPORT_TYPE  ReportType,
1088c2c66affSColin Finck     IN PHIDP_DATA  DataList,
1089c2c66affSColin Finck     IN OUT PULONG  DataLength,
1090c2c66affSColin Finck     IN OUT PCHAR  Report,
1091c2c66affSColin Finck     IN ULONG  ReportLength)
1092c2c66affSColin Finck {
1093c2c66affSColin Finck     UNIMPLEMENTED;
1094c2c66affSColin Finck     ASSERT(FALSE);
1095c2c66affSColin Finck     return STATUS_NOT_IMPLEMENTED;
1096c2c66affSColin Finck }
1097c2c66affSColin Finck 
1098c2c66affSColin Finck HIDAPI
1099c2c66affSColin Finck ULONG
1100c2c66affSColin Finck NTAPI
HidParser_MaxDataListLength(IN PVOID CollectionContext,IN HIDP_REPORT_TYPE ReportType)1101c2c66affSColin Finck HidParser_MaxDataListLength(
1102c2c66affSColin Finck     IN PVOID CollectionContext,
1103c2c66affSColin Finck     IN HIDP_REPORT_TYPE  ReportType)
1104c2c66affSColin Finck {
1105c2c66affSColin Finck     UNIMPLEMENTED;
1106c2c66affSColin Finck     ASSERT(FALSE);
1107c2c66affSColin Finck     return 0;
1108c2c66affSColin Finck }
1109c2c66affSColin Finck 
1110c2c66affSColin Finck HIDAPI
1111c2c66affSColin Finck NTSTATUS
1112c2c66affSColin Finck NTAPI
HidParser_InitializeReportForID(IN PVOID CollectionContext,IN HIDP_REPORT_TYPE ReportType,IN UCHAR ReportID,IN OUT PCHAR Report,IN ULONG ReportLength)1113c2c66affSColin Finck HidParser_InitializeReportForID(
1114c2c66affSColin Finck     IN PVOID CollectionContext,
1115c2c66affSColin Finck     IN HIDP_REPORT_TYPE  ReportType,
1116c2c66affSColin Finck     IN UCHAR  ReportID,
1117c2c66affSColin Finck     IN OUT PCHAR  Report,
1118c2c66affSColin Finck     IN ULONG  ReportLength)
1119c2c66affSColin Finck {
1120c2c66affSColin Finck     UNIMPLEMENTED;
1121c2c66affSColin Finck     ASSERT(FALSE);
1122c2c66affSColin Finck     return STATUS_NOT_IMPLEMENTED;
1123c2c66affSColin Finck }
1124c2c66affSColin Finck 
1125c2c66affSColin Finck #undef HidParser_GetValueCaps
1126c2c66affSColin Finck 
1127c2c66affSColin Finck HIDAPI
1128c2c66affSColin Finck NTSTATUS
1129c2c66affSColin Finck NTAPI
HidParser_GetValueCaps(IN PVOID CollectionContext,HIDP_REPORT_TYPE ReportType,PHIDP_VALUE_CAPS ValueCaps,PULONG ValueCapsLength)1130c2c66affSColin Finck HidParser_GetValueCaps(
1131c2c66affSColin Finck     IN PVOID CollectionContext,
1132c2c66affSColin Finck     HIDP_REPORT_TYPE ReportType,
1133c2c66affSColin Finck     PHIDP_VALUE_CAPS ValueCaps,
1134c2c66affSColin Finck     PULONG ValueCapsLength)
1135c2c66affSColin Finck {
1136c2c66affSColin Finck     UNIMPLEMENTED;
1137c2c66affSColin Finck     ASSERT(FALSE);
1138c2c66affSColin Finck     return STATUS_NOT_IMPLEMENTED;
1139c2c66affSColin Finck }
1140