OSDN Git Service

Insert removed author attribution.
[mingw/mingw-org-wsl.git] / include / ddk / hidclass.h
1 /**
2  * @file hidclass.h
3  * @copy 2012 MinGW.org project
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  * 
12  * The above copyright notice and this permission notice (including the next
13  * paragraph) shall be included in all copies or substantial portions of the
14  * Software.
15  * 
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  * DEALINGS IN THE SOFTWARE.
23  */
24 /* Created by Casper S. Hornstrup <chorns@users.sourceforge.net> */
25 #ifndef __HIDCLASS_H
26 #define __HIDCLASS_H
27 #pragma GCC system_header
28 #include <_mingw.h>
29
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33
34 #include "ntddk.h"
35 #include "hidpi.h"
36
37 #define HID_REVISION                      0x00000001
38
39 DEFINE_GUID (GUID_DEVINTERFACE_HID, \
40   0x4D1E55B2L, 0xF16F, 0x11CF, 0x88, 0xCB, 0x00, 0x11, 0x11, 0x00, 0x00, 0x30);
41 DEFINE_GUID (GUID_HID_INTERFACE_NOTIFY, \
42   0x2c4e2e88L, 0x25e6, 0x4c33, 0x88, 0x2f, 0x3d, 0x82, 0xe6, 0x07, 0x36, 0x81);
43 DEFINE_GUID (GUID_HID_INTERFACE_HIDPARSE, \
44   0xf5c315a5, 0x69ac, 0x4bc2, 0x92, 0x79, 0xd0, 0xb6, 0x45, 0x76, 0xf4, 0x4b);
45
46 #define GUID_CLASS_INPUT GUID_DEVINTERFACE_HID
47
48 #define GUID_CLASS_INPUT_STR "4D1E55B2-F16F-11CF-88CB-001111000030"
49
50
51 #define HID_CTL_CODE(id) \
52   CTL_CODE (FILE_DEVICE_KEYBOARD, (id), METHOD_NEITHER, FILE_ANY_ACCESS)
53 #define HID_BUFFER_CTL_CODE(id) \
54   CTL_CODE (FILE_DEVICE_KEYBOARD, (id), METHOD_BUFFERED, FILE_ANY_ACCESS)
55 #define HID_IN_CTL_CODE(id) \
56   CTL_CODE (FILE_DEVICE_KEYBOARD, (id), METHOD_IN_DIRECT, FILE_ANY_ACCESS)
57 #define HID_OUT_CTL_CODE(id) \
58   CTL_CODE (FILE_DEVICE_KEYBOARD, (id), METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
59
60
61 #define IOCTL_GET_PHYSICAL_DESCRIPTOR         HID_OUT_CTL_CODE(102)
62 #define IOCTL_HID_FLUSH_QUEUE                 HID_CTL_CODE(101)
63 #define IOCTL_HID_GET_COLLECTION_DESCRIPTOR   HID_CTL_CODE(100)
64 #define IOCTL_HID_GET_COLLECTION_INFORMATION  HID_BUFFER_CTL_CODE(106)
65 #define IOCTL_HID_GET_FEATURE                 HID_OUT_CTL_CODE(100)
66 #define IOCTL_HID_GET_HARDWARE_ID             HID_OUT_CTL_CODE(103)
67 #define IOCTL_HID_GET_INDEXED_STRING          HID_OUT_CTL_CODE(120)
68 #define IOCTL_HID_GET_INPUT_REPORT            HID_OUT_CTL_CODE(104)
69 #define IOCTL_HID_GET_MANUFACTURER_STRING     HID_OUT_CTL_CODE(110)
70 #define IOCTL_GET_NUM_DEVICE_INPUT_BUFFERS    HID_BUFFER_CTL_CODE(104)
71 #define IOCTL_HID_GET_POLL_FREQUENCY_MSEC     HID_BUFFER_CTL_CODE(102)
72 #define IOCTL_HID_GET_PRODUCT_STRING          HID_OUT_CTL_CODE(111)
73 #define IOCTL_HID_GET_SERIALNUMBER_STRING     HID_OUT_CTL_CODE(112)
74 #define IOCTL_HID_SET_FEATURE                 HID_IN_CTL_CODE(100)
75 #define IOCTL_SET_NUM_DEVICE_INPUT_BUFFERS    HID_BUFFER_CTL_CODE(105)
76 #define IOCTL_HID_SET_OUTPUT_REPORT           HID_IN_CTL_CODE(101)
77 #define IOCTL_HID_SET_POLL_FREQUENCY_MSEC     HID_BUFFER_CTL_CODE(103)
78
79 #define IOCTL_HID_GET_DRIVER_CONFIG           HID_BUFFER_CTL_CODE(100)
80 #define IOCTL_HID_SET_DRIVER_CONFIG           HID_BUFFER_CTL_CODE(101)
81 #define IOCTL_HID_GET_MS_GENRE_DESCRIPTOR     HID_OUT_CTL_CODE(121)
82
83
84 enum DeviceObjectState {
85   DeviceObjectStarted = 0,
86   DeviceObjectStopped,
87   DeviceObjectRemoved
88 };
89
90 typedef VOID DDKAPI (*PHID_STATUS_CHANGE)(
91   PVOID  Context,
92   enum DeviceObjectState  State);
93
94 typedef NTSTATUS DDKAPI (*PHIDP_GETCAPS)(
95   /*IN*/ PHIDP_PREPARSED_DATA  PreparsedData,
96   /*OUT*/ PHIDP_CAPS  Capabilities);
97
98 typedef struct _HID_COLLECTION_INFORMATION {
99   ULONG  DescriptorSize;
100   BOOLEAN  Polled;
101   UCHAR  Reserved1[1];
102   USHORT  VendorID;
103   USHORT  ProductID;
104   USHORT  VersionNumber;
105 } HID_COLLECTION_INFORMATION, *PHID_COLLECTION_INFORMATION;
106
107 typedef struct _HID_DRIVER_CONFIG {
108   ULONG  Size;
109   ULONG  RingBufferSize;
110 } HID_DRIVER_CONFIG, *PHID_DRIVER_CONFIG;
111
112 typedef struct _HID_INTERFACE_HIDPARSE {
113 #ifdef __cplusplus
114   INTERFACE  i;
115 #else
116   /* GCC doesn't support including unnamed structs, so INTERFACE is
117      expanded here */
118   USHORT  Size;
119   USHORT  Version;
120   PVOID  Context;
121   PINTERFACE_REFERENCE  InterfaceReference;
122   PINTERFACE_DEREFERENCE  InterfaceDereference;
123 #endif
124   PHIDP_GETCAPS  HidpGetCaps;
125 } HID_INTERFACE_HIDPARSE, *PHID_INTERFACE_HIDPARSE;
126
127 typedef struct _HID_INTERFACE_NOTIFY_PNP {
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   PHID_STATUS_CHANGE  StatusChangeFn;
140   PVOID  CallbackContext;
141 } HID_INTERFACE_NOTIFY_PNP, *PHID_INTERFACE_NOTIFY_PNP;
142
143 typedef struct _HID_XFER_PACKET {
144   PUCHAR  reportBuffer;
145   ULONG  reportBufferLen;
146   UCHAR  reportId;
147 } HID_XFER_PACKET, *PHID_XFER_PACKET;
148
149 #ifdef __cplusplus
150 }
151 #endif
152
153 #endif /* __HIDCLASS_H */