xpad.rst 8.4 KB
Newer Older
1
=======================================================
2
xpad - Linux USB driver for Xbox compatible controllers
3
=======================================================
L
Linus Torvalds 已提交
4

5 6 7 8
This driver exposes all first-party and third-party Xbox compatible
controllers. It has a long history and has enjoyed considerable usage
as Window's xinput library caused most PC games to focus on Xbox
controller compatibility.
D
Dominic Cerquetti 已提交
9

10 11 12 13 14 15 16 17
Due to backwards compatibility all buttons are reported as digital.
This only effects Original Xbox controllers. All later controller models
have only digital face buttons.

Rumble is supported on some models of Xbox 360 controllers but not of
Original Xbox controllers nor on Xbox One controllers. As of writing
the Xbox One's rumble protocol has not been reverse engineered but in
the future could be supported.
L
Linus Torvalds 已提交
18 19


20 21 22
Notes
=====

D
Dominic Cerquetti 已提交
23
The number of buttons/axes reported varies based on 3 things:
24

D
Dominic Cerquetti 已提交
25 26 27 28 29
- 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 the
  module configuration for "Map D-PAD to buttons rather than axes for unknown
  pads" (module option dpad_to_buttons)
L
Linus Torvalds 已提交
30

31 32 33 34 35 36 37 38 39
If you set dpad_to_buttons to N and you are using an unknown device
the 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 dance
style games to function correctly. The default is Y.

dpad_to_buttons has no effect for known pads. A erroneous commit message
claimed 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 affect
unknown controllers.
D
Dominic Cerquetti 已提交
40 41


42 43 44
Normal Controllers
------------------

D
Dominic Cerquetti 已提交
45 46 47
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 8
axes and 10 buttons.
L
Linus Torvalds 已提交
48

D
Dominic Cerquetti 已提交
49
All 8 axes work, though they all have the same range (-32768..32767)
L
Linus Torvalds 已提交
50 51 52 53 54 55 56 57 58 59 60 61 62
and the zero-setting is not correct for the triggers (I don't know if that
is some limitation of jstest, since the input device setup should be fine. I
didn't have a look at jstest itself yet).

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

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


63 64 65
Xbox Dance Pads
---------------

D
Dominic Cerquetti 已提交
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
When using a known dance pad, jstest will report 6 axes and 14 buttons.

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

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

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

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


82 83 84
Unknown Controllers
-------------------

M
Matt LaPlante 已提交
85
If you have an unknown xbox controller, it should work just fine with
D
Dominic Cerquetti 已提交
86 87 88 89 90
the default settings.

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

M
Matt LaPlante 已提交
91
PLEASE, if you have an unknown controller, email Dom <binary1230@yahoo.com> with
D
Dominic Cerquetti 已提交
92 93 94 95 96 97
a dump from /proc/bus/usb and a description of the pad (manufacturer, country,
whether it is a dance pad or normal controller) so that we can add your pad
to the list of supported devices, ensuring that it will work out of the
box in the future.


98 99 100
USB adapters
============

101
All generations of Xbox controllers speak USB over the wire.
102

103 104 105 106 107 108 109 110
- Original Xbox controllers use a proprietary connector and require adapters.
- Wireless Xbox 360 controllers require a 'Xbox 360 Wireless Gaming Receiver
  for Windows'
- Wired Xbox 360 controllers use standard USB connectors.
- Xbox One controllers can be wireless but speak Wi-Fi Direct and are not
  yet supported.
- Xbox One controllers can be wired and use standard Micro-USB connectors.

L
Linus Torvalds 已提交
111

112

113 114 115
Original Xbox USB adapters
--------------------------

116 117 118
Using this driver with an Original Xbox controller requires an
adapter cable to break out the proprietary connector's pins to USB.
You can buy these online fairly cheap, or build your own.
L
Linus Torvalds 已提交
119

D
Dominic Cerquetti 已提交
120 121 122
Such a cable is pretty easy to build. The Controller itself is a USB
compound device (a hub with three ports for two expansion slots and
the controller device) with the only difference in a nonstandard connector
123
(5 pins vs. 4 on standard USB 1.0 connectors).
L
Linus Torvalds 已提交
124 125 126 127

You just need to solder a USB connector onto the cable and keep the
yellow wire unconnected. The other pins have the same order on both
connectors so there is no magic to it. Detailed info on these matters
128
can be found on the net ([1]_, [2]_, [3]_).
L
Linus Torvalds 已提交
129 130 131 132 133 134

Thanks to the trip splitter found on the cable you don't even need to cut the
original 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 ;)


135

136 137
Driver Installation
===================
L
Linus Torvalds 已提交
138

139 140
Once you have the adapter cable, if needed, and the controller connected
the xpad module should be auto loaded. To confirm you can cat
141
/proc/bus/usb/devices. There should be an entry like the one at the end [4]_.
142 143


L
Linus Torvalds 已提交
144

145 146 147
Supported Controllers
=====================

148 149 150 151
For a full list of supported controllers and associated vendor and product
IDs see the xpad_device[] array[6].

As of the historic version 0.0.6 (2006-10-10) the following devices
152 153
were supported::

154 155
 original Microsoft XBOX controller (US),    vendor=0x045e, product=0x0202
 smaller  Microsoft XBOX controller (US),    vendor=0x045e, product=0x0289
L
Linus Torvalds 已提交
156
 original Microsoft XBOX controller (Japan), vendor=0x045e, product=0x0285
157 158 159 160 161 162 163 164
 InterAct PowerPad Pro (Germany),            vendor=0x05fd, product=0x107a
 RedOctane Xbox Dance Pad (US),              vendor=0x0c12, product=0x8809

Unrecognized models of Xbox controllers should function as Generic
Xbox controllers. Unrecognized Dance Pad controllers require setting
the module option 'dpad_to_buttons'.

If you have an unrecognized controller please see 0.3 - Unknown Controllers
L
Linus Torvalds 已提交
165 166


167 168 169
Manual Testing
==============

170
To test this driver's functionality you may use 'jstest'.
L
Linus Torvalds 已提交
171

172 173 174 175 176
For example::

    > modprobe xpad
    > modprobe joydev
    > jstest /dev/js0
L
Linus Torvalds 已提交
177

D
Dominic Cerquetti 已提交
178 179 180 181
If you're using a normal controller, there should be a single line showing
18 inputs (8 axes, 10 buttons), and its values should change if you move
the sticks and push the buttons.  If you're using a dance pad, it should
show 20 inputs (6 axes, 14 buttons).
L
Linus Torvalds 已提交
182

D
Dominic Cerquetti 已提交
183
It works? Voila, you're done ;)
L
Linus Torvalds 已提交
184 185


186

187 188
Thanks
======
L
Linus Torvalds 已提交
189 190

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

L
Linus Torvalds 已提交
193 194 195 196 197 198
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 prototyping
the basic functionality.



199 200
References
==========
L
Linus Torvalds 已提交
201

202 203 204 205
.. [1] http://euc.jp/periphs/xbox-controller.ja.html (ITO Takayuki)
.. [2] http://xpad.xbox-scene.com/
.. [3] http://www.markosweb.com/www/xboxhackz.com/
.. [4] /proc/bus/usb/devices - dump from InterAct PowerPad Pro (Germany):
206

207
 ::
208 209 210 211 212 213 214 215

    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
216
.. [5] /proc/bus/usb/devices - dump from Redoctane Xbox Dance Pad (US):
217

218
 ::
219 220 221 222 223 224 225 226 227

    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
228
.. [6] http://lxr.free-electrons.com/ident?i=xpad_device
229 230


231 232 233 234
Historic Edits
==============

2002-07-16 - Marko Friedemann <mfr@bmx-chemnitz.de>
D
Dominic Cerquetti 已提交
235 236
 - original doc

237
2005-03-19 - Dominic Cerquetti <binary1230@yahoo.com>
D
Dominic Cerquetti 已提交
238
 - added stuff for dance pads, new d-pad->axes mappings
239 240

Later changes may be viewed with 'git log Documentation/input/xpad.txt'