xref: /openbmc/linux/Documentation/input/devices/xpad.rst (revision 2612e3bbc0386368a850140a6c9b990cd496a5ec)
1b08c118cSDmitry Torokhov=======================================================
2b08c118cSDmitry Torokhovxpad - Linux USB driver for Xbox compatible controllers
3b08c118cSDmitry Torokhov=======================================================
4b08c118cSDmitry Torokhov
5b08c118cSDmitry TorokhovThis driver exposes all first-party and third-party Xbox compatible
6b08c118cSDmitry Torokhovcontrollers. It has a long history and has enjoyed considerable usage
7*9284d3b9SIsmael Ferreras Morezuelasas Windows' xinput library caused most PC games to focus on Xbox
8b08c118cSDmitry Torokhovcontroller compatibility.
9b08c118cSDmitry Torokhov
10b08c118cSDmitry TorokhovDue to backwards compatibility all buttons are reported as digital.
11*9284d3b9SIsmael Ferreras MorezuelasThis only affects Original Xbox controllers. All later controller models
12b08c118cSDmitry Torokhovhave only digital face buttons.
13b08c118cSDmitry Torokhov
14b08c118cSDmitry TorokhovRumble is supported on some models of Xbox 360 controllers but not of
15b08c118cSDmitry TorokhovOriginal Xbox controllers nor on Xbox One controllers. As of writing
16*9284d3b9SIsmael Ferreras Morezuelasthe Xbox One's rumble protocol has not been reverse-engineered but in
17b08c118cSDmitry Torokhovthe future could be supported.
18b08c118cSDmitry Torokhov
19b08c118cSDmitry Torokhov
20b08c118cSDmitry TorokhovNotes
21b08c118cSDmitry Torokhov=====
22b08c118cSDmitry Torokhov
23b08c118cSDmitry TorokhovThe number of buttons/axes reported varies based on 3 things:
24b08c118cSDmitry Torokhov
25b08c118cSDmitry Torokhov- if you are using a known controller
26b08c118cSDmitry Torokhov- if you are using a known dance pad
27b08c118cSDmitry Torokhov- if using an unknown device (one not listed below), what you set in the
28b08c118cSDmitry Torokhov  module configuration for "Map D-PAD to buttons rather than axes for unknown
29b08c118cSDmitry Torokhov  pads" (module option dpad_to_buttons)
30b08c118cSDmitry Torokhov
31b08c118cSDmitry TorokhovIf you set dpad_to_buttons to N and you are using an unknown device
32b08c118cSDmitry Torokhovthe driver will map the directional pad to axes (X/Y).
33b08c118cSDmitry TorokhovIf you said Y it will map the d-pad to buttons, which is needed for dance
34b08c118cSDmitry Torokhovstyle games to function correctly. The default is Y.
35b08c118cSDmitry Torokhov
36b08c118cSDmitry Torokhovdpad_to_buttons has no effect for known pads. A erroneous commit message
37b08c118cSDmitry Torokhovclaimed dpad_to_buttons could be used to force behavior on known devices.
38b08c118cSDmitry TorokhovThis is not true. Both dpad_to_buttons and triggers_to_buttons only affect
39b08c118cSDmitry Torokhovunknown controllers.
40b08c118cSDmitry Torokhov
41b08c118cSDmitry Torokhov
42b08c118cSDmitry TorokhovNormal Controllers
43b08c118cSDmitry Torokhov------------------
44b08c118cSDmitry Torokhov
45b08c118cSDmitry TorokhovWith a normal controller, the directional pad is mapped to its own X/Y axes.
46b08c118cSDmitry TorokhovThe jstest-program from joystick-1.2.15 (jstest-version 2.1.0) will report 8
47b08c118cSDmitry Torokhovaxes and 10 buttons.
48b08c118cSDmitry Torokhov
49b08c118cSDmitry TorokhovAll 8 axes work, though they all have the same range (-32768..32767)
50b08c118cSDmitry Torokhovand the zero-setting is not correct for the triggers (I don't know if that
51b08c118cSDmitry Torokhovis some limitation of jstest, since the input device setup should be fine. I
52b08c118cSDmitry Torokhovdidn't have a look at jstest itself yet).
53b08c118cSDmitry Torokhov
54b08c118cSDmitry TorokhovAll of the 10 buttons work (in digital mode). The six buttons on the
55b08c118cSDmitry Torokhovright side (A, B, X, Y, black, white) are said to be "analog" and
56b08c118cSDmitry Torokhovreport their values as 8 bit unsigned, not sure what this is good for.
57b08c118cSDmitry Torokhov
58b08c118cSDmitry TorokhovI tested the controller with quake3, and configuration and
59b08c118cSDmitry Torokhovin game functionality were OK. However, I find it rather difficult to
60b08c118cSDmitry Torokhovplay first person shooters with a pad. Your mileage may vary.
61b08c118cSDmitry Torokhov
62b08c118cSDmitry Torokhov
63b08c118cSDmitry TorokhovXbox Dance Pads
64b08c118cSDmitry Torokhov---------------
65b08c118cSDmitry Torokhov
66b08c118cSDmitry TorokhovWhen using a known dance pad, jstest will report 6 axes and 14 buttons.
67b08c118cSDmitry Torokhov
68b08c118cSDmitry TorokhovFor dance style pads (like the redoctane pad) several changes
69b08c118cSDmitry Torokhovhave been made.  The old driver would map the d-pad to axes, resulting
70b08c118cSDmitry Torokhovin the driver being unable to report when the user was pressing both
71b08c118cSDmitry Torokhovleft+right or up+down, making DDR style games unplayable.
72b08c118cSDmitry Torokhov
73b08c118cSDmitry TorokhovKnown dance pads automatically map the d-pad to buttons and will work
74b08c118cSDmitry Torokhovcorrectly out of the box.
75b08c118cSDmitry Torokhov
76b08c118cSDmitry TorokhovIf your dance pad is recognized by the driver but is using axes instead
77b08c118cSDmitry Torokhovof buttons, see section 0.3 - Unknown Controllers
78b08c118cSDmitry Torokhov
79b08c118cSDmitry TorokhovI've tested this with Stepmania, and it works quite well.
80b08c118cSDmitry Torokhov
81b08c118cSDmitry Torokhov
82b08c118cSDmitry TorokhovUnknown Controllers
83b08c118cSDmitry Torokhov-------------------
84b08c118cSDmitry Torokhov
85*9284d3b9SIsmael Ferreras MorezuelasIf you have an unknown Xbox controller, it should work just fine with
86b08c118cSDmitry Torokhovthe default settings.
87b08c118cSDmitry Torokhov
88b08c118cSDmitry TorokhovHOWEVER if you have an unknown dance pad not listed below, it will not
89b08c118cSDmitry Torokhovwork UNLESS you set "dpad_to_buttons" to 1 in the module configuration.
90b08c118cSDmitry Torokhov
91b08c118cSDmitry Torokhov
92b08c118cSDmitry TorokhovUSB adapters
93b08c118cSDmitry Torokhov============
94b08c118cSDmitry Torokhov
95b08c118cSDmitry TorokhovAll generations of Xbox controllers speak USB over the wire.
96b08c118cSDmitry Torokhov
97b08c118cSDmitry Torokhov- Original Xbox controllers use a proprietary connector and require adapters.
98b08c118cSDmitry Torokhov- Wireless Xbox 360 controllers require a 'Xbox 360 Wireless Gaming Receiver
99b08c118cSDmitry Torokhov  for Windows'
100b08c118cSDmitry Torokhov- Wired Xbox 360 controllers use standard USB connectors.
101b08c118cSDmitry Torokhov- Xbox One controllers can be wireless but speak Wi-Fi Direct and are not
102b08c118cSDmitry Torokhov  yet supported.
103b08c118cSDmitry Torokhov- Xbox One controllers can be wired and use standard Micro-USB connectors.
104b08c118cSDmitry Torokhov
105b08c118cSDmitry Torokhov
106b08c118cSDmitry Torokhov
107b08c118cSDmitry TorokhovOriginal Xbox USB adapters
108b08c118cSDmitry Torokhov--------------------------
109b08c118cSDmitry Torokhov
110b08c118cSDmitry TorokhovUsing this driver with an Original Xbox controller requires an
111b08c118cSDmitry Torokhovadapter cable to break out the proprietary connector's pins to USB.
112b08c118cSDmitry TorokhovYou can buy these online fairly cheap, or build your own.
113b08c118cSDmitry Torokhov
114b08c118cSDmitry TorokhovSuch a cable is pretty easy to build. The Controller itself is a USB
115b08c118cSDmitry Torokhovcompound device (a hub with three ports for two expansion slots and
116b08c118cSDmitry Torokhovthe controller device) with the only difference in a nonstandard connector
117b08c118cSDmitry Torokhov(5 pins vs. 4 on standard USB 1.0 connectors).
118b08c118cSDmitry Torokhov
119b08c118cSDmitry TorokhovYou just need to solder a USB connector onto the cable and keep the
120b08c118cSDmitry Torokhovyellow wire unconnected. The other pins have the same order on both
121b08c118cSDmitry Torokhovconnectors so there is no magic to it. Detailed info on these matters
122b08c118cSDmitry Torokhovcan be found on the net ([1]_, [2]_, [3]_).
123b08c118cSDmitry Torokhov
124b08c118cSDmitry TorokhovThanks to the trip splitter found on the cable you don't even need to cut the
125b08c118cSDmitry Torokhovoriginal one. You can buy an extension cable and cut that instead. That way,
126*9284d3b9SIsmael Ferreras Morezuelasyou can still use the controller with your Xbox, if you have one ;)
127b08c118cSDmitry Torokhov
128b08c118cSDmitry Torokhov
129b08c118cSDmitry Torokhov
130b08c118cSDmitry TorokhovDriver Installation
131b08c118cSDmitry Torokhov===================
132b08c118cSDmitry Torokhov
133b08c118cSDmitry TorokhovOnce you have the adapter cable, if needed, and the controller connected
134b08c118cSDmitry Torokhovthe xpad module should be auto loaded. To confirm you can cat
13569989627SMauro Carvalho Chehab/sys/kernel/debug/usb/devices. There should be an entry like those:
136b08c118cSDmitry Torokhov
13769989627SMauro Carvalho Chehab.. code-block:: none
13869989627SMauro Carvalho Chehab   :caption: dump from InterAct PowerPad Pro (Germany)
13969989627SMauro Carvalho Chehab
14069989627SMauro Carvalho Chehab    T:  Bus=01 Lev=03 Prnt=04 Port=00 Cnt=01 Dev#=  5 Spd=12  MxCh= 0
14169989627SMauro Carvalho Chehab    D:  Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=32 #Cfgs=  1
14269989627SMauro Carvalho Chehab    P:  Vendor=05fd ProdID=107a Rev= 1.00
14369989627SMauro Carvalho Chehab    C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=100mA
14469989627SMauro Carvalho Chehab    I:  If#= 0 Alt= 0 #EPs= 2 Cls=58(unk. ) Sub=42 Prot=00 Driver=(none)
14569989627SMauro Carvalho Chehab    E:  Ad=81(I) Atr=03(Int.) MxPS=  32 Ivl= 10ms
14669989627SMauro Carvalho Chehab    E:  Ad=02(O) Atr=03(Int.) MxPS=  32 Ivl= 10ms
14769989627SMauro Carvalho Chehab
14869989627SMauro Carvalho Chehab.. code-block:: none
14969989627SMauro Carvalho Chehab   :caption: dump from Redoctane Xbox Dance Pad (US)
15069989627SMauro Carvalho Chehab
15169989627SMauro Carvalho Chehab    T:  Bus=01 Lev=02 Prnt=09 Port=00 Cnt=01 Dev#= 10 Spd=12  MxCh= 0
15269989627SMauro Carvalho Chehab    D:  Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
15369989627SMauro Carvalho Chehab    P:  Vendor=0c12 ProdID=8809 Rev= 0.01
15469989627SMauro Carvalho Chehab    S:  Product=XBOX DDR
15569989627SMauro Carvalho Chehab    C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=100mA
15669989627SMauro Carvalho Chehab    I:  If#= 0 Alt= 0 #EPs= 2 Cls=58(unk. ) Sub=42 Prot=00 Driver=xpad
15769989627SMauro Carvalho Chehab    E:  Ad=82(I) Atr=03(Int.) MxPS=  32 Ivl=4ms
15869989627SMauro Carvalho Chehab    E:  Ad=02(O) Atr=03(Int.) MxPS=  32 Ivl=4ms
159b08c118cSDmitry Torokhov
160b08c118cSDmitry Torokhov
161b08c118cSDmitry TorokhovSupported Controllers
162b08c118cSDmitry Torokhov=====================
163b08c118cSDmitry Torokhov
164b08c118cSDmitry TorokhovFor a full list of supported controllers and associated vendor and product
16569989627SMauro Carvalho ChehabIDs see the xpad_device[] array\ [4]_.
166b08c118cSDmitry Torokhov
167b08c118cSDmitry TorokhovAs of the historic version 0.0.6 (2006-10-10) the following devices
168b08c118cSDmitry Torokhovwere supported::
169b08c118cSDmitry Torokhov
170b08c118cSDmitry Torokhov original Microsoft XBOX controller (US),    vendor=0x045e, product=0x0202
171b08c118cSDmitry Torokhov smaller  Microsoft XBOX controller (US),    vendor=0x045e, product=0x0289
172b08c118cSDmitry Torokhov original Microsoft XBOX controller (Japan), vendor=0x045e, product=0x0285
173b08c118cSDmitry Torokhov InterAct PowerPad Pro (Germany),            vendor=0x05fd, product=0x107a
174b08c118cSDmitry Torokhov RedOctane Xbox Dance Pad (US),              vendor=0x0c12, product=0x8809
175b08c118cSDmitry Torokhov
176b08c118cSDmitry TorokhovUnrecognized models of Xbox controllers should function as Generic
177b08c118cSDmitry TorokhovXbox controllers. Unrecognized Dance Pad controllers require setting
178b08c118cSDmitry Torokhovthe module option 'dpad_to_buttons'.
179b08c118cSDmitry Torokhov
180b08c118cSDmitry TorokhovIf you have an unrecognized controller please see 0.3 - Unknown Controllers
181b08c118cSDmitry Torokhov
182b08c118cSDmitry Torokhov
183b08c118cSDmitry TorokhovManual Testing
184b08c118cSDmitry Torokhov==============
185b08c118cSDmitry Torokhov
186b08c118cSDmitry TorokhovTo test this driver's functionality you may use 'jstest'.
187b08c118cSDmitry Torokhov
188b08c118cSDmitry TorokhovFor example::
189b08c118cSDmitry Torokhov
190b08c118cSDmitry Torokhov    > modprobe xpad
191b08c118cSDmitry Torokhov    > modprobe joydev
192b08c118cSDmitry Torokhov    > jstest /dev/js0
193b08c118cSDmitry Torokhov
194b08c118cSDmitry TorokhovIf you're using a normal controller, there should be a single line showing
195b08c118cSDmitry Torokhov18 inputs (8 axes, 10 buttons), and its values should change if you move
196b08c118cSDmitry Torokhovthe sticks and push the buttons.  If you're using a dance pad, it should
197b08c118cSDmitry Torokhovshow 20 inputs (6 axes, 14 buttons).
198b08c118cSDmitry Torokhov
199b08c118cSDmitry TorokhovIt works? Voila, you're done ;)
200b08c118cSDmitry Torokhov
201b08c118cSDmitry Torokhov
202b08c118cSDmitry Torokhov
203b08c118cSDmitry TorokhovThanks
204b08c118cSDmitry Torokhov======
205b08c118cSDmitry Torokhov
206b08c118cSDmitry TorokhovI have to thank ITO Takayuki for the detailed info on his site
207b08c118cSDmitry Torokhov    http://euc.jp/periphs/xbox-controller.ja.html.
208b08c118cSDmitry Torokhov
209b08c118cSDmitry TorokhovHis useful info and both the usb-skeleton as well as the iforce input driver
210b08c118cSDmitry Torokhov(Greg Kroah-Hartmann; Vojtech Pavlik) helped a lot in rapid prototyping
211b08c118cSDmitry Torokhovthe basic functionality.
212b08c118cSDmitry Torokhov
213b08c118cSDmitry Torokhov
214b08c118cSDmitry Torokhov
215b08c118cSDmitry TorokhovReferences
216b08c118cSDmitry Torokhov==========
217b08c118cSDmitry Torokhov
218b08c118cSDmitry Torokhov.. [1] http://euc.jp/periphs/xbox-controller.ja.html (ITO Takayuki)
219b08c118cSDmitry Torokhov.. [2] http://xpad.xbox-scene.com/
220b08c118cSDmitry Torokhov.. [3] http://www.markosweb.com/www/xboxhackz.com/
22119c1d46dSJonathan Neuschäfer.. [4] https://elixir.bootlin.com/linux/latest/ident/xpad_device
222b08c118cSDmitry Torokhov
223b08c118cSDmitry Torokhov
224b08c118cSDmitry TorokhovHistoric Edits
225b08c118cSDmitry Torokhov==============
226b08c118cSDmitry Torokhov
227b08c118cSDmitry Torokhov2002-07-16 - Marko Friedemann <mfr@bmx-chemnitz.de>
228b08c118cSDmitry Torokhov - original doc
229b08c118cSDmitry Torokhov
230b08c118cSDmitry Torokhov2005-03-19 - Dominic Cerquetti <binary1230@yahoo.com>
231b08c118cSDmitry Torokhov - added stuff for dance pads, new d-pad->axes mappings
232b08c118cSDmitry Torokhov
2331752118dSTom SaegerLater changes may be viewed with
2341752118dSTom Saeger'git log --follow Documentation/input/devices/xpad.rst'
235