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.

113 lines
3.5 KiB

  1. <HTML>
  2. <HEAD>
  3. <TITLE>Designing HID System Devices for Windows and DirectInput</TITLE>
  4. </HEAD>
  5. <BODY BGCOLOR=#FFFFFF TEXT=#000000 LINK=#000000 VLINK=#808080 ALINK=#000000>
  6. <H2>Designing HID System Devices for Windows and DirectInput</H2>
  7. <ADDRESS>
  8. Raymond Chen<br>
  9. Microsoft Corporation<br>
  10. 14 November 1997
  11. </ADDRESS>
  12. <h3>Abstract</h3>
  13. <p>
  14. Recommendations for designing a mouse or keyboard
  15. compliant with the Human Interface Devices (HID)
  16. firmware specification are presented.
  17. Following these recommendations will ensure that
  18. the device can be used both by standard Windows applications
  19. and DirectInput applications.
  20. <h3>Overview and Definitions</h3>
  21. <p>
  22. In this document, when behavior or requirements are attributed
  23. to "Windows", the behavior or requirements apply to the
  24. HID mapping layer, which transforms HID reports into input
  25. events compatible with earlier non-HID devices,
  26. thereby allowing HID-compliant mice and keyboards to be used
  27. as normal Windows input devices.
  28. On Windows 98, the components that perform these transformations
  29. are called MouHID (HID mouse mapping layer) and
  30. KbdHID (HID keyboard mapping layer).
  31. <p>
  32. When behavior or requirements are attributed to "DirectInput",
  33. the behavior or requirements apply to the portion of the
  34. Microsoft DirectX API commonly known as "DirectInput".
  35. DirectInput bypasses the Windows messaging subsystem and
  36. communicates directly with device drivers. For HID-compliant
  37. devices, DirectInput communicates directly with the HID stack.
  38. <h3>Mouse Requirements</h3>
  39. <p>
  40. For Windows and DirectInput
  41. DirectInput to recognize a HID-compliant device
  42. as a mouse,
  43. it must declare its top-level collection as belonging to
  44. the Generic Desktop Page (0x01)
  45. and deploy usage Mouse (0x02) or Pointer (0x01).
  46. <p>
  47. The device must report its X and Y coordinates under the
  48. Generic Desktop Page (0x01) as usages X (0x30) and Y (0x31),
  49. respectively.
  50. Windows requires that the X and Y usages both be absolute
  51. or both be relative.
  52. <i>Furthermore, Windows also requires that they be the
  53. first capabilities in the report descriptor.
  54. <b>This is actually a bug in MouHID B#56937 - MouHID must
  55. check the absolute/relative capabilities on the X and Y axes
  56. specifically, not on a randomly-selected capability.
  57. KenRay confirms that HidParse enumerates capabilities in a
  58. random order.</b>
  59. Consequently, if a HID-compliant device exposes inputs
  60. in addition to the X and Y axes, it must make sure to list
  61. the other inputs after the X and Y axes in the report descriptor.
  62. </i>
  63. <p>
  64. Both Windows and DirectInput require that
  65. if the device contains a wheel,
  66. the wheel must be exposed as a relative control on the
  67. Generic Desktop Page (0x01) as usage Wheel (0x38).
  68. When the wheel is rotated away from the user one unit,
  69. the value of the wheel control should increase by one.
  70. <p>
  71. Windows requires that the buttons on the device all reside
  72. on the Generic Button Page (0x09), consecutively numbered,
  73. starting with <i>unity</i> (not zero).
  74. <h3>Keyboard Requirements</h3>
  75. <p>
  76. For Windows and DirectInput
  77. DirectInput to recognize a HID-compliant device
  78. as a keyboard,
  79. it must declare its top-level collection as belonging to
  80. the Generic Desktop Page (0x01)
  81. and deploy usage Keyboard (0x07).
  82. Windows also recognizes usage System Controls (0x80) as a keyboard.
  83. <h3>References</h3>
  84. <p>
  85. <cite>
  86. <a href=http://www.usb.org/>Universal Serial Bus</a>
  87. HID Usage Tables</cite>, Version 1.0,
  88. USB Implementers Forum.
  89. <p>
  90. <cite>
  91. <a href=http://www.microsoft.com/directx/resources/dx5sdk.htm>
  92. DirectX 5.0 SDK</a>
  93. </cite>, Microsoft Corporation.
  94. </BODY>
  95. </HTML>