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
22 typedef enum _HIDP_REPORT_TYPE
29 typedef struct _HIDP_BUTTON_CAPS
35 USHORT LinkCollection
;
40 BOOLEAN IsStringRange
;
41 BOOLEAN IsDesignatorRange
;
60 USHORT DesignatorIndex
;
66 } HIDP_BUTTON_CAPS
, *PHIDP_BUTTON_CAPS
;
68 typedef struct _HIDP_VALUE_CAPS
74 USHORT LinkCollection
;
79 BOOLEAN IsStringRange
;
80 BOOLEAN IsDesignatorRange
;
100 USHORT DesignatorMax
;
109 USHORT DesignatorIndex
;
115 } HIDP_VALUE_CAPS
, *PHIDP_VALUE_CAPS
;
117 typedef struct _HIDP_PREPARSED_DATA
* PHIDP_PREPARSED_DATA
;
119 typedef struct _HIDP_CAPS
123 USHORT InputReportByteLength
;
124 USHORT OutputReportByteLength
;
125 USHORT FeatureReportByteLength
;
127 USHORT NumberLinkCollectionNodes
;
128 USHORT NumberInputButtonCaps
;
129 USHORT NumberInputValueCaps
;
130 USHORT NumberInputDataIndices
;
131 USHORT NumberOutputButtonCaps
;
132 USHORT NumberOutputValueCaps
;
133 USHORT NumberOutputDataIndices
;
134 USHORT NumberFeatureButtonCaps
;
135 USHORT NumberFeatureValueCaps
;
136 USHORT NumberFeatureDataIndices
;
137 } HIDP_CAPS
, *PHIDP_CAPS
;
139 NTSTATUS WINAPI
HidP_GetButtonCaps(HIDP_REPORT_TYPE ReportType
, PHIDP_BUTTON_CAPS ButtonCaps
, PUSHORT ButtonCapsLength
, PHIDP_PREPARSED_DATA PreparsedData
);
140 NTSTATUS WINAPI
HidP_GetCaps(PHIDP_PREPARSED_DATA PreparsedData
, PHIDP_CAPS Capabilities
);
141 NTSTATUS WINAPI
HidP_GetUsages(HIDP_REPORT_TYPE ReportType
, USAGE UsagePage
, USHORT LinkCollection
, PUSAGE UsageList
, PULONG UsageLength
, PHIDP_PREPARSED_DATA PreparsedData
, PCHAR Report
, ULONG ReportLength
);
142 NTSTATUS WINAPI
HidP_GetUsageValue(HIDP_REPORT_TYPE ReportType
, USAGE UsagePage
, USHORT LinkCollection
, USAGE Usage
, PULONG UsageValue
, PHIDP_PREPARSED_DATA PreparsedData
, PCHAR Report
, ULONG ReportLength
);
143 NTSTATUS WINAPI
HidP_GetValueCaps(HIDP_REPORT_TYPE ReportType
, PHIDP_VALUE_CAPS ValueCaps
, PUSHORT ValueCapsLength
, PHIDP_PREPARSED_DATA PreparsedData
);
144 NTSTATUS WINAPI
HidP_InitializeReportForID(HIDP_REPORT_TYPE ReportType
, UCHAR ReportID
, PHIDP_PREPARSED_DATA PreparsedData
, PCHAR Report
, ULONG ReportLength
);
145 ULONG WINAPI
HidP_MaxUsageListLength(HIDP_REPORT_TYPE ReportType
, USAGE UsagePage
, PHIDP_PREPARSED_DATA PreparsedData
);
146 NTSTATUS WINAPI
HidP_GetScaledUsageValue(HIDP_REPORT_TYPE ReportType
, USAGE UsagePage
, USHORT LinkCollection
, USAGE Usage
, PLONG UsageValue
, PHIDP_PREPARSED_DATA PreparsedData
, PCHAR Report
, ULONG ReportLength
);
148 #ifndef FACILITY_HID_ERROR_CODE
149 #define FACILITY_HID_ERROR_CODE 0x11
152 #define HIDP_ERROR_CODES(sev, code) ((NTSTATUS)(((sev) << 28) | (FACILITY_HID_ERROR_CODE << 16) | (code)))
154 #define HIDP_STATUS_SUCCESS (HIDP_ERROR_CODES(0x0u,0x00))
155 #define HIDP_STATUS_NULL (HIDP_ERROR_CODES(0x8u,0x01))
156 #define HIDP_STATUS_INVALID_PREPARSED_DATA (HIDP_ERROR_CODES(0xcu,0x01))
157 #define HIDP_STATUS_INVALID_REPORT_TYPE (HIDP_ERROR_CODES(0xcu,0x02))
158 #define HIDP_STATUS_INVALID_REPORT_LENGTH (HIDP_ERROR_CODES(0xcu,0x03))
159 #define HIDP_STATUS_USAGE_NOT_FOUND (HIDP_ERROR_CODES(0xcu,0x04))
160 #define HIDP_STATUS_VALUE_OUT_OF_RANGE (HIDP_ERROR_CODES(0xcu,0x05))
161 #define HIDP_STATUS_BAD_LOG_PHY_VALUES (HIDP_ERROR_CODES(0xcu,0x06))
162 #define HIDP_STATUS_BUFFER_TOO_SMALL (HIDP_ERROR_CODES(0xcu,0x07))
163 #define HIDP_STATUS_INTERNAL_ERROR (HIDP_ERROR_CODES(0xcu,0x08))
164 #define HIDP_STATUS_I8242_TRANS_UNKNOWN (HIDP_ERROR_CODES(0xcu,0x09))
165 #define HIDP_STATUS_INCOMPATIBLE_REPORT_ID (HIDP_ERROR_CODES(0xcu,0x0a))
166 #define HIDP_STATUS_NOT_VALUE_ARRAY (HIDP_ERROR_CODES(0xcu,0x0b))
167 #define HIDP_STATUS_IS_VALUE_ARRAY (HIDP_ERROR_CODES(0xcu,0x0c))
168 #define HIDP_STATUS_DATA_INDEX_NOT_FOUND (HIDP_ERROR_CODES(0xcu,0x0d))
169 #define HIDP_STATUS_DATA_INDEX_OUT_OF_RANGE (HIDP_ERROR_CODES(0xcu,0x0e))
170 #define HIDP_STATUS_BUTTON_NOT_PRESSED (HIDP_ERROR_CODES(0xcu,0x0f))
171 #define HIDP_STATUS_REPORT_DOES_NOT_EXIST (HIDP_ERROR_CODES(0xcu,0x10))
172 #define HIDP_STATUS_NOT_IMPLEMENTED (HIDP_ERROR_CODES(0xcu,0x20))
174 #endif /* __HIDPI_H__ */