17. xpad - Linux USB driver for Xbox compatible controllers

This driver exposes all first-party and third-party Xbox compatiblecontrollers. It has a long history and has enjoyed considerable usageas Window’s xinput library caused most PC games to focus on Xboxcontroller compatibility.

Due to backwards compatibility all buttons are reported as digital.This only effects Original Xbox controllers. All later controller modelshave only digital face buttons.

Rumble is supported on some models of Xbox 360 controllers but not ofOriginal Xbox controllers nor on Xbox One controllers. As of writingthe Xbox One’s rumble protocol has not been reverse engineered but inthe future could be supported.

17.1. Notes

The number of buttons/axes reported varies based on 3 things:

  • if you are using a known controller
  • if you are using a known dance pad
  • if using an unknown device (one not listed below), what you set in themodule configuration for “Map D-PAD to buttons rather than axes for unknownpads” (module option dpad_to_buttons)

If you set dpad_to_buttons to N and you are using an unknown devicethe driver will map the directional pad to axes (X/Y).If you said Y it will map the d-pad to buttons, which is needed for dancestyle games to function correctly. The default is Y.

dpad_to_buttons has no effect for known pads. A erroneous commit messageclaimed dpad_to_buttons could be used to force behavior on known devices.This is not true. Both dpad_to_buttons and triggers_to_buttons only affectunknown controllers.

17.1.1. Normal Controllers

With a normal controller, the directional pad is mapped to its own X/Y axes.The jstest-program from joystick-1.2.15 (jstest-version 2.1.0) will report 8axes and 10 buttons.

All 8 axes work, though they all have the same range (-32768..32767)and the zero-setting is not correct for the triggers (I don’t know if thatis some limitation of jstest, since the input device setup should be fine. Ididn’t have a look at jstest itself yet).

All of the 10 buttons work (in digital mode). The six buttons on theright side (A, B, X, Y, black, white) are said to be “analog” andreport their values as 8 bit unsigned, not sure what this is good for.

I tested the controller with quake3, and configuration andin game functionality were OK. However, I find it rather difficult toplay first person shooters with a pad. Your mileage may vary.

17.1.2. Xbox Dance Pads

When using a known dance pad, jstest will report 6 axes and 14 buttons.

For dance style pads (like the redoctane pad) several changeshave been made. The old driver would map the d-pad to axes, resultingin the driver being unable to report when the user was pressing bothleft+right or up+down, making DDR style games unplayable.

Known dance pads automatically map the d-pad to buttons and will workcorrectly out of the box.

If your dance pad is recognized by the driver but is using axes insteadof buttons, see section 0.3 - Unknown Controllers

I’ve tested this with Stepmania, and it works quite well.

17.1.3. Unknown Controllers

If you have an unknown xbox controller, it should work just fine withthe default settings.

HOWEVER if you have an unknown dance pad not listed below, it will notwork UNLESS you set “dpad_to_buttons” to 1 in the module configuration.

17.2. USB adapters

All generations of Xbox controllers speak USB over the wire.

  • Original Xbox controllers use a proprietary connector and require adapters.
  • Wireless Xbox 360 controllers require a ‘Xbox 360 Wireless Gaming Receiverfor Windows’
  • Wired Xbox 360 controllers use standard USB connectors.
  • Xbox One controllers can be wireless but speak Wi-Fi Direct and are notyet supported.
  • Xbox One controllers can be wired and use standard Micro-USB connectors.

17.2.1. Original Xbox USB adapters

Using this driver with an Original Xbox controller requires anadapter cable to break out the proprietary connector’s pins to USB.You can buy these online fairly cheap, or build your own.

Such a cable is pretty easy to build. The Controller itself is a USBcompound device (a hub with three ports for two expansion slots andthe controller device) with the only difference in a nonstandard connector(5 pins vs. 4 on standard USB 1.0 connectors).

You just need to solder a USB connector onto the cable and keep theyellow wire unconnected. The other pins have the same order on bothconnectors so there is no magic to it. Detailed info on these matterscan be found on the net ([1],[2],[3]).

Thanks to the trip splitter found on the cable you don’t even need to cut theoriginal one. You can buy an extension cable and cut that instead. That way,you can still use the controller with your X-Box, if you have one ;)

17.3. Driver Installation

Once you have the adapter cable, if needed, and the controller connectedthe xpad module should be auto loaded. To confirm you can cat/sys/kernel/debug/usb/devices. There should be an entry like those:

dump from InterAct PowerPad Pro (Germany)
 T:  Bus=01 Lev=03 Prnt=04 Port=00 Cnt=01 Dev#=  5 Spd=12  MxCh= 0 D:  Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=32 #Cfgs=  1 P:  Vendor=05fd ProdID=107a Rev= 1.00 C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=100mA I:  If#= 0 Alt= 0 #EPs= 2 Cls=58(unk. ) Sub=42 Prot=00 Driver=(none) E:  Ad=81(I) Atr=03(Int.) MxPS=  32 Ivl= 10ms E:  Ad=02(O) Atr=03(Int.) MxPS=  32 Ivl= 10ms
dump from Redoctane Xbox Dance Pad (US)
 T:  Bus=01 Lev=02 Prnt=09 Port=00 Cnt=01 Dev#= 10 Spd=12  MxCh= 0 D:  Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1 P:  Vendor=0c12 ProdID=8809 Rev= 0.01 S:  Product=XBOX DDR C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=100mA I:  If#= 0 Alt= 0 #EPs= 2 Cls=58(unk. ) Sub=42 Prot=00 Driver=xpad E:  Ad=82(I) Atr=03(Int.) MxPS=  32 Ivl=4ms E:  Ad=02(O) Atr=03(Int.) MxPS=  32 Ivl=4ms

17.4. Supported Controllers

For a full list of supported controllers and associated vendor and productIDs see the xpad_device[] array[4].

As of the historic version 0.0.6 (2006-10-10) the following deviceswere supported:

original Microsoft XBOX controller (US),    vendor=0x045e, product=0x0202smaller  Microsoft XBOX controller (US),    vendor=0x045e, product=0x0289original Microsoft XBOX controller (Japan), vendor=0x045e, product=0x0285InterAct PowerPad Pro (Germany),            vendor=0x05fd, product=0x107aRedOctane Xbox Dance Pad (US),              vendor=0x0c12, product=0x8809

Unrecognized models of Xbox controllers should function as GenericXbox controllers. Unrecognized Dance Pad controllers require settingthe module option ‘dpad_to_buttons’.

If you have an unrecognized controller please see 0.3 - Unknown Controllers

17.5. Manual Testing

To test this driver’s functionality you may use ‘jstest’.

For example:

> modprobe xpad> modprobe joydev> jstest /dev/js0

If you’re using a normal controller, there should be a single line showing18 inputs (8 axes, 10 buttons), and its values should change if you movethe sticks and push the buttons. If you’re using a dance pad, it shouldshow 20 inputs (6 axes, 14 buttons).

It works? Voila, you’re done ;)

17.6. Thanks

I have to thank ITO Takayuki for the detailed info on his site
http://euc.jp/periphs/xbox-controller.ja.html.

His useful info and both the usb-skeleton as well as the iforce input driver(Greg Kroah-Hartmann; Vojtech Pavlik) helped a lot in rapid prototypingthe basic functionality.

17.8. Historic Edits

2002-07-16 - Marko Friedemann <mfr@bmx-chemnitz.de>
  • original doc
2005-03-19 - Dominic Cerquetti <binary1230@yahoo.com>
  • added stuff for dance pads, new d-pad->axes mappings

Later changes may be viewed with‘git log –follow Documentation/input/devices/xpad.rst’