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