1 /* 2 * PROJECT: ReactOS Universal Serial Bus Bulk Enhanced Host Controller Interface 3 * LICENSE: GPL - See COPYING in the top level directory 4 * FILE: lib/drivers/hidparser/hidparser.c 5 * PURPOSE: HID Parser 6 * PROGRAMMERS: 7 * Michael Martin (michael.martin@reactos.org) 8 * Johannes Anderwald (johannes.anderwald@reactos.org) 9 */ 10 11 #pragma once 12 13 NTSTATUS 14 NTAPI 15 HidParser_GetCollectionDescription( 16 IN PHIDP_REPORT_DESCRIPTOR ReportDesc, 17 IN ULONG DescLength, 18 IN POOL_TYPE PoolType, 19 OUT PHIDP_DEVICE_DESC DeviceDescription); 20 21 VOID 22 NTAPI 23 HidParser_FreeCollectionDescription( 24 IN PHIDP_DEVICE_DESC DeviceDescription); 25 26 HIDAPI 27 NTSTATUS 28 NTAPI 29 HidParser_GetCaps( 30 IN PVOID CollectionContext, 31 OUT PHIDP_CAPS Capabilities); 32 33 HIDAPI 34 NTSTATUS 35 NTAPI 36 HidParser_GetSpecificValueCaps( 37 IN PVOID CollectionContext, 38 IN HIDP_REPORT_TYPE ReportType, 39 IN USAGE UsagePage, 40 IN USHORT LinkCollection, 41 IN USAGE Usage, 42 OUT PHIDP_VALUE_CAPS ValueCaps, 43 IN OUT PUSHORT ValueCapsLength); 44 45 46 HIDAPI 47 NTSTATUS 48 NTAPI 49 HidParser_GetButtonCaps( 50 IN PVOID CollectionContext, 51 HIDP_REPORT_TYPE ReportType, 52 PHIDP_BUTTON_CAPS ButtonCaps, 53 PUSHORT ButtonCapsLength); 54 55 HIDAPI 56 NTSTATUS 57 NTAPI 58 HidParser_GetSpecificButtonCaps( 59 IN PVOID CollectionContext, 60 IN HIDP_REPORT_TYPE ReportType, 61 IN USAGE UsagePage, 62 IN USHORT LinkCollection, 63 IN USAGE Usage, 64 OUT PHIDP_BUTTON_CAPS ButtonCaps, 65 IN OUT PULONG ButtonCapsLength); 66 67 HIDAPI 68 NTSTATUS 69 NTAPI 70 HidParser_GetScaledUsageValue( 71 IN PVOID CollectionContext, 72 IN HIDP_REPORT_TYPE ReportType, 73 IN USAGE UsagePage, 74 IN USHORT LinkCollection OPTIONAL, 75 IN USAGE Usage, 76 OUT PLONG UsageValue, 77 IN PCHAR Report, 78 IN ULONG ReportLength); 79 80 81 HIDAPI 82 NTSTATUS 83 NTAPI 84 HidParser_GetData( 85 IN PVOID CollectionContext, 86 IN HIDP_REPORT_TYPE ReportType, 87 OUT PHIDP_DATA DataList, 88 IN OUT PULONG DataLength, 89 IN PCHAR Report, 90 IN ULONG ReportLength); 91 92 HIDAPI 93 NTSTATUS 94 NTAPI 95 HidParser_GetExtendedAttributes( 96 IN PVOID CollectionContext, 97 IN HIDP_REPORT_TYPE ReportType, 98 IN USHORT DataIndex, 99 OUT PHIDP_EXTENDED_ATTRIBUTES Attributes, 100 IN OUT PULONG LengthAttributes); 101 102 HIDAPI 103 NTSTATUS 104 NTAPI 105 HidParser_GetLinkCollectionNodes( 106 IN PVOID CollectionContext, 107 OUT PHIDP_LINK_COLLECTION_NODE LinkCollectionNodes, 108 IN OUT PULONG LinkCollectionNodesLength); 109 110 111 HIDAPI 112 NTSTATUS 113 NTAPI 114 HidParser_GetUsageValue( 115 IN PVOID CollectionContext, 116 IN HIDP_REPORT_TYPE ReportType, 117 IN USAGE UsagePage, 118 IN USHORT LinkCollection, 119 IN USAGE Usage, 120 OUT PULONG UsageValue, 121 IN PCHAR Report, 122 IN ULONG ReportLength); 123 124 HIDAPI 125 NTSTATUS 126 NTAPI 127 HidParser_UsageListDifference( 128 IN PUSAGE PreviousUsageList, 129 IN PUSAGE CurrentUsageList, 130 OUT PUSAGE BreakUsageList, 131 OUT PUSAGE MakeUsageList, 132 IN ULONG UsageListLength); 133 134 135 HIDAPI 136 ULONG 137 NTAPI 138 HidParser_MaxUsageListLength( 139 IN PVOID CollectionContext, 140 IN HIDP_REPORT_TYPE ReportType, 141 IN USAGE UsagePage OPTIONAL); 142 143 HIDAPI 144 NTSTATUS 145 NTAPI 146 HidParser_GetUsages( 147 IN PVOID CollectionContext, 148 IN HIDP_REPORT_TYPE ReportType, 149 IN USAGE UsagePage, 150 IN USHORT LinkCollection OPTIONAL, 151 OUT USAGE *UsageList, 152 IN OUT ULONG *UsageLength, 153 IN PCHAR Report, 154 IN ULONG ReportLength); 155 156 HIDAPI 157 NTSTATUS 158 NTAPI 159 HidParser_GetUsagesEx( 160 IN PVOID CollectionContext, 161 IN HIDP_REPORT_TYPE ReportType, 162 IN USHORT LinkCollection, 163 OUT PUSAGE_AND_PAGE ButtonList, 164 IN OUT ULONG *UsageLength, 165 IN PCHAR Report, 166 IN ULONG ReportLength); 167 168 169 NTSTATUS 170 NTAPI 171 HidParser_SysPowerEvent ( 172 IN PVOID CollectionContext, 173 IN PCHAR HidPacket, 174 IN USHORT HidPacketLength, 175 OUT PULONG OutputBuffer); 176 177 NTSTATUS 178 NTAPI 179 HidParser_SysPowerCaps ( 180 IN PVOID CollectionContext, 181 OUT PULONG OutputBuffer); 182 183 HIDAPI 184 NTSTATUS 185 NTAPI 186 HidParser_GetUsageValueArray( 187 IN PVOID CollectionContext, 188 IN HIDP_REPORT_TYPE ReportType, 189 IN USAGE UsagePage, 190 IN USHORT LinkCollection OPTIONAL, 191 IN USAGE Usage, 192 OUT PCHAR UsageValue, 193 IN USHORT UsageValueByteLength, 194 IN PCHAR Report, 195 IN ULONG ReportLength); 196 197 198 HIDAPI 199 NTSTATUS 200 NTAPI 201 HidParser_UsageAndPageListDifference( 202 IN PUSAGE_AND_PAGE PreviousUsageList, 203 IN PUSAGE_AND_PAGE CurrentUsageList, 204 OUT PUSAGE_AND_PAGE BreakUsageList, 205 OUT PUSAGE_AND_PAGE MakeUsageList, 206 IN ULONG UsageListLength); 207 208 HIDAPI 209 NTSTATUS 210 NTAPI 211 HidParser_UnsetUsages( 212 IN PVOID CollectionContext, 213 IN HIDP_REPORT_TYPE ReportType, 214 IN USAGE UsagePage, 215 IN USHORT LinkCollection, 216 IN PUSAGE UsageList, 217 IN OUT PULONG UsageLength, 218 IN OUT PCHAR Report, 219 IN ULONG ReportLength); 220 221 HIDAPI 222 NTSTATUS 223 NTAPI 224 HidParser_TranslateUsagesToI8042ScanCodes( 225 IN PUSAGE ChangedUsageList, 226 IN ULONG UsageListLength, 227 IN HIDP_KEYBOARD_DIRECTION KeyAction, 228 IN OUT PHIDP_KEYBOARD_MODIFIER_STATE ModifierState, 229 IN PHIDP_INSERT_SCANCODES InsertCodesProcedure, 230 IN PVOID InsertCodesContext); 231 232 HIDAPI 233 NTSTATUS 234 NTAPI 235 HidParser_TranslateUsageAndPagesToI8042ScanCodes( 236 IN PUSAGE_AND_PAGE ChangedUsageList, 237 IN ULONG UsageListLength, 238 IN HIDP_KEYBOARD_DIRECTION KeyAction, 239 IN OUT PHIDP_KEYBOARD_MODIFIER_STATE ModifierState, 240 IN PHIDP_INSERT_SCANCODES InsertCodesProcedure, 241 IN PVOID InsertCodesContext); 242 243 HIDAPI 244 NTSTATUS 245 NTAPI 246 HidParser_SetUsages( 247 IN PVOID CollectionContext, 248 IN HIDP_REPORT_TYPE ReportType, 249 IN USAGE UsagePage, 250 IN USHORT LinkCollection, 251 IN PUSAGE UsageList, 252 IN OUT PULONG UsageLength, 253 IN OUT PCHAR Report, 254 IN ULONG ReportLength); 255 256 HIDAPI 257 NTSTATUS 258 NTAPI 259 HidParser_SetUsageValueArray( 260 IN PVOID CollectionContext, 261 IN HIDP_REPORT_TYPE ReportType, 262 IN USAGE UsagePage, 263 IN USHORT LinkCollection OPTIONAL, 264 IN USAGE Usage, 265 IN PCHAR UsageValue, 266 IN USHORT UsageValueByteLength, 267 OUT PCHAR Report, 268 IN ULONG ReportLength); 269 270 HIDAPI 271 NTSTATUS 272 NTAPI 273 HidParser_SetUsageValue( 274 IN PVOID CollectionContext, 275 IN HIDP_REPORT_TYPE ReportType, 276 IN USAGE UsagePage, 277 IN USHORT LinkCollection, 278 IN USAGE Usage, 279 IN ULONG UsageValue, 280 IN OUT PCHAR Report, 281 IN ULONG ReportLength); 282 283 HIDAPI 284 NTSTATUS 285 NTAPI 286 HidParser_SetScaledUsageValue( 287 IN PVOID CollectionContext, 288 IN HIDP_REPORT_TYPE ReportType, 289 IN USAGE UsagePage, 290 IN USHORT LinkCollection OPTIONAL, 291 IN USAGE Usage, 292 IN LONG UsageValue, 293 IN OUT PCHAR Report, 294 IN ULONG ReportLength); 295 296 HIDAPI 297 NTSTATUS 298 NTAPI 299 HidParser_SetData( 300 IN PVOID CollectionContext, 301 IN HIDP_REPORT_TYPE ReportType, 302 IN PHIDP_DATA DataList, 303 IN OUT PULONG DataLength, 304 IN OUT PCHAR Report, 305 IN ULONG ReportLength); 306 307 HIDAPI 308 ULONG 309 NTAPI 310 HidParser_MaxDataListLength( 311 IN PVOID CollectionContext, 312 IN HIDP_REPORT_TYPE ReportType); 313 314 HIDAPI 315 NTSTATUS 316 NTAPI 317 HidParser_InitializeReportForID( 318 IN PVOID CollectionContext, 319 IN HIDP_REPORT_TYPE ReportType, 320 IN UCHAR ReportID, 321 IN OUT PCHAR Report, 322 IN ULONG ReportLength); 323 324 NTSTATUS 325 HidParser_TranslateKbdUsage( 326 IN USAGE Usage, 327 IN HIDP_KEYBOARD_DIRECTION KeyAction, 328 IN OUT PHIDP_KEYBOARD_MODIFIER_STATE ModifierState, 329 IN PHIDP_INSERT_SCANCODES InsertCodesProcedure, 330 IN PVOID InsertCodesContext); 331 332 NTSTATUS 333 HidParser_TranslateCustUsage( 334 IN USAGE Usage, 335 IN HIDP_KEYBOARD_DIRECTION KeyAction, 336 IN OUT PHIDP_KEYBOARD_MODIFIER_STATE ModifierState, 337 IN PHIDP_INSERT_SCANCODES InsertCodesProcedure, 338 IN PVOID InsertCodesContext); 339 340 HIDAPI 341 NTSTATUS 342 NTAPI 343 HidParser_GetValueCaps( 344 IN PVOID CollectionContext, 345 HIDP_REPORT_TYPE ReportType, 346 PHIDP_VALUE_CAPS ValueCaps, 347 PULONG ValueCapsLength); 348