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.

144 lines
3.5 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. hidexe.h
  5. Abstract:
  6. This module contains the declarations and definitions for use with the
  7. hid user more client sample driver.
  8. Environment:
  9. Kernel & user mode
  10. Revision History:
  11. Nov-96 : Created by Kenneth D. Ray
  12. --*/
  13. #ifndef HIDEXE_H
  14. #define HIDEXE_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. BOOLEAN 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. union {
  33. struct {
  34. ULONG MaxUsageLength; // Usages buffer length.
  35. PUSAGE Usages; // list of usages (buttons ``down'' on the device.
  36. } ButtonData;
  37. struct {
  38. USAGE Usage; // The usage describing this value;
  39. USHORT Reserved;
  40. ULONG Value;
  41. LONG ScaledValue;
  42. } ValueData;
  43. };
  44. } HID_DATA, *PHID_DATA;
  45. typedef struct _HID_DEVICE {
  46. HANDLE HidDevice; // A file handle to the hid device.
  47. PHIDP_PREPARSED_DATA Ppd; // The opaque parser info describing this device
  48. HIDP_CAPS Caps; // The Capabilities of this hid device.
  49. PCHAR InputReportBuffer;
  50. PHID_DATA InputData; // array of hid data structures
  51. ULONG InputDataLength; // Num elements in this array.
  52. PHIDP_BUTTON_CAPS InputButtonCaps;
  53. PHIDP_VALUE_CAPS InputValueCaps;
  54. PCHAR OutputReportBuffer;
  55. PHID_DATA OutputData;
  56. ULONG OutputDataLength;
  57. PHIDP_BUTTON_CAPS OutputButtonCaps;
  58. PHIDP_VALUE_CAPS OutputValueCaps;
  59. PCHAR FeatureReportBuffer;
  60. PHID_DATA FeatureData;
  61. ULONG FeatureDataLength;
  62. PHIDP_BUTTON_CAPS FeatureButtonCaps;
  63. PHIDP_VALUE_CAPS FeatureValueCaps;
  64. } HID_DEVICE, *PHID_DEVICE;
  65. BOOLEAN
  66. FindKnownHidDevices (
  67. OUT PHID_DEVICE * HidDevices, // A array of struct _HID_DEVICE
  68. OUT PULONG NumberDevices // the length of this array.
  69. );
  70. BOOLEAN
  71. CloseHidDevices (
  72. OUT PHID_DEVICE * HidDevices, // A array of struct _HID_DEVICE
  73. OUT PULONG NumberDevices // the length of this array.
  74. );
  75. BOOLEAN
  76. Read (
  77. PHID_DEVICE HidDevice
  78. );
  79. BOOLEAN
  80. Write (
  81. PHID_DEVICE HidDevice
  82. );
  83. BOOLEAN
  84. SetFeature (
  85. PHID_DEVICE HidDevice
  86. );
  87. BOOLEAN
  88. GetFeature (
  89. PHID_DEVICE HidDevice
  90. );
  91. BOOLEAN
  92. OpenHidDevice (
  93. IN HDEVINFO HardwareDeviceInfo,
  94. IN PSP_DEVICE_INTERFACE_DATA DeviceInfoData,
  95. IN OUT PHID_DEVICE HidDevice
  96. );
  97. VOID
  98. ReportToString(
  99. PHID_DATA pData
  100. );
  101. BOOL
  102. UnpackReport (
  103. IN PCHAR ReportBuffer,
  104. IN USHORT ReportBufferLength,
  105. IN HIDP_REPORT_TYPE ReportType,
  106. IN OUT PHID_DATA Data,
  107. IN ULONG DataLength,
  108. IN PHIDP_PREPARSED_DATA Ppd
  109. );
  110. #endif