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.

158 lines
4.2 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  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. Revision History:
  11. Nov-96 : Created by Kenneth D. Ray
  12. --*/
  13. #ifndef HID_H
  14. #define HID_H
  15. #include "hidsdi.h"
  16. #include "setupapi.h"
  17. #define ASSERT(x)
  18. //
  19. // A structure to hold the steady state data received from the hid device.
  20. // Each time a read packet is received we fill in this structure.
  21. // Each time we wish to write to a hid device we fill in this structure.
  22. // This structure is here only for convenience. Most real applications will
  23. // have a more efficient way of moving the hid data to the read, write, and
  24. // feature routines.
  25. //
  26. typedef struct _HID_DATA {
  27. BOOL IsButtonData;
  28. UCHAR Reserved;
  29. USAGE UsagePage; // The usage page for which we are looking.
  30. ULONG Status; // The last status returned from the accessor function
  31. // when updating this field.
  32. ULONG ReportID; // ReportID for this given data structure
  33. BOOL IsDataSet; // Variable to track whether a given data structure
  34. // has already been added to a report structure
  35. union {
  36. struct {
  37. ULONG UsageMin; // Variables to track the usage minimum and max
  38. ULONG UsageMax; // If equal, then only a single usage
  39. ULONG MaxUsageLength; // Usages buffer length.
  40. PUSAGE Usages; // list of usages (buttons ``down'' on the device.
  41. } ButtonData;
  42. struct {
  43. USAGE Usage; // The usage describing this value;
  44. USHORT Reserved;
  45. ULONG Value;
  46. LONG ScaledValue;
  47. } ValueData;
  48. };
  49. } HID_DATA, *PHID_DATA;
  50. typedef struct _HID_DEVICE {
  51. HANDLE HidDevice; // A file handle to the hid device.
  52. PHIDP_PREPARSED_DATA Ppd; // The opaque parser info describing this device
  53. HIDP_CAPS Caps; // The Capabilities of this hid device.
  54. HIDD_ATTRIBUTES Attributes;
  55. PCHAR InputReportBuffer;
  56. PHID_DATA InputData; // array of hid data structures
  57. ULONG InputDataLength; // Num elements in this array.
  58. PHIDP_BUTTON_CAPS InputButtonCaps;
  59. PHIDP_VALUE_CAPS InputValueCaps;
  60. PCHAR OutputReportBuffer;
  61. PHID_DATA OutputData;
  62. ULONG OutputDataLength;
  63. PHIDP_BUTTON_CAPS OutputButtonCaps;
  64. PHIDP_VALUE_CAPS OutputValueCaps;
  65. PCHAR FeatureReportBuffer;
  66. PHID_DATA FeatureData;
  67. ULONG FeatureDataLength;
  68. PHIDP_BUTTON_CAPS FeatureButtonCaps;
  69. PHIDP_VALUE_CAPS FeatureValueCaps;
  70. DWORD dwDevInst; // device instance
  71. BOOL bRemoved; // this device has been removed by pnp
  72. BOOL bNew; // this device is a new arrival by pnp
  73. PSP_DEVICE_INTERFACE_DETAIL_DATA functionClassDeviceData; // this contains the device path
  74. struct _HID_DEVICE *Next;
  75. struct _HID_DEVICE *Prev;
  76. } HID_DEVICE, *PHID_DEVICE;
  77. // These functions are implemented in PNP.c
  78. LONG
  79. FindKnownHidDevices (
  80. OUT PHID_DEVICE *pHidDevices,
  81. OUT PULONG pNumberHidDevices
  82. );
  83. LONG
  84. FillDeviceInfo (
  85. IN PHID_DEVICE HidDevice
  86. );
  87. VOID
  88. CloseHidDevices ();
  89. VOID
  90. CloseHidDevice (
  91. IN OUT PHID_DEVICE HidDevice
  92. );
  93. BOOL
  94. OpenHidFile (
  95. IN PHID_DEVICE HidDevice
  96. );
  97. BOOL
  98. CloseHidFile (
  99. IN PHID_DEVICE HidDevice
  100. );
  101. // These functions are implemented in Report.c
  102. BOOL
  103. Write (
  104. PHID_DEVICE HidDevice
  105. );
  106. BOOL
  107. UnpackReport (
  108. IN PCHAR ReportBuffer,
  109. IN USHORT ReportBufferLength,
  110. IN HIDP_REPORT_TYPE ReportType,
  111. IN OUT PHID_DATA Data,
  112. IN ULONG DataLength,
  113. IN PHIDP_PREPARSED_DATA Ppd
  114. );
  115. BOOL
  116. GetFeature (
  117. PHID_DEVICE HidDevice
  118. );
  119. #endif