Panda3D
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
20 typedef 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 
32 #define HID_USAGE_GENERIC_POINTER ((USAGE) 0x01)
33 #define HID_USAGE_GENERIC_MOUSE ((USAGE) 0x02)
34 #define HID_USAGE_GENERIC_JOYSTICK ((USAGE) 0x04)
35 #define HID_USAGE_GENERIC_GAMEPAD ((USAGE) 0x05)
36 #define HID_USAGE_GENERIC_KEYBOARD ((USAGE) 0x06)
37 #define HID_USAGE_GENERIC_KEYPAD ((USAGE) 0x07)
38 #define HID_USAGE_GENERIC_SYSTEM_CTL ((USAGE) 0x80)
39 
40 #define HID_USAGE_GENERIC_X ((USAGE) 0x30)
41 #define HID_USAGE_GENERIC_Y ((USAGE) 0x31)
42 #define HID_USAGE_GENERIC_Z ((USAGE) 0x32)
43 #define HID_USAGE_GENERIC_RX ((USAGE) 0x33)
44 #define HID_USAGE_GENERIC_RY ((USAGE) 0x34)
45 #define HID_USAGE_GENERIC_RZ ((USAGE) 0x35)
46 #define HID_USAGE_GENERIC_SLIDER ((USAGE) 0x36)
47 #define HID_USAGE_GENERIC_DIAL ((USAGE) 0x37)
48 #define HID_USAGE_GENERIC_WHEEL ((USAGE) 0x38)
49 #define HID_USAGE_GENERIC_HATSWITCH ((USAGE) 0x39)
50 
51 // Copy definitions from hidpi.h, until we can drop support for the 7.1 SDK
52 #define HIDP_STATUS_SUCCESS ((NTSTATUS)(0x11 << 16))
53 
54 typedef enum _HIDP_REPORT_TYPE {
55  HidP_Input,
56  HidP_Output,
57  HidP_Feature
58 } HIDP_REPORT_TYPE;
59 
60 typedef struct _HIDP_BUTTON_CAPS {
61  USAGE UsagePage;
62  UCHAR ReportID;
63  BOOLEAN IsAlias;
64  USHORT BitField;
65  USHORT LinkCollection;
66  USAGE LinkUsage;
67  USAGE LinkUsagePage;
68  BOOLEAN IsRange;
69  BOOLEAN IsStringRange;
70  BOOLEAN IsDesignatorRange;
71  BOOLEAN IsAbsolute;
72  ULONG Reserved[10];
73  union {
74  struct {
75  USAGE UsageMin, UsageMax;
76  USHORT StringMin, StringMax;
77  USHORT DesignatorMin, DesignatorMax;
78  USHORT DataIndexMin, DataIndexMax;
79  } Range;
80  struct {
81  USAGE Usage, Reserved1;
82  USHORT StringIndex, Reserved2;
83  USHORT DesignatorIndex, Reserved3;
84  USHORT DataIndex, Reserved4;
85  } NotRange;
86  };
87 } HIDP_BUTTON_CAPS, *PHIDP_BUTTON_CAPS;
88 
89 typedef struct _HIDP_VALUE_CAPS {
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, LogicalMax;
109  LONG PhysicalMin, PhysicalMax;
110  union {
111  struct {
112  USAGE UsageMin, UsageMax;
113  USHORT StringMin, StringMax;
114  USHORT DesignatorMin, DesignatorMax;
115  USHORT DataIndexMin, DataIndexMax;
116  } Range;
117  struct {
118  USAGE Usage, Reserved1;
119  USHORT StringIndex, Reserved2;
120  USHORT DesignatorIndex, Reserved3;
121  USHORT DataIndex, Reserved4;
122  } NotRange;
123  };
124 } HIDP_VALUE_CAPS, *PHIDP_VALUE_CAPS;
125 
126 typedef PUCHAR PHIDP_REPORT_DESCRIPTOR;
127 typedef struct _HIDP_PREPARSED_DATA *PHIDP_PREPARSED_DATA;
128 
129 typedef struct _HIDP_CAPS {
130  USAGE Usage;
131  USAGE UsagePage;
132  USHORT InputReportByteLength;
133  USHORT OutputReportByteLength;
134  USHORT FeatureReportByteLength;
135  USHORT Reserved[17];
136  USHORT NumberLinkCollectionNodes;
137  USHORT NumberInputButtonCaps;
138  USHORT NumberInputValueCaps;
139  USHORT NumberInputDataIndices;
140  USHORT NumberOutputButtonCaps;
141  USHORT NumberOutputValueCaps;
142  USHORT NumberOutputDataIndices;
143  USHORT NumberFeatureButtonCaps;
144  USHORT NumberFeatureValueCaps;
145  USHORT NumberFeatureDataIndices;
146 } HIDP_CAPS, *PHIDP_CAPS;
147 
148 typedef struct _HIDP_DATA {
149  USHORT DataIndex;
150  USHORT Reserved;
151  union {
152  ULONG RawValue;
153  BOOLEAN On;
154  };
155 } HIDP_DATA, *PHIDP_DATA;
156 
157 typedef LONG NTSTATUS;
158 typedef NTSTATUS (__stdcall *pHidP_GetCaps)(PHIDP_PREPARSED_DATA, PHIDP_CAPS);
159 typedef NTSTATUS (__stdcall *pHidP_GetButtonCaps)(HIDP_REPORT_TYPE, PHIDP_BUTTON_CAPS, PUSHORT, PHIDP_PREPARSED_DATA);
160 typedef NTSTATUS (__stdcall *pHidP_GetValueCaps)(HIDP_REPORT_TYPE, PHIDP_VALUE_CAPS, PUSHORT, PHIDP_PREPARSED_DATA);
161 typedef NTSTATUS (__stdcall *pHidP_GetData)(HIDP_REPORT_TYPE, PHIDP_DATA, PULONG, PHIDP_PREPARSED_DATA, PCHAR, ULONG);
162 typedef ULONG (__stdcall *pHidP_MaxDataListLength)(HIDP_REPORT_TYPE, PHIDP_PREPARSED_DATA);
163 
164 #endif
165 
166 #endif