include/mscvpdb.h: Use flexible array members for the rest of structures.
[wine.git] / include / ddk / hidpi.h
blobe2e2bd2229b9b928353f66a75bbc21d07582d681
1 /*
2 * Copyright (C) 2015 Aric Stewart
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #ifndef __HIDPI_H__
20 #define __HIDPI_H__
22 typedef UCHAR *PHIDP_REPORT_DESCRIPTOR;
24 typedef enum _HIDP_REPORT_TYPE
26 HidP_Input,
27 HidP_Output,
28 HidP_Feature
29 } HIDP_REPORT_TYPE;
31 typedef struct _HIDP_BUTTON_CAPS
33 USAGE UsagePage;
34 UCHAR ReportID;
35 BOOLEAN IsAlias;
36 USHORT BitField;
37 USHORT LinkCollection;
38 USAGE LinkUsage;
39 USAGE LinkUsagePage;
41 BOOLEAN IsRange;
42 BOOLEAN IsStringRange;
43 BOOLEAN IsDesignatorRange;
44 BOOLEAN IsAbsolute;
45 ULONG Reserved[10];
46 union {
47 struct {
48 USAGE UsageMin;
49 USAGE UsageMax;
50 USHORT StringMin;
51 USHORT StringMax;
52 USHORT DesignatorMin;
53 USHORT DesignatorMax;
54 USHORT DataIndexMin;
55 USHORT DataIndexMax;
56 } Range;
57 struct {
58 USAGE Usage;
59 USAGE Reserved1;
60 USHORT StringIndex;
61 USHORT Reserved2;
62 USHORT DesignatorIndex;
63 USHORT Reserved3;
64 USHORT DataIndex;
65 USHORT Reserved4;
66 } NotRange;
67 } DUMMYUNIONNAME;
68 } HIDP_BUTTON_CAPS, *PHIDP_BUTTON_CAPS;
70 typedef struct _HIDP_VALUE_CAPS
72 USAGE UsagePage;
73 UCHAR ReportID;
74 BOOLEAN IsAlias;
75 USHORT BitField;
76 USHORT LinkCollection;
77 USAGE LinkUsage;
78 USAGE LinkUsagePage;
80 BOOLEAN IsRange;
81 BOOLEAN IsStringRange;
82 BOOLEAN IsDesignatorRange;
83 BOOLEAN IsAbsolute;
84 BOOLEAN HasNull;
85 UCHAR Reserved;
86 USHORT BitSize;
87 USHORT ReportCount;
88 USHORT Reserved2[5];
89 ULONG UnitsExp;
90 ULONG Units;
91 LONG LogicalMin;
92 LONG LogicalMax;
93 LONG PhysicalMin;
94 LONG PhysicalMax;
95 union {
96 struct {
97 USAGE UsageMin;
98 USAGE UsageMax;
99 USHORT StringMin;
100 USHORT StringMax;
101 USHORT DesignatorMin;
102 USHORT DesignatorMax;
103 USHORT DataIndexMin;
104 USHORT DataIndexMax;
105 } Range;
106 struct {
107 USAGE Usage;
108 USAGE Reserved1;
109 USHORT StringIndex;
110 USHORT Reserved2;
111 USHORT DesignatorIndex;
112 USHORT Reserved3;
113 USHORT DataIndex;
114 USHORT Reserved4;
115 } NotRange;
116 } DUMMYUNIONNAME;
117 } HIDP_VALUE_CAPS, *PHIDP_VALUE_CAPS;
119 typedef struct _HIDP_PREPARSED_DATA * PHIDP_PREPARSED_DATA;
121 typedef struct _HIDP_CAPS
123 USAGE Usage;
124 USAGE UsagePage;
125 USHORT InputReportByteLength;
126 USHORT OutputReportByteLength;
127 USHORT FeatureReportByteLength;
128 USHORT Reserved[17];
129 USHORT NumberLinkCollectionNodes;
130 USHORT NumberInputButtonCaps;
131 USHORT NumberInputValueCaps;
132 USHORT NumberInputDataIndices;
133 USHORT NumberOutputButtonCaps;
134 USHORT NumberOutputValueCaps;
135 USHORT NumberOutputDataIndices;
136 USHORT NumberFeatureButtonCaps;
137 USHORT NumberFeatureValueCaps;
138 USHORT NumberFeatureDataIndices;
139 } HIDP_CAPS, *PHIDP_CAPS;
141 typedef enum _HIDP_KEYBOARD_DIRECTION {
142 HidP_Keyboard_Break,
143 HidP_Keyboard_Make
144 } HIDP_KEYBOARD_DIRECTION;
146 typedef struct _HIDP_KEYBOARD_MODIFIER_STATE {
147 union {
148 struct {
149 ULONG LeftControl: 1;
150 ULONG LeftShift: 1;
151 ULONG LeftAlt: 1;
152 ULONG LeftGUI: 1;
153 ULONG RightControl: 1;
154 ULONG RightShift: 1;
155 ULONG RightAlt: 1;
156 ULONG RigthGUI: 1;
157 ULONG CapsLock: 1;
158 ULONG ScollLock: 1;
159 ULONG NumLock: 1;
160 ULONG Reserved: 21;
161 } DUMMYSTRUCTNAME;
162 ULONG ul;
163 } DUMMYUNIONNAME;
164 } HIDP_KEYBOARD_MODIFIER_STATE, *PHIDP_KEYBOARD_MODIFIER_STATE;
166 typedef struct _USAGE_AND_PAGE {
167 USAGE Usage;
168 USAGE UsagePage;
169 } USAGE_AND_PAGE, *PUSAGE_AND_PAGE;
171 typedef struct _HIDP_DATA {
172 USHORT DataIndex;
173 USHORT Reserved;
174 union {
175 ULONG RawValue;
176 BOOLEAN On;
177 } DUMMYUNIONNAME;
178 } HIDP_DATA, *PHIDP_DATA;
180 typedef struct _HIDP_LINK_COLLECTION_NODE {
181 USAGE LinkUsage;
182 USAGE LinkUsagePage;
183 USHORT Parent;
184 USHORT NumberOfChildren;
185 USHORT NextSibling;
186 USHORT FirstChild;
187 ULONG CollectionType : 8;
188 ULONG IsAlias : 1;
189 ULONG Reserved : 23;
190 PVOID UserContext;
191 } HIDP_LINK_COLLECTION_NODE, *PHIDP_LINK_COLLECTION_NODE;
193 typedef BOOLEAN (NTAPI *PHIDP_INSERT_SCANCODES) (VOID *Context, CHAR *NewScanCodes, ULONG Length);
196 NTSTATUS WINAPI HidP_GetButtonCaps(HIDP_REPORT_TYPE ReportType, PHIDP_BUTTON_CAPS ButtonCaps, PUSHORT ButtonCapsLength, PHIDP_PREPARSED_DATA PreparsedData);
197 NTSTATUS WINAPI HidP_GetCaps(PHIDP_PREPARSED_DATA PreparsedData, PHIDP_CAPS Capabilities);
198 NTSTATUS WINAPI HidP_GetUsages(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT LinkCollection, PUSAGE UsageList, PULONG UsageLength, PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report, ULONG ReportLength);
199 NTSTATUS WINAPI HidP_GetUsageValue(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT LinkCollection, USAGE Usage, PULONG UsageValue, PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report, ULONG ReportLength);
200 NTSTATUS WINAPI HidP_GetUsageValueArray(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT LinkCollection, USAGE Usage, PCHAR UsageValue, USHORT UsageValueByteLength, PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report, ULONG ReportLength);
201 NTSTATUS WINAPI HidP_GetValueCaps(HIDP_REPORT_TYPE ReportType, PHIDP_VALUE_CAPS ValueCaps, PUSHORT ValueCapsLength, PHIDP_PREPARSED_DATA PreparsedData);
202 NTSTATUS WINAPI HidP_InitializeReportForID(HIDP_REPORT_TYPE ReportType, UCHAR ReportID, PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report, ULONG ReportLength);
203 ULONG WINAPI HidP_MaxUsageListLength(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, PHIDP_PREPARSED_DATA PreparsedData);
204 NTSTATUS WINAPI HidP_GetScaledUsageValue(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT LinkCollection, USAGE Usage, PLONG UsageValue, PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report, ULONG ReportLength);
205 NTSTATUS WINAPI HidP_SetScaledUsageValue(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT LinkCollection, USAGE Usage, LONG UsageValue, PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report, ULONG ReportLength);
206 NTSTATUS WINAPI HidP_SetUsageValue(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT LinkCollection, USAGE Usage, ULONG UsageValue, PHIDP_PREPARSED_DATA PreparsedData, CHAR *Report, ULONG ReportLength);
207 NTSTATUS WINAPI HidP_SetUsageValueArray( HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT LinkCollection,
208 USAGE Usage, PCHAR UsageValue, USHORT UsageValueByteLength,
209 PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report, ULONG ReportLength );
210 NTSTATUS WINAPI HidP_SetUsages(HIDP_REPORT_TYPE ReportType, USAGE UsagePage,
211 USHORT LinkCollection, PUSAGE UsageList, PULONG UsageLength,
212 PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report, ULONG ReportLength);
213 NTSTATUS WINAPI HidP_UnsetUsages(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT LinkCollection, PUSAGE UsageList, PULONG UsageLength, PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report, ULONG ReportLength);
214 NTSTATUS WINAPI HidP_TranslateUsagesToI8042ScanCodes(USAGE *ChangedUsageList, ULONG UsageListLength, HIDP_KEYBOARD_DIRECTION KeyAction, HIDP_KEYBOARD_MODIFIER_STATE *ModifierState, PHIDP_INSERT_SCANCODES InsertCodesProcedure, VOID *InsertCodesContext);
215 NTSTATUS WINAPI HidP_GetSpecificButtonCaps(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT LinkCollection, USAGE Usage, HIDP_BUTTON_CAPS *ButtonCaps, USHORT *ButtonCapsLength, PHIDP_PREPARSED_DATA PreparsedData);
216 NTSTATUS WINAPI HidP_GetSpecificValueCaps(HIDP_REPORT_TYPE ReportType, USAGE UsagePage, USHORT LinkCollection, USAGE Usage, HIDP_VALUE_CAPS *ValueCaps, USHORT *ValueCapsLength, PHIDP_PREPARSED_DATA PreparsedData);
217 NTSTATUS WINAPI HidP_GetUsagesEx(HIDP_REPORT_TYPE ReportType, USHORT LinkCollection, USAGE_AND_PAGE *ButtonList, ULONG *UsageLength, PHIDP_PREPARSED_DATA PreparsedData, CHAR *Report, ULONG ReportLength);
218 ULONG WINAPI HidP_MaxDataListLength(HIDP_REPORT_TYPE ReportType, PHIDP_PREPARSED_DATA PreparsedData);
219 NTSTATUS WINAPI HidP_GetData(HIDP_REPORT_TYPE ReportType, HIDP_DATA *DataList, ULONG *DataLength, PHIDP_PREPARSED_DATA PreparsedData, CHAR *Report, ULONG ReportLength);
220 NTSTATUS WINAPI HidP_GetLinkCollectionNodes(HIDP_LINK_COLLECTION_NODE *LinkCollectionNode, ULONG *LinkCollectionNodeLength, PHIDP_PREPARSED_DATA PreparsedData);
222 #ifndef FACILITY_HID_ERROR_CODE
223 #define FACILITY_HID_ERROR_CODE 0x11
224 #endif
226 #define HIDP_ERROR_CODES(sev, code) ((NTSTATUS)(((sev) << 28) | (FACILITY_HID_ERROR_CODE << 16) | (code)))
228 #define HIDP_STATUS_SUCCESS (HIDP_ERROR_CODES(0x0u,0x00))
229 #define HIDP_STATUS_NULL (HIDP_ERROR_CODES(0x8u,0x01))
230 #define HIDP_STATUS_INVALID_PREPARSED_DATA (HIDP_ERROR_CODES(0xcu,0x01))
231 #define HIDP_STATUS_INVALID_REPORT_TYPE (HIDP_ERROR_CODES(0xcu,0x02))
232 #define HIDP_STATUS_INVALID_REPORT_LENGTH (HIDP_ERROR_CODES(0xcu,0x03))
233 #define HIDP_STATUS_USAGE_NOT_FOUND (HIDP_ERROR_CODES(0xcu,0x04))
234 #define HIDP_STATUS_VALUE_OUT_OF_RANGE (HIDP_ERROR_CODES(0xcu,0x05))
235 #define HIDP_STATUS_BAD_LOG_PHY_VALUES (HIDP_ERROR_CODES(0xcu,0x06))
236 #define HIDP_STATUS_BUFFER_TOO_SMALL (HIDP_ERROR_CODES(0xcu,0x07))
237 #define HIDP_STATUS_INTERNAL_ERROR (HIDP_ERROR_CODES(0xcu,0x08))
238 #define HIDP_STATUS_I8242_TRANS_UNKNOWN (HIDP_ERROR_CODES(0xcu,0x09))
239 #define HIDP_STATUS_INCOMPATIBLE_REPORT_ID (HIDP_ERROR_CODES(0xcu,0x0a))
240 #define HIDP_STATUS_NOT_VALUE_ARRAY (HIDP_ERROR_CODES(0xcu,0x0b))
241 #define HIDP_STATUS_IS_VALUE_ARRAY (HIDP_ERROR_CODES(0xcu,0x0c))
242 #define HIDP_STATUS_DATA_INDEX_NOT_FOUND (HIDP_ERROR_CODES(0xcu,0x0d))
243 #define HIDP_STATUS_DATA_INDEX_OUT_OF_RANGE (HIDP_ERROR_CODES(0xcu,0x0e))
244 #define HIDP_STATUS_BUTTON_NOT_PRESSED (HIDP_ERROR_CODES(0xcu,0x0f))
245 #define HIDP_STATUS_REPORT_DOES_NOT_EXIST (HIDP_ERROR_CODES(0xcu,0x10))
246 #define HIDP_STATUS_NOT_IMPLEMENTED (HIDP_ERROR_CODES(0xcu,0x20))
248 #endif /* __HIDPI_H__ */