Merging r37048, r37051, r37052, r37055 from the-real-msvc branch
[reactos.git] / reactos / include / ddk / hidclass.h
1 /*
2 * hidclass.h
3 *
4 * HID class driver interface
5 *
6 * This file is part of the w32api package.
7 *
8 * Contributors:
9 * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
10 *
11 * THIS SOFTWARE IS NOT COPYRIGHTED
12 *
13 * This source code is offered for use in the public domain. You may
14 * use, modify or distribute it freely.
15 *
16 * This code is distributed in the hope that it will be useful but
17 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
18 * DISCLAIMED. This includes but is not limited to warranties of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20 *
21 */
22
23 #ifndef __HIDCLASS_H
24 #define __HIDCLASS_H
25
26 #if __GNUC__ >=3
27 #pragma GCC system_header
28 #endif
29
30 #include "hidpi.h"
31
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35
36 #define HID_REVISION 0x00000001
37
38 DEFINE_GUID (GUID_DEVINTERFACE_HID, \
39 0x4D1E55B2L, 0xF16F, 0x11CF, 0x88, 0xCB, 0x00, 0x11, 0x11, 0x00, 0x00, 0x30);
40 DEFINE_GUID (GUID_HID_INTERFACE_NOTIFY, \
41 0x2c4e2e88L, 0x25e6, 0x4c33, 0x88, 0x2f, 0x3d, 0x82, 0xe6, 0x07, 0x36, 0x81);
42 DEFINE_GUID (GUID_HID_INTERFACE_HIDPARSE, \
43 0xf5c315a5, 0x69ac, 0x4bc2, 0x92, 0x79, 0xd0, 0xb6, 0x45, 0x76, 0xf4, 0x4b);
44
45 #define GUID_CLASS_INPUT GUID_DEVINTERFACE_HID
46
47 #define GUID_CLASS_INPUT_STR "4D1E55B2-F16F-11CF-88CB-001111000030"
48
49
50 #define HID_CTL_CODE(id) \
51 CTL_CODE (FILE_DEVICE_KEYBOARD, (id), METHOD_NEITHER, FILE_ANY_ACCESS)
52 #define HID_BUFFER_CTL_CODE(id) \
53 CTL_CODE (FILE_DEVICE_KEYBOARD, (id), METHOD_BUFFERED, FILE_ANY_ACCESS)
54 #define HID_IN_CTL_CODE(id) \
55 CTL_CODE (FILE_DEVICE_KEYBOARD, (id), METHOD_IN_DIRECT, FILE_ANY_ACCESS)
56 #define HID_OUT_CTL_CODE(id) \
57 CTL_CODE (FILE_DEVICE_KEYBOARD, (id), METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
58
59
60 #define IOCTL_GET_PHYSICAL_DESCRIPTOR HID_OUT_CTL_CODE(102)
61 #define IOCTL_HID_FLUSH_QUEUE HID_CTL_CODE(101)
62 #define IOCTL_HID_GET_COLLECTION_DESCRIPTOR HID_CTL_CODE(100)
63 #define IOCTL_HID_GET_COLLECTION_INFORMATION HID_BUFFER_CTL_CODE(106)
64 #define IOCTL_HID_GET_FEATURE HID_OUT_CTL_CODE(100)
65 #define IOCTL_HID_GET_HARDWARE_ID HID_OUT_CTL_CODE(103)
66 #define IOCTL_HID_GET_INDEXED_STRING HID_OUT_CTL_CODE(120)
67 #define IOCTL_HID_GET_INPUT_REPORT HID_OUT_CTL_CODE(104)
68 #define IOCTL_HID_GET_MANUFACTURER_STRING HID_OUT_CTL_CODE(110)
69 #define IOCTL_GET_NUM_DEVICE_INPUT_BUFFERS HID_BUFFER_CTL_CODE(104)
70 #define IOCTL_HID_GET_POLL_FREQUENCY_MSEC HID_BUFFER_CTL_CODE(102)
71 #define IOCTL_HID_GET_PRODUCT_STRING HID_OUT_CTL_CODE(111)
72 #define IOCTL_HID_GET_SERIALNUMBER_STRING HID_OUT_CTL_CODE(112)
73 #define IOCTL_HID_SET_FEATURE HID_IN_CTL_CODE(100)
74 #define IOCTL_SET_NUM_DEVICE_INPUT_BUFFERS HID_BUFFER_CTL_CODE(105)
75 #define IOCTL_HID_SET_OUTPUT_REPORT HID_IN_CTL_CODE(101)
76 #define IOCTL_HID_SET_POLL_FREQUENCY_MSEC HID_BUFFER_CTL_CODE(103)
77
78 #define IOCTL_HID_GET_DRIVER_CONFIG HID_BUFFER_CTL_CODE(100)
79 #define IOCTL_HID_SET_DRIVER_CONFIG HID_BUFFER_CTL_CODE(101)
80 #define IOCTL_HID_GET_MS_GENRE_DESCRIPTOR HID_OUT_CTL_CODE(121)
81
82 /* FIXME: these values are wrong! */
83 #define IOCTL_HID_GET_STRING 0
84 #define IOCTL_HID_GET_DEVICE_ATTRIBUTES 1
85 #define IOCTL_HID_GET_DEVICE_DESCRIPTOR 2
86 #define IOCTL_HID_READ_REPORT 3
87 #define IOCTL_HID_WRITE_REPORT 4
88 #define IOCTL_HID_GET_REPORT_DESCRIPTOR 5
89
90 typedef enum _HID_STRING_TYPE
91 {
92 HID_STRING_INDEXED = 0,
93 HID_STRING_ID_IMANUFACTURER,
94 HID_STRING_ID_IPRODUCT,
95 HID_STRING_ID_ISERIALNUMBER,
96 HID_STRING_MAX
97 } HID_STRING_TYPE;
98
99 enum DeviceObjectState {
100 DeviceObjectStarted = 0,
101 DeviceObjectStopped,
102 DeviceObjectRemoved
103 };
104
105 typedef VOID DDKAPI (*PHID_STATUS_CHANGE)(
106 PVOID Context,
107 enum DeviceObjectState State);
108
109 typedef NTSTATUS DDKAPI (*PHIDP_GETCAPS)(
110 IN PHIDP_PREPARSED_DATA PreparsedData,
111 OUT PHIDP_CAPS Capabilities);
112
113 typedef struct _HID_COLLECTION_INFORMATION {
114 ULONG DescriptorSize;
115 BOOLEAN Polled;
116 UCHAR Reserved1[1];
117 USHORT VendorID;
118 USHORT ProductID;
119 USHORT VersionNumber;
120 } HID_COLLECTION_INFORMATION, *PHID_COLLECTION_INFORMATION;
121
122 typedef struct _HID_DRIVER_CONFIG {
123 ULONG Size;
124 ULONG RingBufferSize;
125 } HID_DRIVER_CONFIG, *PHID_DRIVER_CONFIG;
126
127 typedef struct _HID_INTERFACE_HIDPARSE {
128 #ifdef __cplusplus
129 INTERFACE i;
130 #else
131 /* GCC doesn't support including unnamed structs, so INTERFACE is
132 expanded here */
133 USHORT Size;
134 USHORT Version;
135 PVOID Context;
136 PINTERFACE_REFERENCE InterfaceReference;
137 PINTERFACE_DEREFERENCE InterfaceDereference;
138 #endif
139 PHIDP_GETCAPS HidpGetCaps;
140 } HID_INTERFACE_HIDPARSE, *PHID_INTERFACE_HIDPARSE;
141
142 typedef struct _HID_INTERFACE_NOTIFY_PNP {
143 #ifdef __cplusplus
144 INTERFACE i;
145 #else
146 /* GCC doesn't support including unnamed structs, so INTERFACE is
147 expanded here */
148 USHORT Size;
149 USHORT Version;
150 PVOID Context;
151 PINTERFACE_REFERENCE InterfaceReference;
152 PINTERFACE_DEREFERENCE InterfaceDereference;
153 #endif
154 PHID_STATUS_CHANGE StatusChangeFn;
155 PVOID CallbackContext;
156 } HID_INTERFACE_NOTIFY_PNP, *PHID_INTERFACE_NOTIFY_PNP;
157
158 typedef struct _HID_XFER_PACKET {
159 PUCHAR reportBuffer;
160 ULONG reportBufferLen;
161 UCHAR reportId;
162 } HID_XFER_PACKET, *PHID_XFER_PACKET;
163
164 #ifdef __cplusplus
165 }
166 #endif
167
168 #endif /* __HIDCLASS_H */