Panda3D
Loading...
Searching...
No Matches
phidsdi.h
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file phidsdi.h
10 * @author rdb
11 * @date 2019-02-05
12 */
13
14#ifndef PHIDSDI_H
15#define PHIDSDI_H
16
17#if defined(_WIN32) && !defined(CPPPARSER)
18
19// Copy definitions from hidusage.h, until we can drop support for the 7.1 SDK
20typedef USHORT USAGE, *PUSAGE;
21
22#define HID_USAGE_PAGE_UNDEFINED ((USAGE) 0x00)
23#define HID_USAGE_PAGE_GENERIC ((USAGE) 0x01)
24#define HID_USAGE_PAGE_SIMULATION ((USAGE) 0x02)
25#define HID_USAGE_PAGE_VR ((USAGE) 0x03)
26#define HID_USAGE_PAGE_SPORT ((USAGE) 0x04)
27#define HID_USAGE_PAGE_GAME ((USAGE) 0x05)
28#define HID_USAGE_PAGE_KEYBOARD ((USAGE) 0x07)
29#define HID_USAGE_PAGE_LED ((USAGE) 0x08)
30#define HID_USAGE_PAGE_BUTTON ((USAGE) 0x09)
31#define HID_USAGE_PAGE_DIGITIZER ((USAGE) 0x0d)
32
33#define HID_USAGE_GENERIC_POINTER ((USAGE) 0x01)
34#define HID_USAGE_GENERIC_MOUSE ((USAGE) 0x02)
35#define HID_USAGE_GENERIC_JOYSTICK ((USAGE) 0x04)
36#define HID_USAGE_GENERIC_GAMEPAD ((USAGE) 0x05)
37#define HID_USAGE_GENERIC_KEYBOARD ((USAGE) 0x06)
38#define HID_USAGE_GENERIC_KEYPAD ((USAGE) 0x07)
39#define HID_USAGE_GENERIC_SYSTEM_CTL ((USAGE) 0x80)
40
41#define HID_USAGE_GENERIC_X ((USAGE) 0x30)
42#define HID_USAGE_GENERIC_Y ((USAGE) 0x31)
43#define HID_USAGE_GENERIC_Z ((USAGE) 0x32)
44#define HID_USAGE_GENERIC_RX ((USAGE) 0x33)
45#define HID_USAGE_GENERIC_RY ((USAGE) 0x34)
46#define HID_USAGE_GENERIC_RZ ((USAGE) 0x35)
47#define HID_USAGE_GENERIC_SLIDER ((USAGE) 0x36)
48#define HID_USAGE_GENERIC_DIAL ((USAGE) 0x37)
49#define HID_USAGE_GENERIC_WHEEL ((USAGE) 0x38)
50#define HID_USAGE_GENERIC_HATSWITCH ((USAGE) 0x39)
51
52// Copy definitions from hidpi.h, until we can drop support for the 7.1 SDK
53#define HIDP_STATUS_SUCCESS ((NTSTATUS)(0x11 << 16))
54
55typedef enum _HIDP_REPORT_TYPE {
56 HidP_Input,
57 HidP_Output,
58 HidP_Feature
59} HIDP_REPORT_TYPE;
60
61typedef struct _HIDP_BUTTON_CAPS {
62 USAGE UsagePage;
63 UCHAR ReportID;
64 BOOLEAN IsAlias;
65 USHORT BitField;
66 USHORT LinkCollection;
67 USAGE LinkUsage;
68 USAGE LinkUsagePage;
69 BOOLEAN IsRange;
70 BOOLEAN IsStringRange;
71 BOOLEAN IsDesignatorRange;
72 BOOLEAN IsAbsolute;
73 ULONG Reserved[10];
74 union {
75 struct {
76 USAGE UsageMin, UsageMax;
77 USHORT StringMin, StringMax;
78 USHORT DesignatorMin, DesignatorMax;
79 USHORT DataIndexMin, DataIndexMax;
80 } Range;
81 struct {
82 USAGE Usage, Reserved1;
83 USHORT StringIndex, Reserved2;
84 USHORT DesignatorIndex, Reserved3;
85 USHORT DataIndex, Reserved4;
86 } NotRange;
87 };
88} HIDP_BUTTON_CAPS, *PHIDP_BUTTON_CAPS;
89
90typedef struct _HIDP_VALUE_CAPS {
91 USAGE UsagePage;
92 UCHAR ReportID;
93 BOOLEAN IsAlias;
94 USHORT BitField;
95 USHORT LinkCollection;
96 USAGE LinkUsage;
97 USAGE LinkUsagePage;
98 BOOLEAN IsRange;
99 BOOLEAN IsStringRange;
100 BOOLEAN IsDesignatorRange;
101 BOOLEAN IsAbsolute;
102 BOOLEAN HasNull;
103 UCHAR Reserved;
104 USHORT BitSize;
105 USHORT ReportCount;
106 USHORT Reserved2[5];
107 ULONG UnitsExp;
108 ULONG Units;
109 LONG LogicalMin, LogicalMax;
110 LONG PhysicalMin, PhysicalMax;
111 union {
112 struct {
113 USAGE UsageMin, UsageMax;
114 USHORT StringMin, StringMax;
115 USHORT DesignatorMin, DesignatorMax;
116 USHORT DataIndexMin, DataIndexMax;
117 } Range;
118 struct {
119 USAGE Usage, Reserved1;
120 USHORT StringIndex, Reserved2;
121 USHORT DesignatorIndex, Reserved3;
122 USHORT DataIndex, Reserved4;
123 } NotRange;
124 };
125} HIDP_VALUE_CAPS, *PHIDP_VALUE_CAPS;
126
127typedef PUCHAR PHIDP_REPORT_DESCRIPTOR;
128typedef struct _HIDP_PREPARSED_DATA *PHIDP_PREPARSED_DATA;
129
130typedef struct _HIDP_CAPS {
131 USAGE Usage;
132 USAGE UsagePage;
133 USHORT InputReportByteLength;
134 USHORT OutputReportByteLength;
135 USHORT FeatureReportByteLength;
136 USHORT Reserved[17];
137 USHORT NumberLinkCollectionNodes;
138 USHORT NumberInputButtonCaps;
139 USHORT NumberInputValueCaps;
140 USHORT NumberInputDataIndices;
141 USHORT NumberOutputButtonCaps;
142 USHORT NumberOutputValueCaps;
143 USHORT NumberOutputDataIndices;
144 USHORT NumberFeatureButtonCaps;
145 USHORT NumberFeatureValueCaps;
146 USHORT NumberFeatureDataIndices;
147} HIDP_CAPS, *PHIDP_CAPS;
148
149typedef struct _HIDP_DATA {
150 USHORT DataIndex;
151 USHORT Reserved;
152 union {
153 ULONG RawValue;
154 BOOLEAN On;
155 };
156} HIDP_DATA, *PHIDP_DATA;
157
158typedef LONG NTSTATUS;
159typedef NTSTATUS (__stdcall *pHidP_GetCaps)(PHIDP_PREPARSED_DATA, PHIDP_CAPS);
160typedef NTSTATUS (__stdcall *pHidP_GetButtonCaps)(HIDP_REPORT_TYPE, PHIDP_BUTTON_CAPS, PUSHORT, PHIDP_PREPARSED_DATA);
161typedef NTSTATUS (__stdcall *pHidP_GetValueCaps)(HIDP_REPORT_TYPE, PHIDP_VALUE_CAPS, PUSHORT, PHIDP_PREPARSED_DATA);
162typedef NTSTATUS (__stdcall *pHidP_GetData)(HIDP_REPORT_TYPE, PHIDP_DATA, PULONG, PHIDP_PREPARSED_DATA, PCHAR, ULONG);
163typedef ULONG (__stdcall *pHidP_MaxDataListLength)(HIDP_REPORT_TYPE, PHIDP_PREPARSED_DATA);
164
165#endif
166
167#endif