1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
// +build windows
package sys_windows
import "core:c"
USAGE :: distinct USHORT
PUSAGE :: ^USAGE
HIDP_CAPS :: struct {
Usage: USAGE,
UsagePage: USAGE,
InputReportByteLength: USHORT,
OutputReportByteLength: USHORT,
FeatureReportByteLength: USHORT,
Reserved: [17]USHORT,
NumberLinkCollectionNodes: USHORT,
NumberInputButtonCaps: USHORT,
NumberInputValueCaps: USHORT,
NumberInputDataIndices: USHORT,
NumberOutputButtonCaps: USHORT,
NumberOutputValueCaps: USHORT,
NumberOutputDataIndices: USHORT,
NumberFeatureButtonCaps: USHORT,
NumberFeatureValueCaps: USHORT,
NumberFeatureDataIndices: USHORT,
}
PHIDP_CAPS :: ^HIDP_CAPS
HIDP_BUTTON_CAPS :: struct {
UsagePage: USAGE,
ReportID: UCHAR,
IsAlias: BOOLEAN,
BitField: USHORT,
LinkCollection: USHORT,
LinkUsage: USAGE,
LinkUsagePage: USAGE,
IsRange: BOOLEAN,
IsStringRange: BOOLEAN,
IsDesignatorRange: BOOLEAN,
IsAbsolute: BOOLEAN,
ReportCount: USHORT,
Reserved2: USHORT,
Reserved: [9]ULONG,
using _: struct #raw_union {
Range: struct {
UsageMin: USAGE,
UsageMax: USAGE,
StringMin: USHORT,
StringMax: USHORT,
DesignatorMin: USHORT,
DesignatorMax: USHORT,
DataIndexMin: USHORT,
DataIndexMax: USHORT,
},
NotRange: struct {
Usage: USAGE,
Reserved1: USAGE,
StringIndex: USHORT,
Reserved2: USHORT,
DesignatorIndex: USHORT,
Reserved3: USHORT,
DataIndex: USHORT,
Reserved4: USHORT,
},
},
}
PHIDP_BUTTON_CAPS :: ^HIDP_BUTTON_CAPS
HIDP_VALUE_CAPS :: struct {
UsagePage: USAGE,
ReportID: UCHAR,
IsAlias: BOOLEAN,
BitField: USHORT,
LinkCollection: USHORT,
LinkUsage: USAGE,
LinkUsagePage: USAGE,
IsRange: BOOLEAN,
IsStringRange: BOOLEAN,
IsDesignatorRange: BOOLEAN,
IsAbsolute: BOOLEAN,
HasNull: BOOLEAN,
Reserved: UCHAR,
BitSize: USHORT,
ReportCount: USHORT,
Reserved2: [5]USHORT,
UnitsExp: ULONG,
Units: ULONG,
LogicalMin: LONG,
LogicalMax: LONG,
PhysicalMin: LONG,
PhysicalMax: LONG,
using _: struct #raw_union {
Range: struct {
UsageMin: USAGE,
UsageMax: USAGE,
StringMin: USHORT,
StringMax: USHORT,
DesignatorMin: USHORT,
DesignatorMax: USHORT,
DataIndexMin: USHORT,
DataIndexMax: USHORT,
},
NotRange: struct {
Usage: USAGE,
Reserved1: USAGE,
StringIndex: USHORT,
Reserved2: USHORT,
DesignatorIndex: USHORT,
Reserved3: USHORT,
DataIndex: USHORT,
Reserved4: USHORT,
},
},
}
PHIDP_VALUE_CAPS :: ^HIDP_VALUE_CAPS
PHIDP_PREPARSED_DATA :: rawptr
HIDP_REPORT_TYPE :: enum c.int {
Input,
Output,
Feature,
}
HIDP_STATUS_SUCCESS : NTSTATUS : 0x110000
foreign import hid "system:hid.lib"
@(default_calling_convention="system")
foreign hid {
HidP_GetCaps :: proc(PreparsedData: PHIDP_PREPARSED_DATA, Capabilities: PHIDP_CAPS) -> NTSTATUS ---
HidP_GetButtonCaps :: proc(ReportType: HIDP_REPORT_TYPE, ButtonCaps: PHIDP_BUTTON_CAPS, ButtonCapsLength: PUSHORT, PreparsedData: PHIDP_PREPARSED_DATA) -> NTSTATUS ---
HidP_GetValueCaps :: proc(ReportType: HIDP_REPORT_TYPE, ValueCaps: PHIDP_VALUE_CAPS, ValueCapsLength: PUSHORT, PreparsedData: PHIDP_PREPARSED_DATA) -> NTSTATUS ---
HidP_GetUsages :: proc(ReportType: HIDP_REPORT_TYPE, UsagePage: USAGE, LinkCollection: USHORT, UsageList: PUSAGE, UsageLength: PULONG, PreparsedData: PHIDP_PREPARSED_DATA, Report: PCHAR, ReportLength: ULONG) -> NTSTATUS ---
HidP_GetUsageValue :: proc(ReportType: HIDP_REPORT_TYPE, UsagePage: USAGE, LinkCollection: USHORT, Usage: USAGE, UsageValue: PULONG, PreparsedData: PHIDP_PREPARSED_DATA, Report: PCHAR, ReportLength: ULONG) -> NTSTATUS ---
}
|