Atlas - SDL_hid.h
Home / ext / SDL / src / core / windows Lines: 1 | Size: 7262 bytes [Download] [Show on GitHub] [Search similar files] [Raw] [Raw (proxy)][FILE BEGIN]1/* 2 Simple DirectMedia Layer 3 Copyright (C) 1997-2025 Sam Lantinga <[email protected]> 4 5 This software is provided 'as-is', without any express or implied 6 warranty. In no event will the authors be held liable for any damages 7 arising from the use of this software. 8 9 Permission is granted to anyone to use this software for any purpose, 10 including commercial applications, and to alter it and redistribute it 11 freely, subject to the following restrictions: 12 13 1. The origin of this software must not be misrepresented; you must not 14 claim that you wrote the original software. If you use this software 15 in a product, an acknowledgment in the product documentation would be 16 appreciated but is not required. 17 2. Altered source versions must be plainly marked as such, and must not be 18 misrepresented as being the original software. 19 3. This notice may not be removed or altered from any source distribution. 20*/ 21#include "SDL_internal.h" 22 23#ifndef SDL_hid_h_ 24#define SDL_hid_h_ 25 26#include "SDL_windows.h" 27 28typedef LONG NTSTATUS; 29typedef USHORT USAGE; 30typedef struct _HIDP_PREPARSED_DATA *PHIDP_PREPARSED_DATA; 31 32typedef struct _HIDD_ATTRIBUTES 33{ 34 ULONG Size; 35 USHORT VendorID; 36 USHORT ProductID; 37 USHORT VersionNumber; 38} HIDD_ATTRIBUTES, *PHIDD_ATTRIBUTES; 39 40typedef enum 41{ 42 HidP_Input = 0, 43 HidP_Output = 1, 44 HidP_Feature = 2 45} HIDP_REPORT_TYPE; 46 47typedef struct 48{ 49 USAGE UsagePage; 50 UCHAR ReportID; 51 BOOLEAN IsAlias; 52 USHORT BitField; 53 USHORT LinkCollection; 54 USAGE LinkUsage; 55 USAGE LinkUsagePage; 56 BOOLEAN IsRange; 57 BOOLEAN IsStringRange; 58 BOOLEAN IsDesignatorRange; 59 BOOLEAN IsAbsolute; 60 ULONG Reserved[10]; 61 union 62 { 63 struct 64 { 65 USAGE UsageMin; 66 USAGE UsageMax; 67 USHORT StringMin; 68 USHORT StringMax; 69 USHORT DesignatorMin; 70 USHORT DesignatorMax; 71 USHORT DataIndexMin; 72 USHORT DataIndexMax; 73 } Range; 74 struct 75 { 76 USAGE Usage; 77 USAGE Reserved1; 78 USHORT StringIndex; 79 USHORT Reserved2; 80 USHORT DesignatorIndex; 81 USHORT Reserved3; 82 USHORT DataIndex; 83 USHORT Reserved4; 84 } NotRange; 85 }; 86} HIDP_BUTTON_CAPS, *PHIDP_BUTTON_CAPS; 87 88typedef struct 89{ 90 USAGE UsagePage; 91 UCHAR ReportID; 92 BOOLEAN IsAlias; 93 USHORT BitField; 94 USHORT LinkCollection; 95 USAGE LinkUsage; 96 USAGE LinkUsagePage; 97 BOOLEAN IsRange; 98 BOOLEAN IsStringRange; 99 BOOLEAN IsDesignatorRange; 100 BOOLEAN IsAbsolute; 101 BOOLEAN HasNull; 102 UCHAR Reserved; 103 USHORT BitSize; 104 USHORT ReportCount; 105 USHORT Reserved2[5]; 106 ULONG UnitsExp; 107 ULONG Units; 108 LONG LogicalMin; 109 LONG LogicalMax; 110 LONG PhysicalMin; 111 LONG PhysicalMax; 112 union 113 { 114 struct 115 { 116 USAGE UsageMin; 117 USAGE UsageMax; 118 USHORT StringMin; 119 USHORT StringMax; 120 USHORT DesignatorMin; 121 USHORT DesignatorMax; 122 USHORT DataIndexMin; 123 USHORT DataIndexMax; 124 } Range; 125 struct 126 { 127 USAGE Usage; 128 USAGE Reserved1; 129 USHORT StringIndex; 130 USHORT Reserved2; 131 USHORT DesignatorIndex; 132 USHORT Reserved3; 133 USHORT DataIndex; 134 USHORT Reserved4; 135 } NotRange; 136 }; 137} HIDP_VALUE_CAPS, *PHIDP_VALUE_CAPS; 138 139typedef struct 140{ 141 USAGE Usage; 142 USAGE UsagePage; 143 USHORT InputReportByteLength; 144 USHORT OutputReportByteLength; 145 USHORT FeatureReportByteLength; 146 USHORT Reserved[17]; 147 USHORT NumberLinkCollectionNodes; 148 USHORT NumberInputButtonCaps; 149 USHORT NumberInputValueCaps; 150 USHORT NumberInputDataIndices; 151 USHORT NumberOutputButtonCaps; 152 USHORT NumberOutputValueCaps; 153 USHORT NumberOutputDataIndices; 154 USHORT NumberFeatureButtonCaps; 155 USHORT NumberFeatureValueCaps; 156 USHORT NumberFeatureDataIndices; 157} HIDP_CAPS, *PHIDP_CAPS; 158 159typedef struct 160{ 161 USHORT DataIndex; 162 USHORT Reserved; 163 union 164 { 165 ULONG RawValue; 166 BOOLEAN On; 167 }; 168} HIDP_DATA, *PHIDP_DATA; 169 170#define HIDP_ERROR_CODES(p1, p2) ((NTSTATUS)(((p1) << 28) | (0x11 << 16) | (p2))) 171#define HIDP_STATUS_SUCCESS HIDP_ERROR_CODES(0x0, 0x0000) 172#define HIDP_STATUS_NULL HIDP_ERROR_CODES(0x8, 0x0001) 173#define HIDP_STATUS_INVALID_PREPARSED_DATA HIDP_ERROR_CODES(0xC, 0x0001) 174#define HIDP_STATUS_INVALID_REPORT_TYPE HIDP_ERROR_CODES(0xC, 0x0002) 175#define HIDP_STATUS_INVALID_REPORT_LENGTH HIDP_ERROR_CODES(0xC, 0x0003) 176#define HIDP_STATUS_USAGE_NOT_FOUND HIDP_ERROR_CODES(0xC, 0x0004) 177#define HIDP_STATUS_VALUE_OUT_OF_RANGE HIDP_ERROR_CODES(0xC, 0x0005) 178#define HIDP_STATUS_BAD_LOG_PHY_VALUES HIDP_ERROR_CODES(0xC, 0x0006) 179#define HIDP_STATUS_BUFFER_TOO_SMALL HIDP_ERROR_CODES(0xC, 0x0007) 180#define HIDP_STATUS_INTERNAL_ERROR HIDP_ERROR_CODES(0xC, 0x0008) 181#define HIDP_STATUS_I8042_TRANS_UNKNOWN HIDP_ERROR_CODES(0xC, 0x0009) 182#define HIDP_STATUS_INCOMPATIBLE_REPORT_ID HIDP_ERROR_CODES(0xC, 0x000A) 183#define HIDP_STATUS_NOT_VALUE_ARRAY HIDP_ERROR_CODES(0xC, 0x000B) 184#define HIDP_STATUS_IS_VALUE_ARRAY HIDP_ERROR_CODES(0xC, 0x000C) 185#define HIDP_STATUS_DATA_INDEX_NOT_FOUND HIDP_ERROR_CODES(0xC, 0x000D) 186#define HIDP_STATUS_DATA_INDEX_OUT_OF_RANGE HIDP_ERROR_CODES(0xC, 0x000E) 187#define HIDP_STATUS_BUTTON_NOT_PRESSED HIDP_ERROR_CODES(0xC, 0x000F) 188#define HIDP_STATUS_REPORT_DOES_NOT_EXIST HIDP_ERROR_CODES(0xC, 0x0010) 189#define HIDP_STATUS_NOT_IMPLEMENTED HIDP_ERROR_CODES(0xC, 0x0020) 190 191extern bool WIN_LoadHIDDLL(void); 192extern void WIN_UnloadHIDDLL(void); 193 194typedef BOOLEAN (WINAPI *HidD_GetAttributes_t)(HANDLE HidDeviceObject, PHIDD_ATTRIBUTES Attributes); 195typedef BOOLEAN (WINAPI *HidD_GetString_t)(HANDLE HidDeviceObject, PVOID Buffer, ULONG BufferLength); 196typedef NTSTATUS (WINAPI *HidP_GetCaps_t)(PHIDP_PREPARSED_DATA PreparsedData, PHIDP_CAPS Capabilities); 197typedef NTSTATUS (WINAPI *HidP_GetButtonCaps_t)(HIDP_REPORT_TYPE ReportType, PHIDP_BUTTON_CAPS ButtonCaps, PUSHORT ButtonCapsLength, PHIDP_PREPARSED_DATA PreparsedData); 198typedef NTSTATUS (WINAPI *HidP_GetValueCaps_t)(HIDP_REPORT_TYPE ReportType, PHIDP_VALUE_CAPS ValueCaps, PUSHORT ValueCapsLength, PHIDP_PREPARSED_DATA PreparsedData); 199typedef ULONG (WINAPI *HidP_MaxDataListLength_t)(HIDP_REPORT_TYPE ReportType, PHIDP_PREPARSED_DATA PreparsedData); 200typedef NTSTATUS (WINAPI *HidP_GetData_t)(HIDP_REPORT_TYPE ReportType, PHIDP_DATA DataList, PULONG DataLength, PHIDP_PREPARSED_DATA PreparsedData, PCHAR Report, ULONG ReportLength); 201 202extern HidD_GetAttributes_t SDL_HidD_GetAttributes; 203extern HidD_GetString_t SDL_HidD_GetManufacturerString; 204extern HidD_GetString_t SDL_HidD_GetProductString; 205extern HidP_GetCaps_t SDL_HidP_GetCaps; 206extern HidP_GetButtonCaps_t SDL_HidP_GetButtonCaps; 207extern HidP_GetValueCaps_t SDL_HidP_GetValueCaps; 208extern HidP_MaxDataListLength_t SDL_HidP_MaxDataListLength; 209extern HidP_GetData_t SDL_HidP_GetData; 210 211void WIN_InitDeviceNotification(void); 212Uint64 WIN_GetLastDeviceNotification(void); 213void WIN_QuitDeviceNotification(void); 214 215#endif // SDL_hid_h_ 216[FILE END](C) 2025 0x4248 (C) 2025 4248 Media and 4248 Systems, All part of 0x4248 See LICENCE files for more information. Not all files are by 0x4248 always check Licencing.