[USB]
[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 #include "hidpi.h"
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32 #define HID_REVISION 0x00000001
33
34 DEFINE_GUID (GUID_DEVINTERFACE_HID, \
35 0x4D1E55B2L, 0xF16F, 0x11CF, 0x88, 0xCB, 0x00, 0x11, 0x11, 0x00, 0x00, 0x30);
36 DEFINE_GUID (GUID_HID_INTERFACE_NOTIFY, \
37 0x2c4e2e88L, 0x25e6, 0x4c33, 0x88, 0x2f, 0x3d, 0x82, 0xe6, 0x07, 0x36, 0x81);
38 DEFINE_GUID (GUID_HID_INTERFACE_HIDPARSE, \
39 0xf5c315a5, 0x69ac, 0x4bc2, 0x92, 0x79, 0xd0, 0xb6, 0x45, 0x76, 0xf4, 0x4b);
40
41 #define GUID_CLASS_INPUT GUID_DEVINTERFACE_HID
42
43 #define GUID_CLASS_INPUT_STR "4D1E55B2-F16F-11CF-88CB-001111000030"
44
45
46 #define HID_CTL_CODE(id) \
47 CTL_CODE (FILE_DEVICE_KEYBOARD, (id), METHOD_NEITHER, FILE_ANY_ACCESS)
48 #define HID_BUFFER_CTL_CODE(id) \
49 CTL_CODE (FILE_DEVICE_KEYBOARD, (id), METHOD_BUFFERED, FILE_ANY_ACCESS)
50 #define HID_IN_CTL_CODE(id) \
51 CTL_CODE (FILE_DEVICE_KEYBOARD, (id), METHOD_IN_DIRECT, FILE_ANY_ACCESS)
52 #define HID_OUT_CTL_CODE(id) \
53 CTL_CODE (FILE_DEVICE_KEYBOARD, (id), METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
54
55
56 #define IOCTL_GET_PHYSICAL_DESCRIPTOR HID_OUT_CTL_CODE(102)
57 #define IOCTL_HID_FLUSH_QUEUE HID_CTL_CODE(101)
58 #define IOCTL_HID_GET_COLLECTION_DESCRIPTOR HID_CTL_CODE(100)
59 #define IOCTL_HID_GET_COLLECTION_INFORMATION HID_BUFFER_CTL_CODE(106)
60 #define IOCTL_HID_GET_FEATURE HID_OUT_CTL_CODE(100)
61 #define IOCTL_HID_GET_HARDWARE_ID HID_OUT_CTL_CODE(103)
62 #define IOCTL_HID_GET_INDEXED_STRING HID_OUT_CTL_CODE(120)
63 #define IOCTL_HID_GET_INPUT_REPORT HID_OUT_CTL_CODE(104)
64 #define IOCTL_HID_GET_MANUFACTURER_STRING HID_OUT_CTL_CODE(110)
65 #define IOCTL_GET_NUM_DEVICE_INPUT_BUFFERS HID_BUFFER_CTL_CODE(104)
66 #define IOCTL_HID_GET_POLL_FREQUENCY_MSEC HID_BUFFER_CTL_CODE(102)
67 #define IOCTL_HID_GET_PRODUCT_STRING HID_OUT_CTL_CODE(111)
68 #define IOCTL_HID_GET_SERIALNUMBER_STRING HID_OUT_CTL_CODE(112)
69 #define IOCTL_HID_SET_FEATURE HID_IN_CTL_CODE(100)
70 #define IOCTL_SET_NUM_DEVICE_INPUT_BUFFERS HID_BUFFER_CTL_CODE(105)
71 #define IOCTL_HID_SET_OUTPUT_REPORT HID_IN_CTL_CODE(101)
72 #define IOCTL_HID_SET_POLL_FREQUENCY_MSEC HID_BUFFER_CTL_CODE(103)
73
74 #define IOCTL_HID_GET_DRIVER_CONFIG HID_BUFFER_CTL_CODE(100)
75 #define IOCTL_HID_SET_DRIVER_CONFIG HID_BUFFER_CTL_CODE(101)
76 #define IOCTL_HID_GET_INDEXED_STRING HID_OUT_CTL_CODE(120)
77 #define IOCTL_HID_GET_MS_GENRE_DESCRIPTOR HID_OUT_CTL_CODE(121)
78
79 typedef enum _HID_STRING_TYPE
80 {
81 HID_STRING_INDEXED = 0,
82 HID_STRING_ID_IMANUFACTURER,
83 HID_STRING_ID_IPRODUCT,
84 HID_STRING_ID_ISERIALNUMBER,
85 HID_STRING_MAX
86 } HID_STRING_TYPE;
87
88 enum DeviceObjectState {
89 DeviceObjectStarted = 0,
90 DeviceObjectStopped,
91 DeviceObjectRemoved
92 };
93
94 typedef VOID
95 (NTAPI *PHID_STATUS_CHANGE)(
96 _In_ PVOID Context,
97 _In_ enum DeviceObjectState State);
98
99 _Must_inspect_result_
100 typedef NTSTATUS
101 (NTAPI *PHIDP_GETCAPS)(
102 _In_ PHIDP_PREPARSED_DATA PreparsedData,
103 _Out_ PHIDP_CAPS Capabilities);
104
105 typedef struct _HID_COLLECTION_INFORMATION {
106 ULONG DescriptorSize;
107 BOOLEAN Polled;
108 UCHAR Reserved1[1];
109 USHORT VendorID;
110 USHORT ProductID;
111 USHORT VersionNumber;
112 } HID_COLLECTION_INFORMATION, *PHID_COLLECTION_INFORMATION;
113
114 typedef struct _HID_DRIVER_CONFIG {
115 ULONG Size;
116 ULONG RingBufferSize;
117 } HID_DRIVER_CONFIG, *PHID_DRIVER_CONFIG;
118
119 typedef struct _HID_INTERFACE_HIDPARSE {
120 #ifdef __cplusplus
121 INTERFACE i;
122 #else
123 /* GCC doesn't support including unnamed structs, so INTERFACE is
124 expanded here */
125 USHORT Size;
126 USHORT Version;
127 PVOID Context;
128 PINTERFACE_REFERENCE InterfaceReference;
129 PINTERFACE_DEREFERENCE InterfaceDereference;
130 #endif
131 PHIDP_GETCAPS HidpGetCaps;
132 } HID_INTERFACE_HIDPARSE, *PHID_INTERFACE_HIDPARSE;
133
134 typedef struct _HID_INTERFACE_NOTIFY_PNP {
135 #ifdef __cplusplus
136 INTERFACE i;
137 #else
138 /* GCC doesn't support including unnamed structs, so INTERFACE is
139 expanded here */
140 USHORT Size;
141 USHORT Version;
142 PVOID Context;
143 PINTERFACE_REFERENCE InterfaceReference;
144 PINTERFACE_DEREFERENCE InterfaceDereference;
145 #endif
146 PHID_STATUS_CHANGE StatusChangeFn;
147 PVOID CallbackContext;
148 } HID_INTERFACE_NOTIFY_PNP, *PHID_INTERFACE_NOTIFY_PNP;
149
150 typedef struct _HID_XFER_PACKET {
151 PUCHAR reportBuffer;
152 ULONG reportBufferLen;
153 UCHAR reportId;
154 } HID_XFER_PACKET, *PHID_XFER_PACKET;
155
156 #ifdef __cplusplus
157 }
158 #endif
159
160 #endif /* __HIDCLASS_H */