Edit

Share via


DirectInput and XUSB Devices

The driver for XUSB on Windows implements the kernel-mode interface for the XINPUT DLL. To provide a good experience for legacy titles that use the DirectInput API with the common controller devicethe driver also exports a Human Interface Device (HID) class interfacewhich is picked up by DirectInput. We chose the mapping of XUSB to HID based on typical behavior in a set of gaming applications for the original XINPUT versionand we updated the mapping for newer subtypes. This topic describes the mapping.

Human Interface Device (HID)

HID standard is a standard from the Universal Serial Bus (USB) committee originally proposed by Microsoft to generalize protocols for input devices. It consists of a byte-code description language and can express gamepadsmicejoysticksthrottle and rudder controlsand multi-axis controllers. Because this standard is so generalizedyou might have difficulty writing software that consumes input from arbitrary devices. Thereforefor the game-centric DirectInput APIwe developed a specific sub-mapping of types to encourage hardware manufactures to support through their drivers.

Important

You can also access HID input devices via RawInput API and process input reports via low level HID API but vibration feedback will not work as with DirectInput.

Mappings

The XUSB driver implements both an XUSB class interface and a HID class interface for devices in order to support both XINPUT and DirectInput usage. This mapping is based on the XUSB subtype information. The driver implements four distinct groups of mappings.

XUSB Subtype Mapping
XINPUT_DEVSUBTYPE_GAMEPAD (Subtype 1) Gamepad
XINPUT_DEVSUBTYPE_WHEEL (Subtype 2) Wheel
XINPUT_DEVSUBTYPE_ARCADE_STICK (Subtype 3) Arcade Stick/Arcade Pad
XINPUT_DEVSUBTYPE_FLIGHT_STICK (Subtype 4) Flight Stick
XINPUT_DEVSUBTYPE_DANCE_PAD (Subtype 5) Default for any new subtype
XINPUT_DEVSUBTYPE_GUITAR (Subtype 6) Guitar
XINPUT_DEVSUBTYPE_GUITAR_ALTERNATE (Subtype 7)
XINPUT_DEVSUBTYPE_DRUM_KIT (Subtype 8)
XINPUT_DEVSUBTYPE_GUITAR_BASS (Subtype 11)
XINPUT_DEVSUBTYPE_ARCADE_PAD (Subtype 19)

Note

The following HID mappings are static. This means that even if the device capabilities report indicates that a particular button or axis is not supportedthe mapping will still include it but will always report an off state or center value.

Gamepad

This is the default mapping and is designed around a standard gamepadand is exposed as a Gamepad HID usage type.

Control HID Usage Name Usage Page Usage ID
Left Stick XY 0x01 0x300x31
Right Stick RxRy 0x01 0x330x34
Left Trigger + Right Trigger Z* 0x01 0x32
D-Pad UpDownLeftRight Hat Switch 0x01 0x39
A Button 1 0x09 0x01
B Button 2 0x09 0x02
X Button 3 0x09 0x03
Y Button 4 0x09 0x04
LB (left bumper) Button 5 0x09 0x05
RB (right bumper) Button 6 0x09 0x06
BACK Button 7 0x09 0x07
START Button 8 0x09 0x08
LSB (left stick button) Button 9 0x09 0x09
RSB (right stick button) Button 10 0x09 0x0A

Note

(*): This is combined so that Z exhibits the centering behavior expected by most titles for rotation; this does mean it is not possible to see all possible trigger combination values through DirectInput and HID.

Arcade Stick/Arcade Pad

This is the mapping designed around the Arcade Stick controllerand is exposed as a Gamepad HID usage type. The Arcade Pad is very much like an Arcade Stickbut in a smaller form-factor. These designs replace the analog Left Trigger and Right Trigger with digital buttons that report the minimum and maximum axis value.

Control HID Usage Name Usage Page Usage ID
D-Pad UpDownLeftRight Hat Switch 0x01 0x39
A Button 1 0x09 0x01
B Button 2 0x09 0x02
X Button 3 0x09 0x03
Y Button 4 0x09 0x04
LB (left bumper) Button 5 0x09 0x05
RB (right bumper) Button 6 0x09 0x06
BACK Button 7 0x09 0x07
START Button 8 0x09 0x08
Left Trigger Button 9 0x09 0x09
Right Trigger Button 10 0x09 0x0A

These devices may or may not support additional controlsbut these are not exposed by the HID mapping: Left StickRight StickLSB (left stick button)and RSB (right stick button).

Wheel

This mapping is designed around a racing wheeland is exposed as a Gamepad HID usage type.

Control HID Usage Name Usage Page Usage ID
Wheel (Left Stick X) X 0x01 0x30
Accelerator Pedal (Right Trigger) + Brake Pedal (Left Trigger) Z* 0x01 0x32
D-Pad UpDownLeftRight Hat Switch 0x01 0x39
A Button 1 0x09 0x01
B Button 2 0x09 0x02
X Button 3 0x09 0x03
Y Button 4 0x09 0x04
LB (left bumper) Button 5 0x09 0x05
RB (right bumper) Button 6 0x09 0x06
LSB (left stick button) Button 7 0x09 0x07
RSB (right stick button) Button 8 0x09 0x08
BACK Button 9 0x09 0x09
START Button 10 0x09 0x0A

Note

(*): This is combined so that Z exhibits the centering behavior expected by most titles for the brake and accelerator controls; this does mean it is not possible to see all possible pedal combination values through DirectInput.

Flight Stick

This mapping is designed around a flight stickand is exposed as a Joystick HID usage type.

Control Usage Name Usage Page Usage ID
Flight Stick (Left Stick) XY 0x01 0x300x31
POV Hat (Right Stick) RxRy 0x01 0x330x34
Throttle (Right Trigger) Z 0x01 0x32
Rudder (Left Trigger) Rz 0x01 0x35
D-Pad UpDownLeftRight Hat Switch 0x01 0x39
Primary Weapon (A) Button 1 0x09 0x01
Secondary Weapon (B) Button 2 0x09 0x02
X Button 3 0x09 0x03
Y Button 4 0x09 0x04
LB (left bumper) Button 5 0x09 0x05
RB (right bumper) Button 6 0x09 0x06
BACK Button 7 0x09 0x07
START Button 8 0x09 0x08
LSB (left stick button) Button 9 0x09 0x09
RSB (right stick button) Button 10 0x09 0x0A

Note

This is based on the final Flight Stick design. Because this differs from early Flight Stick definitionsmany devices have a mode switch that supports the old versus new model. This mapping assumes the new model.