Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

216 lines
5.5 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. hidclass.h
  5. Abstract
  6. Definitions that are common to clients of the HID class driver.
  7. Environment:
  8. Kernel mode only
  9. Revision History:
  10. --*/
  11. #include <basetyps.h>
  12. //
  13. // Define the HID class guid *OUTSIDE* the #ifndef/#endif to allow
  14. // multiple includes with precompiled headers.
  15. //
  16. DEFINE_GUID( GUID_DEVINTERFACE_HID, 0x4D1E55B2L, 0xF16F, 0x11CF, 0x88, 0xCB, 0x00, \
  17. 0x11, 0x11, 0x00, 0x00, 0x30);
  18. // Obsolete GUID naming convention.
  19. #define GUID_CLASS_INPUT GUID_DEVINTERFACE_HID
  20. //
  21. // 2c4e2e88-25e6-4c33-882f-3d82e6073681
  22. //
  23. DEFINE_GUID( GUID_HID_INTERFACE_NOTIFY, 0x2c4e2e88L, 0x25e6, 0x4c33, 0x88, 0x2f, 0x3d, 0x82, 0xe6, 0x07, 0x36, 0x81 );
  24. // {F5C315A5-69AC-4bc2-9279-D0B64576F44B}
  25. DEFINE_GUID( GUID_HID_INTERFACE_HIDPARSE, 0xf5c315a5, 0x69ac, 0x4bc2, 0x92, 0x79, 0xd0, 0xb6, 0x45, 0x76, 0xf4, 0x4b );
  26. #ifndef __HIDCLASS_H__
  27. #define __HIDCLASS_H__
  28. #define GUID_CLASS_INPUT_STR "4D1E55B2-F16F-11CF-88CB-001111000030"
  29. //
  30. // HID_REVISION specifies the minimum revision of HIDCLASS.SYS
  31. // required to support minidrivers compiled with this header file.
  32. //
  33. #define HID_REVISION 0x00000001
  34. //
  35. // Macro for defining HID ioctls
  36. //
  37. #define HID_CTL_CODE(id) \
  38. CTL_CODE(FILE_DEVICE_KEYBOARD, (id), METHOD_NEITHER, FILE_ANY_ACCESS)
  39. #define HID_BUFFER_CTL_CODE(id) \
  40. CTL_CODE(FILE_DEVICE_KEYBOARD, (id), METHOD_BUFFERED, FILE_ANY_ACCESS)
  41. #define HID_IN_CTL_CODE(id) \
  42. CTL_CODE(FILE_DEVICE_KEYBOARD, (id), METHOD_IN_DIRECT, FILE_ANY_ACCESS)
  43. #define HID_OUT_CTL_CODE(id) \
  44. CTL_CODE(FILE_DEVICE_KEYBOARD, (id), METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
  45. //
  46. // IOCTLs supported by the upper edge of the HID class driver
  47. //
  48. #define IOCTL_HID_GET_DRIVER_CONFIG HID_BUFFER_CTL_CODE(100)
  49. #define IOCTL_HID_SET_DRIVER_CONFIG HID_BUFFER_CTL_CODE(101)
  50. #define IOCTL_HID_GET_POLL_FREQUENCY_MSEC HID_BUFFER_CTL_CODE(102)
  51. #define IOCTL_HID_SET_POLL_FREQUENCY_MSEC HID_BUFFER_CTL_CODE(103)
  52. #define IOCTL_GET_NUM_DEVICE_INPUT_BUFFERS HID_BUFFER_CTL_CODE(104)
  53. #define IOCTL_SET_NUM_DEVICE_INPUT_BUFFERS HID_BUFFER_CTL_CODE(105)
  54. #define IOCTL_HID_GET_COLLECTION_INFORMATION HID_BUFFER_CTL_CODE(106)
  55. #define IOCTL_HID_GET_COLLECTION_DESCRIPTOR HID_CTL_CODE(100)
  56. #define IOCTL_HID_FLUSH_QUEUE HID_CTL_CODE(101)
  57. #define IOCTL_HID_SET_FEATURE HID_IN_CTL_CODE(100)
  58. #define IOCTL_HID_SET_OUTPUT_REPORT HID_IN_CTL_CODE(101)
  59. #define IOCTL_HID_GET_FEATURE HID_OUT_CTL_CODE(100)
  60. #define IOCTL_GET_PHYSICAL_DESCRIPTOR HID_OUT_CTL_CODE(102)
  61. #define IOCTL_HID_GET_HARDWARE_ID HID_OUT_CTL_CODE(103)
  62. #define IOCTL_HID_GET_INPUT_REPORT HID_OUT_CTL_CODE(104)
  63. /*
  64. * No more IOCTL_HID_GET_FRIENDLY_NAME - use one of the following:
  65. */
  66. #define IOCTL_HID_GET_MANUFACTURER_STRING HID_OUT_CTL_CODE(110)
  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_GET_INDEXED_STRING HID_OUT_CTL_CODE(120)
  70. #define IOCTL_HID_GET_MS_GENRE_DESCRIPTOR HID_OUT_CTL_CODE(121)
  71. #define IOCTL_HID_ENABLE_SECURE_READ HID_CTL_CODE(130)
  72. #define IOCTL_HID_DISABLE_SECURE_READ HID_CTL_CODE(131)
  73. /*
  74. * This is used to pass write-report and feature-report information
  75. * from HIDCLASS to a minidriver.
  76. */
  77. typedef struct _HID_XFER_PACKET {
  78. PUCHAR reportBuffer;
  79. ULONG reportBufferLen;
  80. UCHAR reportId;
  81. } HID_XFER_PACKET, *PHID_XFER_PACKET;
  82. #ifdef NT_INCLUDED
  83. enum DeviceObjectState {
  84. DeviceObjectStarted,
  85. DeviceObjectStopped,
  86. DeviceObjectRemoved
  87. };
  88. typedef VOID (*PHID_STATUS_CHANGE)(PVOID Context, enum DeviceObjectState State);
  89. typedef struct _HID_INTERFACE_NOTIFY_PNP
  90. {
  91. #ifndef __cplusplus
  92. INTERFACE;
  93. #else
  94. INTERFACE i;
  95. #endif
  96. PHID_STATUS_CHANGE StatusChangeFn;
  97. PVOID CallbackContext;
  98. } HID_INTERFACE_NOTIFY_PNP, *PHID_INTERFACE_NOTIFY_PNP;
  99. #ifdef __HIDPI_H__
  100. typedef NTSTATUS (__stdcall *PHIDP_GETCAPS) (IN PHIDP_PREPARSED_DATA PreparsedData, OUT PHIDP_CAPS Capabilities);
  101. typedef struct _HID_INTERFACE_HIDPARSE
  102. {
  103. #ifndef __cplusplus
  104. INTERFACE;
  105. #else
  106. INTERFACE i;
  107. #endif
  108. PHIDP_GETCAPS HidpGetCaps;
  109. } HID_INTERFACE_HIDPARSE, *PHID_INTERFACE_HIDPARSE;
  110. #endif // __HIDPI_H__
  111. #endif // NT_INCLUDED
  112. //
  113. // Structure passed by IOCTL_HID_GET_COLLECTION_INFORMATION
  114. //
  115. typedef struct _HID_COLLECTION_INFORMATION {
  116. //
  117. // DescriptorSize is the size of the input buffer required to accept
  118. // the collection descriptor returned by
  119. // IOCTL_HID_GET_COLLECTION_DESCRIPTOR.
  120. //
  121. ULONG DescriptorSize;
  122. //
  123. // Polled is TRUE if this collection is a polled collection.
  124. //
  125. BOOLEAN Polled;
  126. //
  127. // Reserved1 must be set to zero.
  128. //
  129. UCHAR Reserved1[ 1 ];
  130. //
  131. // Vendor ids of this hid device
  132. //
  133. USHORT VendorID;
  134. USHORT ProductID;
  135. USHORT VersionNumber;
  136. //
  137. // Additional fields, if any, will be added at the end of this structure.
  138. //
  139. } HID_COLLECTION_INFORMATION, *PHID_COLLECTION_INFORMATION;
  140. //
  141. // Structure passed by IOCTL_HID_GET_DRIVER_CONFIG and
  142. // IOCTL_HID_SET_DRIVER_CONFIG
  143. //
  144. typedef struct _HID_DRIVER_CONFIG {
  145. //
  146. // Size must be set to the size of this structure.
  147. //
  148. ULONG Size;
  149. //
  150. // Size of the input report queue (in reports). This value can be set.
  151. //
  152. ULONG RingBufferSize;
  153. } HID_DRIVER_CONFIG, *PHID_DRIVER_CONFIG;
  154. #endif // __HIDCLASS_H__