Beruflich Dokumente
Kultur Dokumente
http://msdn.microsoft.com/en-us/windows/hardware/gg487464
Sign in
Dev Center - Hardware > Learn > Archived White Papers > HID Game Controllers and DirectInput
On This Page Purpose and Terms Device Usage and Usage Page HID and DirectInput HID and the Earlier Multimedia APIs in Windows 98
1 of 3
08/11/2011 4:56 PM
http://msdn.microsoft.com/en-us/windows/hardware/gg487464
Usage Page 0x01 (Generic) 0x01 (Generic) 0x01 (Generic) 0x02 (Simulation) 0x01 (Generic) 0x09 (Button) Any
Usage 0x36 (Slider) 0x37 (Dial) 0x38 (Wheel) 0xBB (Throttle) 0x39 (Hat switch) Any Any (see below)
Although usages not listed in the above table will still be accessible through DirectInput, few game applications will take advantage of their existence. DirectInput treats any usage on any usage page with bit size of unity as a button. Furthermore, any usage on the Button page is treated as a button, even if its bit size is greater than unity. Under such conditions, DirectInput treats the button as a "button with intermediate positions." Such a button can report to the application states such as "half-pressed." DirectInput does not limit the number of usages that can map to each type of axis. Applications designed for DirectInput typically request up to 128 buttons, four points of view (POVs), two sliders, and one each of X, Y, Z, Rx, Ry, and Rz. X and Y axes must report their values as increasing when the control's position is moved to the east and south, respectively. This requirement is in agreement with the USB HID specification. Hat switch controls must report a Null value when not pressed. When pressed, the logical minimum value represents north, and increasing logical values represent directions equally spaced clockwise around the compass. For example, Table 2 describes two different types of hat switches, one with eight positions and one with four positions. Table 2. Hat Switches with 8 and 4 Positions Value Logical Minimum Logical Maximum Null value North Northeast East Southeast South Southwest West Northwest 8 positions 0 7 -1 0 1 2 3 4 5 6 7 4 positions 0 3 -1 0 N/A 1 N/A 2 N/A 3 N/A
Devices are strongly recommended not to report logical ranges with higher resolution than physically supported by the device. For example, a device whose hat switch supports four positions could in principle report itself as if it were an 8-position hat switch. However, devices that do so will mislead applications into believing that the control supports a higher degree of resolution than it actually does. (DirectInput provides a method for applications to query the resolution of a hat switch, and DirectInput relies on the accuracy of the values in the report descriptor to report the resolution accurately.) DirectInput requires that the hat switch reside in its own capability descriptor. Do not combine the hat switch capability with capabilities for adjacent usages (Wheel and Counted Buffer). Top of page
2 of 3
08/11/2011 4:56 PM
http://msdn.microsoft.com/en-us/windows/hardware/gg487464
Usage Page 0x02 (Simulation) 0x01 (Generic) 0x01 (Generic) 0x01 (Generic) 0x01 (Generic) 0x09 (Button) 0x01 (Generic)
Usage 0xBA (Rudder) 0x35 (RZ) 0x36 (Slider) 0x37 (Dial) 0x33 (RX) Any 0x39 (Hat switch)
If more than one control can map to an axis or button or POV, then the first one on the list is used and the others are ignored. For example, if a joystick has both a slider and a dial, then the slider will be mapped to the classical axis U, and the dial will be ignored. As a special case, a throttle will be mapped to the Z-axis unless the Z-axis has already been claimed by the Z control, in which case it will be mapped to the U-axis. (In such case, the throttle will displace any slider or dial that would otherwise be mapped to the U-axis.) For buttons, all usages reported on the Button page (0x09) will be mapped, but they must be consecutively numbered starting from Usage ID 0x01 (Button 1). The requirements on X-axis, Y-axis, and hat switch controls that apply to DirectInput also apply here. Any usage that does not appear in Table 3 is ignored by Joyhid.vxd. Supporting References: USB Device Class Definition for Human Interface Devices (HID), Version 1.11 Universal Serial Bus HID Usage Tables, Version 1.11 Available from http://www.usb.org Windows DDK DirectX SDK Available with MSDN Professional subscriptions (See also http://msdn.microsoft.com/directx/). Top of page Rate:
Network sites
Other links
Support Microsoft Connect
Terms of use
Trademarks
Privacy statement
Site Feedback
3 of 3
08/11/2011 4:56 PM