ReactOS 0.4.15-dev-6679-g945ee4b
parser.h
Go to the documentation of this file.
1#ifndef _HIDPARSER_H_
2#define _HIDPARSER_H_
3
4#include <wdm.h>
5#define _HIDPI_
6#define _HIDPI_NO_FUNCTION_MACROS_
7#include <hidpddi.h>
8
9#include "hidparser.h"
10#include "hidp.h"
11
12 /*
13 * Copyright 2007, Haiku, Inc. All Rights Reserved.
14 * Distributed under the terms of the MIT License.
15 */
16
17#define HID_REPORT_TYPE_ANY 0x07
18
19
20#define ITEM_TYPE_MAIN 0x0
21#define ITEM_TYPE_GLOBAL 0x1
22#define ITEM_TYPE_LOCAL 0x2
23#define ITEM_TYPE_LONG 0x3
24
25#define ITEM_TAG_MAIN_INPUT 0x8
26#define ITEM_TAG_MAIN_OUTPUT 0x9
27#define ITEM_TAG_MAIN_FEATURE 0xb
28#define ITEM_TAG_MAIN_COLLECTION 0xa
29#define ITEM_TAG_MAIN_END_COLLECTION 0xc
30
31#define ITEM_TAG_GLOBAL_USAGE_PAGE 0x0
32#define ITEM_TAG_GLOBAL_LOGICAL_MINIMUM 0x1
33#define ITEM_TAG_GLOBAL_LOGICAL_MAXIMUM 0x2
34#define ITEM_TAG_GLOBAL_PHYSICAL_MINIMUM 0x3
35#define ITEM_TAG_GLOBAL_PHYSICAL_MAXIMUM 0x4
36#define ITEM_TAG_GLOBAL_UNIT_EXPONENT 0x5
37#define ITEM_TAG_GLOBAL_UNIT 0x6
38#define ITEM_TAG_GLOBAL_REPORT_SIZE 0x7
39#define ITEM_TAG_GLOBAL_REPORT_ID 0x8
40#define ITEM_TAG_GLOBAL_REPORT_COUNT 0x9
41#define ITEM_TAG_GLOBAL_PUSH 0xa
42#define ITEM_TAG_GLOBAL_POP 0xb
43
44#define ITEM_TAG_LOCAL_USAGE 0x0
45#define ITEM_TAG_LOCAL_USAGE_MINIMUM 0x1
46#define ITEM_TAG_LOCAL_USAGE_MAXIMUM 0x2
47#define ITEM_TAG_LOCAL_DESIGNATOR_INDEX 0x3
48#define ITEM_TAG_LOCAL_DESIGNATOR_MINIMUM 0x4
49#define ITEM_TAG_LOCAL_DESIGNATOR_MAXIMUM 0x5
50#define ITEM_TAG_LOCAL_STRING_INDEX 0x7
51#define ITEM_TAG_LOCAL_STRING_MINIMUM 0x8
52#define ITEM_TAG_LOCAL_STRING_MAXIMUM 0x9
53#define ITEM_TAG_LOCAL_DELIMITER 0xa
54
55#define ITEM_TAG_LONG 0xf
56
57#define COLLECTION_PHYSICAL 0x00
58#define COLLECTION_APPLICATION 0x01
59#define COLLECTION_LOGICAL 0x02
60#define COLLECTION_REPORT 0x03
61#define COLLECTION_NAMED_ARRAY 0x04
62#define COLLECTION_USAGE_SWITCH 0x05
63#define COLLECTION_USAGE_MODIFIER 0x06
64#define COLLECTION_ALL 0xff
65
66#define UNIT_SYSTEM 0x0
67#define UNIT_LENGTH 0x1
68#define UNIT_MASS 0x2
69#define UNIT_TIME 0x3
70#define UNIT_TEMPERATURE 0x4
71#define UNIT_CURRENT 0x5
72#define UNIT_LUMINOUS_INTENSITY 0x6
73
74#define USAGE_PAGE_SHIFT 16
75#define USAGE_PAGE_MASK 0xffff
76#define USAGE_ID_SHIFT 0
77#define USAGE_ID_MASK 0xffff
78
79typedef struct
80{
85
86#include <pshpack1.h>
87typedef struct
88{
90
91 union
92 {
93 UCHAR UData8[4];
94 CHAR SData8[4];
95 USHORT UData16[2];
96 SHORT SData16[2];
100
102#include <poppack.h>
103
104typedef struct
105{
110
112
113
114#define LBITFIELD9(b1,b2,b3,b4,b5,b6,b7,b8,b9) USHORT b9,b8,b7,b6,b5,b4,b3,b2,b1
115typedef struct
116{
127
129
131{
142 struct __GLOBAL_ITEM_STATE__ * Next;
144
145
146typedef struct usage_value
147{
148 union
149 {
150 struct {
156
159
160
161typedef struct
162{
166
169
172
175
178
183
185
186typedef struct
187{
202
203struct _HID_REPORT;
204
205typedef struct __HID_COLLECTION__
206{
213
217
219
221
222typedef struct _HID_REPORT
223{
231
232typedef struct
233{
234 //
235 // global item state
236 //
238
239 //
240 // local item state
241 //
243
244 //
245 // root collection
246 //
248
249 //
250 // uses report ids
251 //
253
254 //
255 // collection index
256 //
258
260
261#define HID_REPORT_TYPE_INPUT 0x01
262#define HID_REPORT_TYPE_OUTPUT 0x02
263#define HID_REPORT_TYPE_FEATURE 0x04
264
265ULONG
267 IN PVOID CollectionContext,
268 IN UCHAR ReportType);
269
272 IN PVOID CollectionContext,
275
276ULONG
278 IN PVOID CollectionContext,
279 IN UCHAR ReportType);
280
281ULONG
283 IN PVOID CollectionContext,
284 IN UCHAR ReportType);
285
286ULONG
288 IN PVOID CollectionContext,
289 IN UCHAR ReportType,
290 IN ULONG bData);
291
292ULONG
294 IN PVOID CollectionContext,
295 IN UCHAR ReportType,
297
300 IN PVOID CollectionContext,
301 IN UCHAR ReportType,
306
307
310 IN PVOID CollectionContext,
311 IN UCHAR ReportType,
313 OUT USAGE *UsageList,
315 IN PCHAR ReportDescriptor,
316 IN ULONG ReportDescriptorLength);
317
320 IN PVOID CollectionContext,
321 IN UCHAR ReportType,
323 IN USAGE Usage,
324 OUT PLONG UsageValue,
325 IN PCHAR ReportDescriptor,
326 IN ULONG ReportDescriptorLength);
327
330 IN PVOID CollectionContext,
331 IN UCHAR ReportType,
333 IN USAGE Usage,
334 OUT PULONG UsageValue,
335 IN PCHAR ReportDescriptor,
336 IN ULONG ReportDescriptorLength);
337
338/* parser.c */
339
342 IN PVOID ParserContext,
343 IN ULONG CollectionIndex,
345 OUT PVOID *CollectionContext);
346
347ULONG
350
353 PUCHAR Report,
354 ULONG ReportSize,
355 OUT PVOID *ParserContext);
356
357ULONG
359 IN PVOID ParserContext);
360
361ULONG
363 IN PVOID ParserContext,
364 IN ULONG CollectionNumber);
365
366
367/* context.c */
368
372
373ULONG
375 IN PVOID CollectionContext);
376
379 IN PHID_COLLECTION RootCollection,
382
386 IN UCHAR ReportType);
387
388#endif /* _HIDPARSER_H_ */
LONG NTSTATUS
Definition: precomp.h:26
r reserved
Definition: btrfs.c:3006
_Must_inspect_result_ _In_ FLT_CONTEXT_TYPE _In_ SIZE_T ContextSize
Definition: fltkernel.h:1444
_Must_inspect_result_ _In_ USAGE UsagePage
Definition: hidpi.h:382
_Must_inspect_result_ _In_ USAGE _In_ USHORT _In_ USAGE _Out_ PHIDP_VALUE_CAPS _Inout_ PUSHORT ValueCapsLength
Definition: hidpi.h:400
_Must_inspect_result_ _In_ USHORT _Inout_updates_to_ UsageLength PUSAGE_AND_PAGE _Inout_ ULONG * UsageLength
Definition: hidpi.h:426
_Must_inspect_result_ _In_ USAGE _In_ USHORT _In_ USAGE _Out_ PHIDP_VALUE_CAPS ValueCaps
Definition: hidpi.h:399
_Must_inspect_result_ _In_ USAGE _In_ USHORT _In_ USAGE Usage
Definition: hidpi.h:384
USHORT USAGE
Definition: hidusage.h:30
short SHORT
Definition: pedump.c:59
long LONG
Definition: pedump.c:60
unsigned short USHORT
Definition: pedump.c:61
ULONG HidParser_UsesReportId(IN PVOID CollectionContext, IN UCHAR ReportType)
Definition: api.c:524
struct __GLOBAL_ITEM_STATE_ * PGLOBAL_ITEM_STATE
struct ITEM_PREFIX * PITEM_PREFIX
PHID_COLLECTION HidParser_GetCollectionFromContext(IN PVOID Context)
Definition: context.c:290
struct __HID_COLLECTION__ HID_COLLECTION
struct _HID_REPORT * PHID_REPORT
struct __GLOBAL_ITEM_STATE_ GLOBAL_ITEM_STATE
struct usage_value * PUSAGE_VALUE
struct _HID_REPORT HID_REPORT
struct __HID_COLLECTION__ * PHID_COLLECTION
struct MAIN_ITEM_DATA * PMAIN_ITEM_DATA
struct LOCAL_ITEM_STATE * PLOCAL_ITEM_STATE
PHID_REPORT HidParser_GetReportInCollection(IN PVOID Context, IN UCHAR ReportType)
Definition: context.c:277
NTSTATUS HidParser_BuildContext(IN PVOID ParserContext, IN ULONG CollectionIndex, IN ULONG ContextSize, OUT PVOID *CollectionContext)
Definition: parser.c:1303
struct HID_REPORT_ITEM * PHID_REPORT_ITEM
struct usage_value USAGE_VALUE
ULONG HidParser_NumberOfTopCollections(IN PVOID ParserContext)
Definition: parser.c:1279
NTSTATUS HidParser_GetSpecificValueCapsWithReport(IN PVOID CollectionContext, IN UCHAR ReportType, IN USHORT UsagePage, IN USHORT Usage, OUT PHIDP_VALUE_CAPS ValueCaps, IN OUT PUSHORT ValueCapsLength)
Definition: api.c:254
ULONG HidParser_GetContextSize(IN PVOID ParserContext, IN ULONG CollectionNumber)
Definition: parser.c:1351
NTSTATUS HidParser_GetUsageValueWithReport(IN PVOID CollectionContext, IN UCHAR ReportType, IN USAGE UsagePage, IN USAGE Usage, OUT PULONG UsageValue, IN PCHAR ReportDescriptor, IN ULONG ReportDescriptorLength)
Definition: api.c:550
NTSTATUS HidParser_GetUsagesWithReport(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:343
struct LONG_ITEM * PLONG_ITEM
NTSTATUS HidParser_ParseReportDescriptor(PUCHAR Report, ULONG ReportSize, OUT PVOID *ParserContext)
ULONG HidParser_GetReportItemCountFromReportType(IN PVOID CollectionContext, IN UCHAR ReportType)
Definition: api.c:132
ULONG HidParser_GetReportLength(IN PVOID CollectionContext, IN UCHAR ReportType)
Definition: api.c:93
ULONG HidParser_GetMaxUsageListLengthWithReportAndPage(IN PVOID CollectionContext, IN UCHAR ReportType, IN USAGE UsagePage OPTIONAL)
Definition: api.c:210
ULONG HidParser_GetReportItemTypeCountFromReportType(IN PVOID CollectionContext, IN UCHAR ReportType, IN ULONG bData)
Definition: api.c:158
struct HID_PARSER_CONTEXT * PHID_PARSER_CONTEXT
NTSTATUS HidParser_GetScaledUsageValueWithReport(IN PVOID CollectionContext, IN UCHAR ReportType, IN USAGE UsagePage, IN USAGE Usage, OUT PLONG UsageValue, IN PCHAR ReportDescriptor, IN ULONG ReportDescriptorLength)
Definition: api.c:646
ULONG HidParser_CalculateContextSize(IN PHID_COLLECTION Collection)
Definition: context.c:65
struct SHORT_ITEM * PSHORT_ITEM
ULONG HidParser_GetTotalCollectionCount(IN PVOID CollectionContext)
Definition: context.c:330
NTSTATUS HidParser_BuildCollectionContext(IN PHID_COLLECTION RootCollection, IN PVOID Context, IN ULONG ContextSize)
Definition: context.c:185
NTSTATUS HidParser_GetCollectionUsagePage(IN PVOID CollectionContext, OUT PUSHORT Usage, OUT PUSHORT UsagePage)
Definition: api.c:65
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
LOCAL_ITEM_STATE LocalItemState
Definition: parser.h:242
ULONG CollectionIndex
Definition: parser.h:257
GLOBAL_ITEM_STATE GlobalItemState
Definition: parser.h:237
PHID_COLLECTION RootCollection
Definition: parser.h:247
UCHAR UseReportIDs
Definition: parser.h:252
ULONG Mask
Definition: parser.h:190
ULONG UsageMinimum
Definition: parser.h:197
UCHAR Shift
Definition: parser.h:189
UCHAR Valid
Definition: parser.h:200
UCHAR HasData
Definition: parser.h:192
UCHAR Array
Definition: parser.h:193
ULONG ByteOffset
Definition: parser.h:188
UCHAR BitCount
Definition: parser.h:191
ULONG Data
Definition: parser.h:199
ULONG Minimum
Definition: parser.h:195
ULONG UsageMaximum
Definition: parser.h:198
UCHAR Relative
Definition: parser.h:194
ULONG Maximum
Definition: parser.h:196
UCHAR Tag
Definition: parser.h:83
UCHAR Type
Definition: parser.h:82
UCHAR Size
Definition: parser.h:81
UCHAR StringMinimum
Definition: parser.h:181
UCHAR UsageMaximumSet
Definition: parser.h:171
ULONG DesignatorMinimum
Definition: parser.h:176
ULONG UsageStackUsed
Definition: parser.h:164
USAGE_VALUE UsageMaximum
Definition: parser.h:168
UCHAR StringIndexSet
Definition: parser.h:180
UCHAR DesignatorIndexSet
Definition: parser.h:174
UCHAR StringMaximum
Definition: parser.h:182
USAGE_VALUE UsageMinimum
Definition: parser.h:167
ULONG DesignatorMaximum
Definition: parser.h:177
ULONG DesignatorIndex
Definition: parser.h:173
UCHAR UsageMinimumSet
Definition: parser.h:170
PUSAGE_VALUE UsageStack
Definition: parser.h:163
ULONG UsageStackAllocated
Definition: parser.h:165
UCHAR StringIndex
Definition: parser.h:179
UCHAR DataSize
Definition: parser.h:107
UCHAR LongItemTag
Definition: parser.h:108
ITEM_PREFIX Prefix
Definition: parser.h:106
USHORT DataConstant
Definition: parser.h:117
USHORT NullState
Definition: parser.h:123
USHORT Wrap
Definition: parser.h:120
USHORT NoPreferred
Definition: parser.h:122
USHORT NonLinear
Definition: parser.h:121
USHORT Relative
Definition: parser.h:119
USHORT IsVolatile
Definition: parser.h:124
USHORT ArrayVariable
Definition: parser.h:118
USHORT BitsBytes
Definition: parser.h:125
ITEM_PREFIX Prefix
Definition: parser.h:89
ULONG UData32
Definition: parser.h:97
LONG SData32
Definition: parser.h:98
UCHAR ReportID
Definition: parser.h:225
UCHAR Type
Definition: parser.h:224
ULONG ReportSize
Definition: parser.h:226
HID_REPORT_ITEM Items[1]
Definition: parser.h:229
ULONG ItemAllocated
Definition: parser.h:228
ULONG ItemCount
Definition: parser.h:227
ULONG LogicialMaximum
Definition: parser.h:134
struct __GLOBAL_ITEM_STATE__ * Next
Definition: parser.h:142
ULONG LogicalMinimum
Definition: parser.h:133
ULONG PhysicalMinimum
Definition: parser.h:135
ULONG PhysicalMaximum
Definition: parser.h:136
ULONG ReportCount
Definition: parser.h:211
struct __HID_COLLECTION__ * Root
Definition: parser.h:215
struct _HID_REPORT ** Reports
Definition: parser.h:216
struct __HID_COLLECTION__ ** Nodes
Definition: parser.h:214
UCHAR PhysicalID
Definition: parser.h:210
ULONG Offsets[1]
Definition: parser.h:218
UCHAR IsExtended
Definition: parser.h:157
struct usage_value::@4128::@4129 s
USHORT UsagePage
Definition: parser.h:152
ULONG Extended
Definition: parser.h:154
union usage_value::@4128 u
USHORT UsageId
Definition: parser.h:151
uint32_t * PULONG
Definition: typedefs.h:59
uint16_t * PUSHORT
Definition: typedefs.h:56
#define IN
Definition: typedefs.h:39
int32_t * PLONG
Definition: typedefs.h:58
unsigned char * PUCHAR
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
char * PCHAR
Definition: typedefs.h:51
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ WDFCOLLECTION Collection
Definition: wdfregistry.h:374
unsigned char UCHAR
Definition: xmlstorage.h:181
char CHAR
Definition: xmlstorage.h:175