Leaked source code of windows server 2003
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.

187 lines
5.1 KiB

  1. /*++
  2. Copyright (c) Microsoft 1998, All Rights Reserved
  3. Module Name:
  4. hid.h
  5. Abstract:
  6. This module contains the declarations and definitions for use with the
  7. hid user mode client sample driver.
  8. Environment:
  9. Kernel & user mode
  10. @@BEGIN_DDKSPLIT
  11. Revision History:
  12. Nov-96 : Created by Kenneth D. Ray
  13. @@END_DDKSPLIT
  14. --*/
  15. #ifndef HID_H
  16. #define HID_H
  17. #include "hidsdi.h"
  18. #include "setupapi.h"
  19. typedef struct _SP_FNCLASS_DEVICE_DATA {
  20. DWORD cbSize;
  21. GUID FunctionClassGuid;
  22. TCHAR DevicePath [ANYSIZE_ARRAY];
  23. } SP_FNCLASS_DEVICE_DATA, *PSP_FNCLASS_DEVICE_DATA;
  24. BOOLEAN
  25. SetupDiGetFunctionClassDeviceInfo (
  26. IN HDEVINFO DeviceInfoSet,
  27. IN PSP_DEVINFO_DATA DeviceInfoData,
  28. OUT PSP_FNCLASS_DEVICE_DATA FunctionClassDeviceData,
  29. IN DWORD FunctionClassDeviceDataSize,
  30. OUT PDWORD RequiredSize
  31. );
  32. #define ASSERT(x)
  33. //
  34. // A structure to hold the steady state data received from the hid device.
  35. // Each time a read packet is received we fill in this structure.
  36. // Each time we wish to write to a hid device we fill in this structure.
  37. // This structure is here only for convenience. Most real applications will
  38. // have a more efficient way of moving the hid data to the read, write, and
  39. // feature routines.
  40. //
  41. typedef struct _HID_DATA {
  42. BOOLEAN IsButtonData;
  43. UCHAR Reserved;
  44. USAGE UsagePage; // The usage page for which we are looking.
  45. ULONG Status; // The last status returned from the accessor function
  46. // when updating this field.
  47. ULONG ReportID; // ReportID for this given data structure
  48. BOOLEAN IsDataSet; // Variable to track whether a given data structure
  49. // has already been added to a report structure
  50. union {
  51. struct {
  52. ULONG UsageMin; // Variables to track the usage minimum and max
  53. ULONG UsageMax; // If equal, then only a single usage
  54. ULONG MaxUsageLength; // Usages buffer length.
  55. PUSAGE Usages; // list of usages (buttons ``down'' on the device.
  56. } ButtonData;
  57. struct {
  58. USAGE Usage; // The usage describing this value;
  59. USHORT Reserved;
  60. ULONG Value;
  61. LONG ScaledValue;
  62. } ValueData;
  63. };
  64. } HID_DATA, *PHID_DATA;
  65. typedef struct _HID_DEVICE {
  66. PCHAR DevicePath;
  67. HANDLE HidDevice; // A file handle to the hid device.
  68. BOOL OpenedForRead;
  69. BOOL OpenedForWrite;
  70. BOOL OpenedOverlapped;
  71. BOOL OpenedExclusive;
  72. PHIDP_PREPARSED_DATA Ppd; // The opaque parser info describing this device
  73. HIDP_CAPS Caps; // The Capabilities of this hid device.
  74. HIDD_ATTRIBUTES Attributes;
  75. PCHAR InputReportBuffer;
  76. PHID_DATA InputData; // array of hid data structures
  77. ULONG InputDataLength; // Num elements in this array.
  78. PHIDP_BUTTON_CAPS InputButtonCaps;
  79. PHIDP_VALUE_CAPS InputValueCaps;
  80. PCHAR OutputReportBuffer;
  81. PHID_DATA OutputData;
  82. ULONG OutputDataLength;
  83. PHIDP_BUTTON_CAPS OutputButtonCaps;
  84. PHIDP_VALUE_CAPS OutputValueCaps;
  85. PCHAR FeatureReportBuffer;
  86. PHID_DATA FeatureData;
  87. ULONG FeatureDataLength;
  88. PHIDP_BUTTON_CAPS FeatureButtonCaps;
  89. PHIDP_VALUE_CAPS FeatureValueCaps;
  90. } HID_DEVICE, *PHID_DEVICE;
  91. BOOLEAN
  92. OpenHidDevice (
  93. IN PCHAR DevicePath,
  94. IN BOOL HasReadAccess,
  95. IN BOOL HasWriteAccess,
  96. IN BOOL IsOverlapped,
  97. IN BOOL IsExclusive,
  98. IN OUT PHID_DEVICE HidDevice
  99. );
  100. BOOLEAN
  101. FindKnownHidDevices (
  102. OUT PHID_DEVICE * HidDevices, // A array of struct _HID_DEVICE
  103. OUT PULONG NumberDevices // the length of this array.
  104. );
  105. BOOLEAN
  106. FillDeviceInfo(
  107. IN PHID_DEVICE HidDevice
  108. );
  109. VOID
  110. CloseHidDevices (
  111. OUT PHID_DEVICE HidDevices, // A array of struct _HID_DEVICE
  112. OUT ULONG NumberDevices // the length of this array.
  113. );
  114. VOID
  115. CloseHidDevice (
  116. IN PHID_DEVICE HidDevice
  117. );
  118. BOOLEAN
  119. Read (
  120. PHID_DEVICE HidDevice
  121. );
  122. BOOLEAN
  123. ReadOverlapped (
  124. PHID_DEVICE HidDevice,
  125. HANDLE CompletionEvent
  126. );
  127. BOOLEAN
  128. Write (
  129. PHID_DEVICE HidDevice
  130. );
  131. BOOLEAN
  132. UnpackReport (
  133. IN PCHAR ReportBuffer,
  134. IN USHORT ReportBufferLength,
  135. IN HIDP_REPORT_TYPE ReportType,
  136. IN OUT PHID_DATA Data,
  137. IN ULONG DataLength,
  138. IN PHIDP_PREPARSED_DATA Ppd
  139. );
  140. BOOLEAN
  141. SetFeature (
  142. PHID_DEVICE HidDevice
  143. );
  144. BOOLEAN
  145. GetFeature (
  146. PHID_DEVICE HidDevice
  147. );
  148. #endif