ReactOS  0.4.14-dev-854-gb9426a3
hidparser.c File Reference
#include "parser.h"
#include <debug.h>
Include dependency graph for hidparser.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

NTSTATUS TranslateHidParserStatus (IN HIDPARSER_STATUS Status)
 
NTSTATUS NTAPI HidParser_GetCollectionDescription (IN PHID_PARSER Parser, IN PHIDP_REPORT_DESCRIPTOR ReportDesc, IN ULONG DescLength, IN POOL_TYPE PoolType, OUT PHIDP_DEVICE_DESC DeviceDescription)
 
VOID NTAPI HidParser_FreeCollectionDescription (IN PHID_PARSER Parser, IN PHIDP_DEVICE_DESC DeviceDescription)
 
HIDAPI NTSTATUS NTAPI HidParser_GetCaps (IN PHID_PARSER Parser, IN PVOID CollectionContext, OUT PHIDP_CAPS Capabilities)
 
HIDAPI ULONG NTAPI HidParser_MaxUsageListLength (IN PHID_PARSER Parser, IN PVOID CollectionContext, IN HIDP_REPORT_TYPE ReportType, IN USAGE UsagePage OPTIONAL)
 
HIDAPI NTSTATUS NTAPI HidParser_GetButtonCaps (IN PHID_PARSER Parser, IN PVOID CollectionContext, IN HIDP_REPORT_TYPE ReportType, IN PHIDP_BUTTON_CAPS ButtonCaps, IN PUSHORT ButtonCapsLength)
 
HIDAPI NTSTATUS NTAPI HidParser_GetSpecificValueCaps (IN PHID_PARSER Parser, 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)
 
HIDAPI NTSTATUS NTAPI HidParser_UsageListDifference (IN PUSAGE PreviousUsageList, IN PUSAGE CurrentUsageList, OUT PUSAGE BreakUsageList, OUT PUSAGE MakeUsageList, IN ULONG UsageListLength)
 
HIDAPI NTSTATUS NTAPI HidParser_GetUsages (IN PHID_PARSER Parser, 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)
 
HIDAPI NTSTATUS NTAPI HidParser_GetScaledUsageValue (IN PHID_PARSER Parser, 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)
 
HIDAPI NTSTATUS NTAPI HidParser_TranslateUsageAndPagesToI8042ScanCodes (IN PHID_PARSER Parser, 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)
 
HIDAPI NTSTATUS NTAPI HidParser_GetUsagesEx (IN PHID_PARSER Parser, 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)
 
HIDAPI NTSTATUS 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)
 
HIDAPI NTSTATUS NTAPI HidParser_GetSpecificButtonCaps (IN PHID_PARSER Parser, 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)
 
HIDAPI NTSTATUS NTAPI HidParser_GetData (IN PHID_PARSER Parser, IN PVOID CollectionContext, IN HIDP_REPORT_TYPE ReportType, OUT PHIDP_DATA DataList, IN OUT PULONG DataLength, IN PCHAR Report, IN ULONG ReportLength)
 
HIDAPI NTSTATUS NTAPI HidParser_GetExtendedAttributes (IN PHID_PARSER Parser, IN PVOID CollectionContext, IN HIDP_REPORT_TYPE ReportType, IN USHORT DataIndex, OUT PHIDP_EXTENDED_ATTRIBUTES Attributes, IN OUT PULONG LengthAttributes)
 
HIDAPI NTSTATUS NTAPI HidParser_GetLinkCollectionNodes (IN PHID_PARSER Parser, IN PVOID CollectionContext, OUT PHIDP_LINK_COLLECTION_NODE LinkCollectionNodes, IN OUT PULONG LinkCollectionNodesLength)
 
HIDAPI NTSTATUS NTAPI HidParser_GetUsageValue (IN PHID_PARSER Parser, 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)
 
NTSTATUS NTAPI HidParser_SysPowerEvent (IN PHID_PARSER Parser, IN PVOID CollectionContext, IN PCHAR HidPacket, IN USHORT HidPacketLength, OUT PULONG OutputBuffer)
 
NTSTATUS NTAPI HidParser_SysPowerCaps (IN PHID_PARSER Parser, IN PVOID CollectionContext, OUT PULONG OutputBuffer)
 
HIDAPI NTSTATUS NTAPI HidParser_GetUsageValueArray (IN PHID_PARSER Parser, 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)
 
HIDAPI NTSTATUS NTAPI HidParser_UnsetUsages (IN PHID_PARSER Parser, 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)
 
HIDAPI NTSTATUS 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)
 
HIDAPI NTSTATUS NTAPI HidParser_SetUsages (IN PHID_PARSER Parser, 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)
 
HIDAPI NTSTATUS NTAPI HidParser_SetUsageValueArray (IN PHID_PARSER Parser, 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)
 
HIDAPI NTSTATUS NTAPI HidParser_SetUsageValue (IN PHID_PARSER Parser, 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)
 
HIDAPI NTSTATUS NTAPI HidParser_SetScaledUsageValue (IN PHID_PARSER Parser, 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)
 
HIDAPI NTSTATUS NTAPI HidParser_SetData (IN PHID_PARSER Parser, IN PVOID CollectionContext, IN HIDP_REPORT_TYPE ReportType, IN PHIDP_DATA DataList, IN OUT PULONG DataLength, IN OUT PCHAR Report, IN ULONG ReportLength)
 
HIDAPI ULONG NTAPI HidParser_MaxDataListLength (IN PHID_PARSER Parser, IN PVOID CollectionContext, IN HIDP_REPORT_TYPE ReportType)
 
HIDAPI NTSTATUS NTAPI HidParser_InitializeReportForID (IN PHID_PARSER Parser, IN PVOID CollectionContext, IN HIDP_REPORT_TYPE ReportType, IN UCHAR ReportID, IN OUT PCHAR Report, IN ULONG ReportLength)
 
HIDAPI NTSTATUS NTAPI HidParser_GetValueCaps (IN PHID_PARSER Parser, IN PVOID CollectionContext, HIDP_REPORT_TYPE ReportType, PHIDP_VALUE_CAPS ValueCaps, PULONG ValueCapsLength)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 13 of file hidparser.c.

Function Documentation

◆ HidParser_FreeCollectionDescription()

VOID NTAPI HidParser_FreeCollectionDescription ( IN PHID_PARSER  Parser,
IN PHIDP_DEVICE_DESC  DeviceDescription 
)

Definition at line 195 of file hidparser.c.

198 {
199  ULONG Index;
200 
201  //
202  // first free all context
203  //
204  for(Index = 0; Index < DeviceDescription->CollectionDescLength; Index++)
205  {
206  //
207  // free collection context
208  //
209  Parser->Free(DeviceDescription->CollectionDesc[Index].PreparsedData);
210  }
211 
212  //
213  // now free collection description
214  //
215  Parser->Free(DeviceDescription->CollectionDesc);
216 
217  //
218  // free report description
219  //
220  Parser->Free(DeviceDescription->ReportIDs);
221 }
_Must_inspect_result_ _In_ PDEVICE_DESCRIPTION DeviceDescription
Definition: iofuncs.h:1015
static const UCHAR Index[8]
Definition: usbohci.c:18
unsigned int ULONG
Definition: retypes.h:1

Referenced by HidP_FreeCollectionDescription().

◆ HidParser_GetButtonCaps()

HIDAPI NTSTATUS NTAPI HidParser_GetButtonCaps ( IN PHID_PARSER  Parser,
IN PVOID  CollectionContext,
IN HIDP_REPORT_TYPE  ReportType,
IN PHIDP_BUTTON_CAPS  ButtonCaps,
IN PUSHORT  ButtonCapsLength 
)

Definition at line 344 of file hidparser.c.

350 {
352 }
_Must_inspect_result_ _In_ USAGE _In_ USHORT _In_ USAGE _Out_ PHIDP_BUTTON_CAPS _Inout_ PUSHORT ButtonCapsLength
Definition: hidpi.h:382
HIDAPI NTSTATUS NTAPI HidParser_GetSpecificButtonCaps(IN PHID_PARSER Parser, 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)
Definition: hidparser.c:892
#define HIDP_LINK_COLLECTION_UNSPECIFIED
Definition: hidpi.h:185
_Must_inspect_result_ _In_ USAGE _In_ USHORT _In_ USAGE _Out_ PHIDP_BUTTON_CAPS ButtonCaps
Definition: hidpi.h:382
#define HID_USAGE_PAGE_UNDEFINED
Definition: hidusage.h:175
unsigned int * PULONG
Definition: retypes.h:1

◆ HidParser_GetCaps()

HIDAPI NTSTATUS NTAPI HidParser_GetCaps ( IN PHID_PARSER  Parser,
IN PVOID  CollectionContext,
OUT PHIDP_CAPS  Capabilities 
)

Definition at line 226 of file hidparser.c.

230 {
231  //
232  // zero capabilities
233  //
234  Parser->Zero(Capabilities, sizeof(HIDP_CAPS));
235 
236  //
237  // init capabilities
238  //
243 
244  //
245  // always pre-prend report id
246  //
250 
251  //
252  // get number of link collection nodes
253  //
255 
256  //
257  // get data indices
258  //
262 
263  //
264  // get value caps
265  //
269 
270 
271  //
272  // get button caps
273  //
277 
278  //
279  // done
280  //
281  return HIDP_STATUS_SUCCESS;
282 }
USHORT NumberInputButtonCaps
Definition: hidpi.h:157
USHORT NumberInputValueCaps
Definition: hidpi.h:158
#define TRUE
Definition: types.h:120
USHORT NumberOutputButtonCaps
Definition: hidpi.h:160
USHORT OutputReportByteLength
Definition: hidpi.h:153
USHORT NumberLinkCollectionNodes
Definition: hidpi.h:156
USHORT NumberFeatureButtonCaps
Definition: hidpi.h:163
_Must_inspect_result_ typedef _Out_ PHIDP_CAPS Capabilities
Definition: hidclass.h:103
ULONG HidParser_GetReportItemCountFromReportType(IN PVOID CollectionContext, IN UCHAR ReportType)
Definition: api.c:132
USHORT NumberFeatureDataIndices
Definition: hidpi.h:165
#define HID_REPORT_TYPE_INPUT
USHORT NumberOutputValueCaps
Definition: hidpi.h:161
ULONG HidParser_GetReportLength(IN PVOID CollectionContext, IN UCHAR ReportType)
Definition: api.c:93
#define HID_REPORT_TYPE_OUTPUT
#define HID_REPORT_TYPE_FEATURE
USAGE UsagePage
Definition: hidpi.h:151
USHORT FeatureReportByteLength
Definition: hidpi.h:154
USHORT NumberFeatureValueCaps
Definition: hidpi.h:164
USHORT NumberOutputDataIndices
Definition: hidpi.h:162
HIDPARSER_STATUS HidParser_GetCollectionUsagePage(IN PVOID CollectionContext, OUT PUSHORT Usage, OUT PUSHORT UsagePage)
Definition: api.c:65
USAGE Usage
Definition: hidpi.h:150
ULONG HidParser_GetTotalCollectionCount(IN PVOID Context)
Definition: context.c:332
USHORT NumberInputDataIndices
Definition: hidpi.h:159
#define HIDP_STATUS_SUCCESS
Definition: hidpi.h:248
USHORT InputReportByteLength
Definition: hidpi.h:152
ULONG HidParser_GetReportItemTypeCountFromReportType(IN PVOID CollectionContext, IN UCHAR ReportType, IN ULONG bData)
Definition: api.c:158

Referenced by HidP_GetCaps().

◆ HidParser_GetCollectionDescription()

NTSTATUS NTAPI HidParser_GetCollectionDescription ( IN PHID_PARSER  Parser,
IN PHIDP_REPORT_DESCRIPTOR  ReportDesc,
IN ULONG  DescLength,
IN POOL_TYPE  PoolType,
OUT PHIDP_DEVICE_DESC  DeviceDescription 
)

Definition at line 49 of file hidparser.c.

55 {
56  HIDPARSER_STATUS ParserStatus;
57  ULONG CollectionCount;
58  ULONG Index;
59  PVOID ParserContext;
60 
61  //
62  // first parse the report descriptor
63  //
64  ParserStatus = HidParser_ParseReportDescriptor(Parser, ReportDesc, DescLength, &ParserContext);
65  if (ParserStatus != HIDPARSER_STATUS_SUCCESS)
66  {
67  //
68  // failed to parse report descriptor
69  //
70  Parser->Debug("[HIDPARSER] Failed to parse report descriptor with %x\n", ParserStatus);
71  return ParserStatus;
72  }
73 
74  //
75  // get collection count
76  //
77  CollectionCount = HidParser_NumberOfTopCollections(ParserContext);
78  if (CollectionCount == 0)
79  {
80  //
81  // no top level collections found
82  //
83  ASSERT(FALSE);
85  }
86 
87  //
88  // zero description
89  //
90  Parser->Zero(DeviceDescription, sizeof(HIDP_DEVICE_DESC));
91 
92  //
93  // allocate collection
94  //
95  DeviceDescription->CollectionDesc = (PHIDP_COLLECTION_DESC)Parser->Alloc(sizeof(HIDP_COLLECTION_DESC) * CollectionCount);
96  if (!DeviceDescription->CollectionDesc)
97  {
98  //
99  // no memory
100  //
102  }
103 
104  //
105  // allocate report description
106  //
107  DeviceDescription->ReportIDs = (PHIDP_REPORT_IDS)Parser->Alloc(sizeof(HIDP_REPORT_IDS) * CollectionCount);
108  if (!DeviceDescription->ReportIDs)
109  {
110  //
111  // no memory
112  //
113  Parser->Free(DeviceDescription->CollectionDesc);
115  }
116 
117  for(Index = 0; Index < CollectionCount; Index++)
118  {
119  //
120  // set preparsed data length
121  //
122  DeviceDescription->CollectionDesc[Index].PreparsedDataLength = HidParser_GetContextSize(Parser, ParserContext, Index);
123  ParserStatus = HidParser_BuildContext(Parser, ParserContext, Index, DeviceDescription->CollectionDesc[Index].PreparsedDataLength, (PVOID*)&DeviceDescription->CollectionDesc[Index].PreparsedData);
124  if (ParserStatus != HIDPARSER_STATUS_SUCCESS)
125  {
126  //
127  // no memory
128  //
129  Parser->Free(DeviceDescription->CollectionDesc);
130  Parser->Free(DeviceDescription->ReportIDs);
131  return ParserStatus;
132  }
133 
134  //
135  // init report description
136  //
137  DeviceDescription->ReportIDs[Index].CollectionNumber = Index + 1;
138  DeviceDescription->ReportIDs[Index].ReportID = Index; //FIXME
139  DeviceDescription->ReportIDs[Index].InputLength = HidParser_GetReportLength((PVOID)DeviceDescription->CollectionDesc[Index].PreparsedData, HID_REPORT_TYPE_INPUT);
140  DeviceDescription->ReportIDs[Index].OutputLength = HidParser_GetReportLength((PVOID)DeviceDescription->CollectionDesc[Index].PreparsedData, HID_REPORT_TYPE_OUTPUT);
141  DeviceDescription->ReportIDs[Index].FeatureLength = HidParser_GetReportLength((PVOID)DeviceDescription->CollectionDesc[Index].PreparsedData, HID_REPORT_TYPE_FEATURE);
142 
143 
144  DeviceDescription->ReportIDs[Index].InputLength += (HidParser_UsesReportId((PVOID)DeviceDescription->CollectionDesc[Index].PreparsedData, HID_REPORT_TYPE_INPUT) ? 1 : 0);
145  DeviceDescription->ReportIDs[Index].OutputLength += (HidParser_UsesReportId((PVOID)DeviceDescription->CollectionDesc[Index].PreparsedData, HID_REPORT_TYPE_OUTPUT) ? 1 : 0);
146  DeviceDescription->ReportIDs[Index].FeatureLength += (HidParser_UsesReportId((PVOID)DeviceDescription->CollectionDesc[Index].PreparsedData, HID_REPORT_TYPE_FEATURE) ? 1 : 0);
147 
148 
149  //
150  // init collection description
151  //
152  DeviceDescription->CollectionDesc[Index].CollectionNumber = Index + 1;
153 
154  //
155  // get collection usage page
156  //
157  ParserStatus = HidParser_GetCollectionUsagePage((PVOID)DeviceDescription->CollectionDesc[Index].PreparsedData, &DeviceDescription->CollectionDesc[Index].Usage, &DeviceDescription->CollectionDesc[Index].UsagePage);
158  if (ParserStatus != HIDPARSER_STATUS_SUCCESS)
159  {
160  // collection not found
161  Parser->Free(DeviceDescription->CollectionDesc);
162  Parser->Free(DeviceDescription->ReportIDs);
163  return ParserStatus;
164  }
165 
166  //
167  // windows seems to prepend the report id, regardless if it is required
168  //
169  DeviceDescription->CollectionDesc[Index].CollectionNumber = Index + 1;
170  DeviceDescription->CollectionDesc[Index].InputLength = DeviceDescription->ReportIDs[Index].InputLength;
171  DeviceDescription->CollectionDesc[Index].OutputLength = DeviceDescription->ReportIDs[Index].OutputLength;
172  DeviceDescription->CollectionDesc[Index].FeatureLength = DeviceDescription->ReportIDs[Index].FeatureLength;
173 
174  DeviceDescription->CollectionDesc[Index].InputLength += (HidParser_UsesReportId((PVOID)DeviceDescription->CollectionDesc[Index].PreparsedData, HID_REPORT_TYPE_INPUT) == FALSE ? 1 : 0);
175  DeviceDescription->CollectionDesc[Index].OutputLength += (HidParser_UsesReportId((PVOID)DeviceDescription->CollectionDesc[Index].PreparsedData, HID_REPORT_TYPE_OUTPUT) == FALSE ? 1 : 0);
176  DeviceDescription->CollectionDesc[Index].FeatureLength += (HidParser_UsesReportId((PVOID)DeviceDescription->CollectionDesc[Index].PreparsedData, HID_REPORT_TYPE_FEATURE) == FALSE ? 1 : 0);
177 
178 
179  }
180 
181  //
182  // store collection & report count
183  //
184  DeviceDescription->CollectionDescLength = CollectionCount;
185  DeviceDescription->ReportIDsLength = CollectionCount;
186 
187  //
188  // done
189  //
190  return STATUS_SUCCESS;
191 }
ULONG HidParser_UsesReportId(IN PVOID CollectionContext, IN UCHAR ReportType)
Definition: api.c:543
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
struct _HIDP_COLLECTION_DESC * PHIDP_COLLECTION_DESC
HIDPARSER_STATUS HidParser_BuildContext(IN PHID_PARSER Parser, IN PVOID ParserContext, IN ULONG CollectionIndex, IN ULONG ContextSize, OUT PVOID *CollectionContext)
Definition: parser.c:1315
ULONG HidParser_NumberOfTopCollections(IN PVOID ParserCtx)
Definition: parser.c:1291
#define HID_REPORT_TYPE_INPUT
ULONG HidParser_GetReportLength(IN PVOID CollectionContext, IN UCHAR ReportType)
Definition: api.c:93
#define HID_REPORT_TYPE_OUTPUT
_Must_inspect_result_ _In_ PDEVICE_DESCRIPTION DeviceDescription
Definition: iofuncs.h:1015
#define HID_REPORT_TYPE_FEATURE
static const UCHAR Index[8]
Definition: usbohci.c:18
HIDPARSER_STATUS HidParser_ParseReportDescriptor(IN PHID_PARSER Parser, IN PUCHAR ReportDescriptor, IN ULONG ReportLength, OUT PVOID *OutParser)
Definition: parser.c:717
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define STATUS_NO_DATA_DETECTED
Definition: udferr_usr.h:131
HIDPARSER_STATUS HidParser_GetCollectionUsagePage(IN PVOID CollectionContext, OUT PUSHORT Usage, OUT PUSHORT UsagePage)
Definition: api.c:65
long HIDPARSER_STATUS
Definition: hidparser.h:25
ULONG HidParser_GetContextSize(IN PHID_PARSER Parser, IN PVOID ParserContext, IN ULONG CollectionIndex)
Definition: parser.c:1364
struct _HIDP_REPORT_IDS * PHIDP_REPORT_IDS
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:2938

Referenced by HidP_GetCollectionDescription().

◆ HidParser_GetData()

HIDAPI NTSTATUS NTAPI HidParser_GetData ( IN PHID_PARSER  Parser,
IN PVOID  CollectionContext,
IN HIDP_REPORT_TYPE  ReportType,
OUT PHIDP_DATA  DataList,
IN OUT PULONG  DataLength,
IN PCHAR  Report,
IN ULONG  ReportLength 
)

Definition at line 911 of file hidparser.c.

919 {
921  ASSERT(FALSE);
922  return STATUS_NOT_IMPLEMENTED;
923 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define UNIMPLEMENTED
Definition: debug.h:114

◆ HidParser_GetExtendedAttributes()

HIDAPI NTSTATUS NTAPI HidParser_GetExtendedAttributes ( IN PHID_PARSER  Parser,
IN PVOID  CollectionContext,
IN HIDP_REPORT_TYPE  ReportType,
IN USHORT  DataIndex,
OUT PHIDP_EXTENDED_ATTRIBUTES  Attributes,
IN OUT PULONG  LengthAttributes 
)

Definition at line 928 of file hidparser.c.

935 {
937  ASSERT(FALSE);
938  return STATUS_NOT_IMPLEMENTED;
939 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define UNIMPLEMENTED
Definition: debug.h:114

◆ HidParser_GetLinkCollectionNodes()

HIDAPI NTSTATUS NTAPI HidParser_GetLinkCollectionNodes ( IN PHID_PARSER  Parser,
IN PVOID  CollectionContext,
OUT PHIDP_LINK_COLLECTION_NODE  LinkCollectionNodes,
IN OUT PULONG  LinkCollectionNodesLength 
)

Definition at line 944 of file hidparser.c.

949 {
951  ASSERT(FALSE);
952  return STATUS_NOT_IMPLEMENTED;
953 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define UNIMPLEMENTED
Definition: debug.h:114

◆ HidParser_GetScaledUsageValue()

HIDAPI NTSTATUS NTAPI HidParser_GetScaledUsageValue ( IN PHID_PARSER  Parser,
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 
)

Definition at line 614 of file hidparser.c.

624 {
625  HIDPARSER_STATUS ParserStatus;
626 
627  //
628  // FIXME: implement searching in specific collection
629  //
631 
632  if (ReportType == HidP_Input)
633  {
634  //
635  // input report
636  //
637  ParserStatus = HidParser_GetScaledUsageValueWithReport(Parser, CollectionContext, HID_REPORT_TYPE_INPUT, UsagePage, Usage, UsageValue, Report, ReportLength);
638  }
639  else if (ReportType == HidP_Output)
640  {
641  //
642  // input report
643  //
644  ParserStatus = HidParser_GetScaledUsageValueWithReport(Parser, CollectionContext, HID_REPORT_TYPE_OUTPUT, UsagePage, Usage, UsageValue, Report, ReportLength);
645  }
646  else if (ReportType == HidP_Feature)
647  {
648  //
649  // input report
650  //
651  ParserStatus = HidParser_GetScaledUsageValueWithReport(Parser, CollectionContext, HID_REPORT_TYPE_FEATURE, UsagePage, Usage, UsageValue, Report, ReportLength);
652  }
653  else
654  {
655  //
656  // invalid report type
657  //
659  }
660 
661  if (ParserStatus == HIDPARSER_STATUS_SUCCESS)
662  {
663  //
664  // success
665  //
666  return HIDP_STATUS_SUCCESS;
667  }
668 
669  //
670  // translate error
671  //
672  return TranslateHidParserStatus(ParserStatus);
673 }
_Must_inspect_result_ _In_ USAGE _In_ USHORT _In_ USAGE Usage
Definition: hidpi.h:382
NTSTATUS TranslateHidParserStatus(IN HIDPARSER_STATUS Status)
Definition: hidparser.c:17
#define HID_REPORT_TYPE_INPUT
HIDPARSER_STATUS HidParser_GetScaledUsageValueWithReport(IN PHID_PARSER Parser, IN PVOID CollectionContext, IN UCHAR ReportType, IN USAGE UsagePage, IN USAGE Usage, OUT PLONG UsageValue, IN PCHAR ReportDescriptor, IN ULONG ReportDescriptorLength)
Definition: api.c:666
_Must_inspect_result_ _In_ USAGE UsagePage
Definition: hidpi.h:382
#define HID_REPORT_TYPE_OUTPUT
#define HID_REPORT_TYPE_FEATURE
#define HIDP_STATUS_INVALID_REPORT_TYPE
Definition: hidpi.h:251
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
_Must_inspect_result_ _Out_writes_to_ DataLength PHIDP_DATA _Inout_ PULONG _In_ PHIDP_PREPARSED_DATA _In_ ULONG ReportLength
Definition: hidpi.h:337
_Must_inspect_result_ _In_ USAGE _In_ USHORT LinkCollection
Definition: hidpi.h:382
#define HIDP_LINK_COLLECTION_UNSPECIFIED
Definition: hidpi.h:185
long HIDPARSER_STATUS
Definition: hidparser.h:25
#define HIDP_STATUS_SUCCESS
Definition: hidpi.h:248

Referenced by HidP_GetScaledUsageValue().

◆ HidParser_GetSpecificButtonCaps()

HIDAPI NTSTATUS NTAPI HidParser_GetSpecificButtonCaps ( IN PHID_PARSER  Parser,
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 
)

Definition at line 892 of file hidparser.c.

901 {
903  ASSERT(FALSE);
904  return STATUS_NOT_IMPLEMENTED;
905 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define UNIMPLEMENTED
Definition: debug.h:114

Referenced by HidParser_GetButtonCaps().

◆ HidParser_GetSpecificValueCaps()

HIDAPI NTSTATUS NTAPI HidParser_GetSpecificValueCaps ( IN PHID_PARSER  Parser,
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 
)

Definition at line 357 of file hidparser.c.

366 {
367  HIDPARSER_STATUS ParserStatus;
368 
369  //
370  // FIXME: implement searching in specific collection
371  //
373 
374  if (ReportType == HidP_Input)
375  {
376  //
377  // input report
378  //
380  }
381  else if (ReportType == HidP_Output)
382  {
383  //
384  // input report
385  //
387  }
388  else if (ReportType == HidP_Feature)
389  {
390  //
391  // input report
392  //
394  }
395  else
396  {
397  //
398  // invalid report type
399  //
401  }
402 
403 
404  if (ParserStatus == HIDPARSER_STATUS_SUCCESS)
405  {
406  //
407  // success
408  //
409  return HIDP_STATUS_SUCCESS;
410  }
411 
412  //
413  // translate error
414  //
415  return TranslateHidParserStatus(ParserStatus);
416 }
HIDPARSER_STATUS HidParser_GetSpecificValueCapsWithReport(IN PHID_PARSER Parser, IN PVOID CollectionContext, IN UCHAR ReportType, IN USHORT UsagePage, IN USHORT Usage, OUT PHIDP_VALUE_CAPS ValueCaps, IN OUT PUSHORT ValueCapsLength)
Definition: api.c:271
_Must_inspect_result_ _In_ USAGE _In_ USHORT _In_ USAGE Usage
Definition: hidpi.h:382
_Must_inspect_result_ _In_ USAGE _In_ USHORT _In_ USAGE _Out_ PHIDP_VALUE_CAPS ValueCaps
Definition: hidpi.h:396
NTSTATUS TranslateHidParserStatus(IN HIDPARSER_STATUS Status)
Definition: hidparser.c:17
#define HID_REPORT_TYPE_INPUT
_Must_inspect_result_ _In_ USAGE UsagePage
Definition: hidpi.h:382
#define HID_REPORT_TYPE_OUTPUT
#define HID_REPORT_TYPE_FEATURE
#define HIDP_STATUS_INVALID_REPORT_TYPE
Definition: hidpi.h:251
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
_Must_inspect_result_ _In_ USAGE _In_ USHORT LinkCollection
Definition: hidpi.h:382
#define HIDP_LINK_COLLECTION_UNSPECIFIED
Definition: hidpi.h:185
long HIDPARSER_STATUS
Definition: hidparser.h:25
#define HIDP_STATUS_SUCCESS
Definition: hidpi.h:248
_Must_inspect_result_ _In_ USAGE _In_ USHORT _In_ USAGE _Out_ PHIDP_VALUE_CAPS _Inout_ PUSHORT ValueCapsLength
Definition: hidpi.h:396

Referenced by HidP_GetSpecificValueCaps().

◆ HidParser_GetUsages()

HIDAPI NTSTATUS NTAPI HidParser_GetUsages ( IN PHID_PARSER  Parser,
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 
)

Definition at line 550 of file hidparser.c.

560 {
561  HIDPARSER_STATUS ParserStatus;
562 
563  //
564  // FIXME: implement searching in specific collection
565  //
567 
568  if (ReportType == HidP_Input)
569  {
570  //
571  // input report
572  //
573  ParserStatus = HidParser_GetUsagesWithReport(Parser, CollectionContext, HID_REPORT_TYPE_INPUT, UsagePage, UsageList, UsageLength, Report, ReportLength);
574  }
575  else if (ReportType == HidP_Output)
576  {
577  //
578  // input report
579  //
580  ParserStatus = HidParser_GetUsagesWithReport(Parser, CollectionContext, HID_REPORT_TYPE_OUTPUT, UsagePage, UsageList, UsageLength, Report, ReportLength);
581  }
582  else if (ReportType == HidP_Feature)
583  {
584  //
585  // input report
586  //
587  ParserStatus = HidParser_GetUsagesWithReport(Parser, CollectionContext, HID_REPORT_TYPE_FEATURE, UsagePage, UsageList, UsageLength, Report, ReportLength);
588  }
589  else
590  {
591  //
592  // invalid report type
593  //
595  }
596 
597  if (ParserStatus == HIDPARSER_STATUS_SUCCESS)
598  {
599  //
600  // success
601  //
602  return HIDP_STATUS_SUCCESS;
603  }
604 
605  //
606  // translate error
607  //
608  return TranslateHidParserStatus(ParserStatus);
609 }
HIDPARSER_STATUS HidParser_GetUsagesWithReport(IN PHID_PARSER Parser, IN PVOID CollectionContext, IN UCHAR ReportType, IN USAGE UsagePage, OUT USAGE *UsageList, IN OUT PULONG UsageLength, IN PCHAR ReportDescriptor, IN ULONG ReportDescriptorLength)
Definition: api.c:361
_Must_inspect_result_ _In_ USHORT _Inout_updates_to_ UsageLength PUSAGE_AND_PAGE _Inout_ ULONG * UsageLength
Definition: hidpi.h:425
NTSTATUS TranslateHidParserStatus(IN HIDPARSER_STATUS Status)
Definition: hidparser.c:17
#define HID_REPORT_TYPE_INPUT
_Must_inspect_result_ _In_ USAGE UsagePage
Definition: hidpi.h:382
#define HID_REPORT_TYPE_OUTPUT
#define HID_REPORT_TYPE_FEATURE
#define HIDP_STATUS_INVALID_REPORT_TYPE
Definition: hidpi.h:251
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
_Must_inspect_result_ _Out_writes_to_ DataLength PHIDP_DATA _Inout_ PULONG _In_ PHIDP_PREPARSED_DATA _In_ ULONG ReportLength
Definition: hidpi.h:337
_Must_inspect_result_ _In_ USAGE _In_ USHORT LinkCollection
Definition: hidpi.h:382
#define HIDP_LINK_COLLECTION_UNSPECIFIED
Definition: hidpi.h:185
long HIDPARSER_STATUS
Definition: hidparser.h:25
#define HIDP_STATUS_SUCCESS
Definition: hidpi.h:248

Referenced by HidP_GetUsages(), and HidParser_GetUsagesEx().

◆ HidParser_GetUsagesEx()

HIDAPI NTSTATUS NTAPI HidParser_GetUsagesEx ( IN PHID_PARSER  Parser,
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 
)

Definition at line 747 of file hidparser.c.

756 {
757  return HidParser_GetUsages(Parser, CollectionContext, ReportType, HID_USAGE_PAGE_UNDEFINED, LinkCollection, (PUSAGE)ButtonList, UsageLength, Report, ReportLength);
758 }
_Must_inspect_result_ _In_ USHORT _Inout_updates_to_ UsageLength PUSAGE_AND_PAGE _Inout_ ULONG * UsageLength
Definition: hidpi.h:425
USHORT * PUSAGE
Definition: hidusage.h:30
_Must_inspect_result_ _In_ USHORT _Inout_updates_to_ UsageLength PUSAGE_AND_PAGE ButtonList
Definition: hidpi.h:425
_Must_inspect_result_ _Out_writes_to_ DataLength PHIDP_DATA _Inout_ PULONG _In_ PHIDP_PREPARSED_DATA _In_ ULONG ReportLength
Definition: hidpi.h:337
_Must_inspect_result_ _In_ USAGE _In_ USHORT LinkCollection
Definition: hidpi.h:382
#define HID_USAGE_PAGE_UNDEFINED
Definition: hidusage.h:175
HIDAPI NTSTATUS NTAPI HidParser_GetUsages(IN PHID_PARSER Parser, 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)
Definition: hidparser.c:550

◆ HidParser_GetUsageValue()

HIDAPI NTSTATUS NTAPI HidParser_GetUsageValue ( IN PHID_PARSER  Parser,
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 
)

Definition at line 958 of file hidparser.c.

968 {
969  HIDPARSER_STATUS ParserStatus;
970 
971  //
972  // FIXME: implement searching in specific collection
973  //
975 
976  if (ReportType == HidP_Input)
977  {
978  //
979  // input report
980  //
981  ParserStatus = HidParser_GetUsageValueWithReport(Parser, CollectionContext, HID_REPORT_TYPE_INPUT, UsagePage, Usage, UsageValue, Report, ReportLength);
982  }
983  else if (ReportType == HidP_Output)
984  {
985  //
986  // input report
987  //
988  ParserStatus = HidParser_GetUsageValueWithReport(Parser, CollectionContext, HID_REPORT_TYPE_OUTPUT, UsagePage, Usage, UsageValue, Report, ReportLength);
989  }
990  else if (ReportType == HidP_Feature)
991  {
992  //
993  // input report
994  //
995  ParserStatus = HidParser_GetUsageValueWithReport(Parser, CollectionContext, HID_REPORT_TYPE_FEATURE, UsagePage, Usage, UsageValue, Report, ReportLength);
996  }
997  else
998  {
999  //
1000  // invalid report type
1001  //
1003  }
1004 
1005  if (ParserStatus == HIDPARSER_STATUS_SUCCESS)
1006  {
1007  //
1008  // success
1009  //
1010  return HIDP_STATUS_SUCCESS;
1011  }
1012 
1013  //
1014  // translate error
1015  //
1016  return TranslateHidParserStatus(ParserStatus);
1017 }
HIDPARSER_STATUS HidParser_GetUsageValueWithReport(IN PHID_PARSER Parser, IN PVOID CollectionContext, IN UCHAR ReportType, IN USAGE UsagePage, IN USAGE Usage, OUT PULONG UsageValue, IN PCHAR ReportDescriptor, IN ULONG ReportDescriptorLength)
Definition: api.c:569
_Must_inspect_result_ _In_ USAGE _In_ USHORT _In_ USAGE Usage
Definition: hidpi.h:382
NTSTATUS TranslateHidParserStatus(IN HIDPARSER_STATUS Status)
Definition: hidparser.c:17
#define HID_REPORT_TYPE_INPUT
_Must_inspect_result_ _In_ USAGE UsagePage
Definition: hidpi.h:382
#define HID_REPORT_TYPE_OUTPUT
#define HID_REPORT_TYPE_FEATURE
#define HIDP_STATUS_INVALID_REPORT_TYPE
Definition: hidpi.h:251
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
_Must_inspect_result_ _Out_writes_to_ DataLength PHIDP_DATA _Inout_ PULONG _In_ PHIDP_PREPARSED_DATA _In_ ULONG ReportLength
Definition: hidpi.h:337
_Must_inspect_result_ _In_ USAGE _In_ USHORT LinkCollection
Definition: hidpi.h:382
#define HIDP_LINK_COLLECTION_UNSPECIFIED
Definition: hidpi.h:185
long HIDPARSER_STATUS
Definition: hidparser.h:25
#define HIDP_STATUS_SUCCESS
Definition: hidpi.h:248

Referenced by HidP_GetUsageValue().

◆ HidParser_GetUsageValueArray()

HIDAPI NTSTATUS NTAPI HidParser_GetUsageValueArray ( IN PHID_PARSER  Parser,
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 
)

Definition at line 1048 of file hidparser.c.

1059 {
1060  UNIMPLEMENTED;
1061  ASSERT(FALSE);
1062  return STATUS_NOT_IMPLEMENTED;
1063 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define UNIMPLEMENTED
Definition: debug.h:114

◆ HidParser_GetValueCaps()

HIDAPI NTSTATUS NTAPI HidParser_GetValueCaps ( IN PHID_PARSER  Parser,
IN PVOID  CollectionContext,
HIDP_REPORT_TYPE  ReportType,
PHIDP_VALUE_CAPS  ValueCaps,
PULONG  ValueCapsLength 
)

Definition at line 1228 of file hidparser.c.

1234 {
1235  UNIMPLEMENTED;
1236  ASSERT(FALSE);
1237  return STATUS_NOT_IMPLEMENTED;
1238 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define UNIMPLEMENTED
Definition: debug.h:114

◆ HidParser_InitializeReportForID()

HIDAPI NTSTATUS NTAPI HidParser_InitializeReportForID ( IN PHID_PARSER  Parser,
IN PVOID  CollectionContext,
IN HIDP_REPORT_TYPE  ReportType,
IN UCHAR  ReportID,
IN OUT PCHAR  Report,
IN ULONG  ReportLength 
)

Definition at line 1210 of file hidparser.c.

1217 {
1218  UNIMPLEMENTED;
1219  ASSERT(FALSE);
1220  return STATUS_NOT_IMPLEMENTED;
1221 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define UNIMPLEMENTED
Definition: debug.h:114

◆ HidParser_MaxDataListLength()

HIDAPI ULONG NTAPI HidParser_MaxDataListLength ( IN PHID_PARSER  Parser,
IN PVOID  CollectionContext,
IN HIDP_REPORT_TYPE  ReportType 
)

Definition at line 1197 of file hidparser.c.

1201 {
1202  UNIMPLEMENTED;
1203  ASSERT(FALSE);
1204  return 0;
1205 }
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define UNIMPLEMENTED
Definition: debug.h:114

◆ HidParser_MaxUsageListLength()

HIDAPI ULONG NTAPI HidParser_MaxUsageListLength ( IN PHID_PARSER  Parser,
IN PVOID  CollectionContext,
IN HIDP_REPORT_TYPE  ReportType,
IN USAGE UsagePage  OPTIONAL 
)

Definition at line 287 of file hidparser.c.

292 {
293  //
294  // FIXME test what should be returned when usage page is not defined
295  //
297  {
298  //
299  // implement me
300  //
302 
303  //
304  // invalid report
305  //
306  return 0;
307  }
308 
309  if (ReportType == HidP_Input)
310  {
311  //
312  // input report
313  //
315  }
316  else if (ReportType == HidP_Output)
317  {
318  //
319  // input report
320  //
322  }
323  else if (ReportType == HidP_Feature)
324  {
325  //
326  // input report
327  //
329  }
330  else
331  {
332  //
333  // invalid report type
334  //
335  return 0;
336  }
337 }
#define HID_REPORT_TYPE_INPUT
_Must_inspect_result_ _In_ USAGE UsagePage
Definition: hidpi.h:382
#define HID_REPORT_TYPE_OUTPUT
#define HID_REPORT_TYPE_FEATURE
ULONG HidParser_GetMaxUsageListLengthWithReportAndPage(IN PVOID CollectionContext, IN UCHAR ReportType, IN USAGE UsagePage OPTIONAL)
Definition: api.c:227
#define HID_USAGE_PAGE_UNDEFINED
Definition: hidusage.h:175
#define UNIMPLEMENTED
Definition: debug.h:114

Referenced by HidP_MaxUsageListLength().

◆ HidParser_SetData()

HIDAPI NTSTATUS NTAPI HidParser_SetData ( IN PHID_PARSER  Parser,
IN PVOID  CollectionContext,
IN HIDP_REPORT_TYPE  ReportType,
IN PHIDP_DATA  DataList,
IN OUT PULONG  DataLength,
IN OUT PCHAR  Report,
IN ULONG  ReportLength 
)

Definition at line 1180 of file hidparser.c.

1188 {
1189  UNIMPLEMENTED;
1190  ASSERT(FALSE);
1191  return STATUS_NOT_IMPLEMENTED;
1192 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define UNIMPLEMENTED
Definition: debug.h:114

◆ HidParser_SetScaledUsageValue()

HIDAPI NTSTATUS NTAPI HidParser_SetScaledUsageValue ( IN PHID_PARSER  Parser,
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 
)

Definition at line 1161 of file hidparser.c.

1171 {
1172  UNIMPLEMENTED;
1173  ASSERT(FALSE);
1174  return STATUS_NOT_IMPLEMENTED;
1175 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define UNIMPLEMENTED
Definition: debug.h:114

◆ HidParser_SetUsages()

HIDAPI NTSTATUS NTAPI HidParser_SetUsages ( IN PHID_PARSER  Parser,
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 
)

Definition at line 1103 of file hidparser.c.

1113 {
1114  UNIMPLEMENTED;
1115  ASSERT(FALSE);
1116  return STATUS_NOT_IMPLEMENTED;
1117 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define UNIMPLEMENTED
Definition: debug.h:114

◆ HidParser_SetUsageValue()

HIDAPI NTSTATUS NTAPI HidParser_SetUsageValue ( IN PHID_PARSER  Parser,
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 
)

Definition at line 1142 of file hidparser.c.

1152 {
1153  UNIMPLEMENTED;
1154  ASSERT(FALSE);
1155  return STATUS_NOT_IMPLEMENTED;
1156 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define UNIMPLEMENTED
Definition: debug.h:114

◆ HidParser_SetUsageValueArray()

HIDAPI NTSTATUS NTAPI HidParser_SetUsageValueArray ( IN PHID_PARSER  Parser,
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 
)

Definition at line 1122 of file hidparser.c.

1133 {
1134  UNIMPLEMENTED;
1135  ASSERT(FALSE);
1136  return STATUS_NOT_IMPLEMENTED;
1137 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define UNIMPLEMENTED
Definition: debug.h:114

◆ HidParser_SysPowerCaps()

NTSTATUS NTAPI HidParser_SysPowerCaps ( IN PHID_PARSER  Parser,
IN PVOID  CollectionContext,
OUT PULONG  OutputBuffer 
)

Definition at line 1035 of file hidparser.c.

1039 {
1040  UNIMPLEMENTED;
1041  ASSERT(FALSE);
1042  return STATUS_NOT_IMPLEMENTED;
1043 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define UNIMPLEMENTED
Definition: debug.h:114

◆ HidParser_SysPowerEvent()

NTSTATUS NTAPI HidParser_SysPowerEvent ( IN PHID_PARSER  Parser,
IN PVOID  CollectionContext,
IN PCHAR  HidPacket,
IN USHORT  HidPacketLength,
OUT PULONG  OutputBuffer 
)

Definition at line 1021 of file hidparser.c.

1027 {
1028  UNIMPLEMENTED;
1029  ASSERT(FALSE);
1030  return STATUS_NOT_IMPLEMENTED;
1031 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define UNIMPLEMENTED
Definition: debug.h:114

◆ HidParser_TranslateUsageAndPagesToI8042ScanCodes()

HIDAPI NTSTATUS NTAPI HidParser_TranslateUsageAndPagesToI8042ScanCodes ( IN PHID_PARSER  Parser,
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 
)

Definition at line 678 of file hidparser.c.

686 {
687  ULONG Index;
689 
690  for(Index = 0; Index < UsageListLength; Index++)
691  {
692  //
693  // check current usage
694  //
695  if (ChangedUsageList[Index].UsagePage == HID_USAGE_PAGE_KEYBOARD)
696  {
697  //
698  // process keyboard usage
699  //
700  Status = HidParser_TranslateKbdUsage(Parser, ChangedUsageList[Index].Usage, KeyAction, ModifierState, InsertCodesProcedure, InsertCodesContext);
701  }
702  else if (ChangedUsageList[Index].UsagePage == HID_USAGE_PAGE_CONSUMER)
703  {
704  //
705  // process consumer usage
706  //
707  Status = HidParser_TranslateCustUsage(Parser, ChangedUsageList[Index].Usage, KeyAction, ModifierState, InsertCodesProcedure, InsertCodesContext);
708  }
709  else
710  {
711  //
712  // invalid page / end of usage list page
713  //
715  }
716 
717  //
718  // check status
719  //
721  {
722  //
723  // failed
724  //
726  }
727  }
728 
730  {
731  //
732  // failed
733  //
735  }
736 
737  //
738  // done
739  //
740  return HIDP_STATUS_SUCCESS;
741 }
#define HIDP_STATUS_I8042_TRANS_UNKNOWN
Definition: hidpi.h:258
_Must_inspect_result_ _In_ USAGE _In_ USHORT _In_ USAGE Usage
Definition: hidpi.h:382
#define HID_USAGE_PAGE_CONSUMER
Definition: hidusage.h:186
NTSTATUS TranslateHidParserStatus(IN HIDPARSER_STATUS Status)
Definition: hidparser.c:17
#define HID_USAGE_PAGE_KEYBOARD
Definition: hidusage.h:181
HIDPARSER_STATUS HidParser_TranslateCustUsage(IN PHID_PARSER Parser, IN USAGE Usage, IN HIDP_KEYBOARD_DIRECTION KeyAction, IN OUT PHIDP_KEYBOARD_MODIFIER_STATE ModifierState, IN PHIDP_INSERT_SCANCODES InsertCodesProcedure, IN PVOID InsertCodesContext)
Definition: api.c:935
HIDPARSER_STATUS HidParser_TranslateKbdUsage(IN PHID_PARSER Parser, IN USAGE Usage, IN HIDP_KEYBOARD_DIRECTION KeyAction, IN OUT PHIDP_KEYBOARD_MODIFIER_STATE ModifierState, IN PHIDP_INSERT_SCANCODES InsertCodesProcedure, IN PVOID InsertCodesContext)
Definition: api.c:872
_Must_inspect_result_ _In_ USAGE UsagePage
Definition: hidpi.h:382
static const UCHAR Index[8]
Definition: usbohci.c:18
_Must_inspect_result_ _In_ ULONG UsageListLength
Definition: hidpi.h:647
Status
Definition: gdiplustypes.h:24
long HIDPARSER_STATUS
Definition: hidparser.h:25
unsigned int ULONG
Definition: retypes.h:1
#define HIDP_STATUS_SUCCESS
Definition: hidpi.h:248

Referenced by HidP_TranslateUsageAndPagesToI8042ScanCodes().

◆ HidParser_TranslateUsagesToI8042ScanCodes()

HIDAPI NTSTATUS 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 
)

Definition at line 1087 of file hidparser.c.

1094 {
1095  UNIMPLEMENTED;
1096  ASSERT(FALSE);
1097  return STATUS_NOT_IMPLEMENTED;
1098 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define UNIMPLEMENTED
Definition: debug.h:114

◆ HidParser_UnsetUsages()

HIDAPI NTSTATUS NTAPI HidParser_UnsetUsages ( IN PHID_PARSER  Parser,
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 
)

Definition at line 1068 of file hidparser.c.

1078 {
1079  UNIMPLEMENTED;
1080  ASSERT(FALSE);
1081  return STATUS_NOT_IMPLEMENTED;
1082 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define UNIMPLEMENTED
Definition: debug.h:114

◆ HidParser_UsageAndPageListDifference()

HIDAPI NTSTATUS 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 
)

Definition at line 763 of file hidparser.c.

769 {
770  ULONG Index, SubIndex, BreakUsageListIndex = 0, MakeUsageListIndex = 0, bFound;
771  PUSAGE_AND_PAGE CurrentUsage, Usage;
772 
773  if (UsageListLength)
774  {
775  /* process removed usages */
776  Index = 0;
777  do
778  {
779  /* get usage from current index */
780  CurrentUsage = &PreviousUsageList[Index];
781 
782  /* end of list reached? */
783  if (CurrentUsage->Usage == 0 && CurrentUsage->UsagePage == 0)
784  break;
785 
786  /* search in current list */
787  SubIndex = 0;
788  bFound = FALSE;
789  do
790  {
791  /* get usage */
792  Usage = &CurrentUsageList[SubIndex];
793 
794  /* end of list reached? */
795  if (Usage->Usage == 0 && Usage->UsagePage == 0)
796  break;
797 
798  /* does it match */
799  if (Usage->Usage == CurrentUsage->Usage && Usage->UsagePage == CurrentUsage->UsagePage)
800  {
801  /* found match */
802  bFound = TRUE;
803  }
804 
805  /* move to next index */
806  SubIndex++;
807 
808  }while(SubIndex < UsageListLength);
809 
810  if (!bFound)
811  {
812  /* store it in break usage list */
813  BreakUsageList[BreakUsageListIndex].Usage = CurrentUsage->Usage;
814  BreakUsageList[BreakUsageListIndex].UsagePage = CurrentUsage->UsagePage;
815  BreakUsageListIndex++;
816  }
817 
818  /* move to next index */
819  Index++;
820 
821  }while(Index < UsageListLength);
822 
823  /* process new usages */
824  Index = 0;
825  do
826  {
827  /* get usage from current index */
828  CurrentUsage = &CurrentUsageList[Index];
829 
830  /* end of list reached? */
831  if (CurrentUsage->Usage == 0 && CurrentUsage->UsagePage == 0)
832  break;
833 
834  /* search in current list */
835  SubIndex = 0;
836  bFound = FALSE;
837  do
838  {
839  /* get usage */
840  Usage = &PreviousUsageList[SubIndex];
841 
842  /* end of list reached? */
843  if (Usage->Usage == 0 && Usage->UsagePage == 0)
844  break;
845 
846  /* does it match */
847  if (Usage->Usage == CurrentUsage->Usage && Usage->UsagePage == CurrentUsage->UsagePage)
848  {
849  /* found match */
850  bFound = TRUE;
851  }
852 
853  /* move to next index */
854  SubIndex++;
855 
856  }while(SubIndex < UsageListLength);
857 
858  if (!bFound)
859  {
860  /* store it in break usage list */
861  MakeUsageList[MakeUsageListIndex].Usage = CurrentUsage->Usage;
862  MakeUsageList[MakeUsageListIndex].UsagePage = CurrentUsage->UsagePage;
863  MakeUsageListIndex++;
864  }
865 
866  /* move to next index */
867  Index++;
868  }while(Index < UsageListLength);
869  }
870 
871  /* are there remaining free list entries */
872  if (BreakUsageListIndex < UsageListLength)
873  {
874  /* zero them */
875  RtlZeroMemory(&BreakUsageList[BreakUsageListIndex], (UsageListLength - BreakUsageListIndex) * sizeof(USAGE_AND_PAGE));
876  }
877 
878  /* are there remaining free list entries */
879  if (MakeUsageListIndex < UsageListLength)
880  {
881  /* zero them */
882  RtlZeroMemory(&MakeUsageList[MakeUsageListIndex], (UsageListLength - MakeUsageListIndex) * sizeof(USAGE_AND_PAGE));
883  }
884 
885  /* done */
886  return HIDP_STATUS_SUCCESS;
887 }
#define TRUE
Definition: types.h:120
USAGE UsagePage
Definition: hidpi.h:80
_Must_inspect_result_ _In_ USAGE _In_ USHORT _In_ USAGE Usage
Definition: hidpi.h:382
USAGE Usage
Definition: hidpi.h:79
static const UCHAR Index[8]
Definition: usbohci.c:18
_Must_inspect_result_ _In_ ULONG UsageListLength
Definition: hidpi.h:647
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define HIDP_STATUS_SUCCESS
Definition: hidpi.h:248

Referenced by HidP_UsageAndPageListDifference().

◆ HidParser_UsageListDifference()

HIDAPI NTSTATUS NTAPI HidParser_UsageListDifference ( IN PUSAGE  PreviousUsageList,
IN PUSAGE  CurrentUsageList,
OUT PUSAGE  BreakUsageList,
OUT PUSAGE  MakeUsageList,
IN ULONG  UsageListLength 
)

Definition at line 421 of file hidparser.c.

427 {
428  ULONG Index, SubIndex, bFound, BreakUsageIndex = 0, MakeUsageIndex = 0;
429  USAGE CurrentUsage, Usage;
430 
431  if (UsageListLength)
432  {
433  Index = 0;
434  do
435  {
436  /* get current usage */
437  CurrentUsage = PreviousUsageList[Index];
438 
439  /* is the end of list reached? */
440  if (!CurrentUsage)
441  break;
442 
443  /* start searching in current usage list */
444  SubIndex = 0;
445  bFound = FALSE;
446  do
447  {
448  /* get usage of current list */
449  Usage = CurrentUsageList[SubIndex];
450 
451  /* end of list reached? */
452  if (!Usage)
453  break;
454 
455  /* check if it matches the current one */
456  if (CurrentUsage == Usage)
457  {
458  /* it does */
459  bFound = TRUE;
460  break;
461  }
462 
463  /* move to next usage */
464  SubIndex++;
465  }while(SubIndex < UsageListLength);
466 
467  /* was the usage found ?*/
468  if (!bFound)
469  {
470  /* store it in the break usage list */
471  BreakUsageList[BreakUsageIndex] = CurrentUsage;
472  BreakUsageIndex++;
473  }
474 
475  /* move to next usage */
476  Index++;
477 
478  }while(Index < UsageListLength);
479 
480  /* now process the new items */
481  Index = 0;
482  do
483  {
484  /* get current usage */
485  CurrentUsage = CurrentUsageList[Index];
486 
487  /* is the end of list reached? */
488  if (!CurrentUsage)
489  break;
490 
491  /* start searching in current usage list */
492  SubIndex = 0;
493  bFound = FALSE;
494  do
495  {
496  /* get usage of previous list */
497  Usage = PreviousUsageList[SubIndex];
498 
499  /* end of list reached? */
500  if (!Usage)
501  break;
502 
503  /* check if it matches the current one */
504  if (CurrentUsage == Usage)
505  {
506  /* it does */
507  bFound = TRUE;
508  break;
509  }
510 
511  /* move to next usage */
512  SubIndex++;
513  }while(SubIndex < UsageListLength);
514 
515  /* was the usage found ?*/
516  if (!bFound)
517  {
518  /* store it in the make usage list */
519  MakeUsageList[MakeUsageIndex] = CurrentUsage;
520  MakeUsageIndex++;
521  }
522 
523  /* move to next usage */
524  Index++;
525 
526  }while(Index < UsageListLength);
527  }
528 
529  /* does the break list contain empty entries */
530  if (BreakUsageIndex < UsageListLength)
531  {
532  /* zeroize entries */
533  RtlZeroMemory(&BreakUsageList[BreakUsageIndex], sizeof(USAGE) * (UsageListLength - BreakUsageIndex));
534  }
535 
536  /* does the make usage list contain empty entries */
537  if (MakeUsageIndex < UsageListLength)
538  {
539  /* zeroize entries */
540  RtlZeroMemory(&MakeUsageList[MakeUsageIndex], sizeof(USAGE) * (UsageListLength - MakeUsageIndex));
541  }
542 
543  /* done */
544  return HIDP_STATUS_SUCCESS;
545 }
#define TRUE
Definition: types.h:120
_Must_inspect_result_ _In_ USAGE _In_ USHORT _In_ USAGE Usage
Definition: hidpi.h:382
static const UCHAR Index[8]
Definition: usbohci.c:18
USHORT USAGE
Definition: hidusage.h:30
_Must_inspect_result_ _In_ ULONG UsageListLength
Definition: hidpi.h:647
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define HIDP_STATUS_SUCCESS
Definition: hidpi.h:248

Referenced by HidP_UsageListDifference().

◆ TranslateHidParserStatus()

NTSTATUS TranslateHidParserStatus ( IN HIDPARSER_STATUS  Status)

Definition at line 17 of file hidparser.c.

19 {
20  switch(Status)
21  {
39  return HIDP_STATUS_NOT_IMPLEMENTED; //FIXME
42  }
43  DPRINT1("TranslateHidParserStatus Status %ld not implemented\n", Status);
45 }
#define HIDP_STATUS_USAGE_NOT_FOUND
Definition: hidpi.h:253
#define HIDP_STATUS_I8042_TRANS_UNKNOWN
Definition: hidpi.h:258
#define HIDP_STATUS_BUFFER_TOO_SMALL
Definition: hidpi.h:256
#define HIDP_STATUS_BAD_LOG_PHY_VALUES
Definition: hidpi.h:255
#define HIDP_STATUS_NOT_IMPLEMENTED
Definition: hidpi.h:266
#define HIDP_STATUS_INTERNAL_ERROR
Definition: hidpi.h:257
#define HIDP_STATUS_INVALID_REPORT_TYPE
Definition: hidpi.h:251
#define HIDP_STATUS_REPORT_DOES_NOT_EXIST
Definition: hidpi.h:265
#define HIDP_STATUS_INVALID_REPORT_LENGTH
Definition: hidpi.h:252
Status
Definition: gdiplustypes.h:24
#define DPRINT1
Definition: precomp.h:8

Referenced by HidParser_GetScaledUsageValue(), HidParser_GetSpecificValueCaps(), HidParser_GetUsages(), HidParser_GetUsageValue(), and HidParser_TranslateUsageAndPagesToI8042ScanCodes().