Daniel Dressler | 5469b19 | 2014-11-10 16:18:18 +0900 | [diff] [blame] | 1 | xpad - Linux USB driver for Xbox compatible controllers |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | |
Daniel Dressler | 5469b19 | 2014-11-10 16:18:18 +0900 | [diff] [blame] | 3 | This driver exposes all first-party and third-party Xbox compatible |
| 4 | controllers. It has a long history and has enjoyed considerable usage |
| 5 | as Window's xinput library caused most PC games to focus on Xbox |
| 6 | controller compatibility. |
Dominic Cerquetti | deb8ee4 | 2006-10-10 14:42:48 -0700 | [diff] [blame] | 7 | |
Daniel Dressler | 5469b19 | 2014-11-10 16:18:18 +0900 | [diff] [blame] | 8 | Due to backwards compatibility all buttons are reported as digital. |
| 9 | This only effects Original Xbox controllers. All later controller models |
| 10 | have only digital face buttons. |
| 11 | |
| 12 | Rumble is supported on some models of Xbox 360 controllers but not of |
| 13 | Original Xbox controllers nor on Xbox One controllers. As of writing |
| 14 | the Xbox One's rumble protocol has not been reverse engineered but in |
| 15 | the future could be supported. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 | |
| 17 | |
Dominic Cerquetti | deb8ee4 | 2006-10-10 14:42:48 -0700 | [diff] [blame] | 18 | 0. Notes |
| 19 | -------- |
Dominic Cerquetti | deb8ee4 | 2006-10-10 14:42:48 -0700 | [diff] [blame] | 20 | The number of buttons/axes reported varies based on 3 things: |
| 21 | - if you are using a known controller |
| 22 | - if you are using a known dance pad |
| 23 | - if using an unknown device (one not listed below), what you set in the |
| 24 | module configuration for "Map D-PAD to buttons rather than axes for unknown |
| 25 | pads" (module option dpad_to_buttons) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | |
Daniel Dressler | 5469b19 | 2014-11-10 16:18:18 +0900 | [diff] [blame] | 27 | If you set dpad_to_buttons to N and you are using an unknown device |
| 28 | the driver will map the directional pad to axes (X/Y). |
| 29 | If you said Y it will map the d-pad to buttons, which is needed for dance |
| 30 | style games to function correctly. The default is Y. |
Dominic Cerquetti | deb8ee4 | 2006-10-10 14:42:48 -0700 | [diff] [blame] | 31 | |
Daniel Dressler | 5469b19 | 2014-11-10 16:18:18 +0900 | [diff] [blame] | 32 | dpad_to_buttons has no effect for known pads. A erroneous commit message |
| 33 | claimed dpad_to_buttons could be used to force behavior on known devices. |
| 34 | This is not true. Both dpad_to_buttons and triggers_to_buttons only affect |
| 35 | unknown controllers. |
| 36 | |
Dominic Cerquetti | deb8ee4 | 2006-10-10 14:42:48 -0700 | [diff] [blame] | 37 | |
| 38 | 0.1 Normal Controllers |
| 39 | ---------------------- |
| 40 | With a normal controller, the directional pad is mapped to its own X/Y axes. |
| 41 | The jstest-program from joystick-1.2.15 (jstest-version 2.1.0) will report 8 |
| 42 | axes and 10 buttons. |
| 43 | |
| 44 | All 8 axes work, though they all have the same range (-32768..32767) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 45 | and the zero-setting is not correct for the triggers (I don't know if that |
| 46 | is some limitation of jstest, since the input device setup should be fine. I |
| 47 | didn't have a look at jstest itself yet). |
| 48 | |
| 49 | All of the 10 buttons work (in digital mode). The six buttons on the |
| 50 | right side (A, B, X, Y, black, white) are said to be "analog" and |
| 51 | report their values as 8 bit unsigned, not sure what this is good for. |
| 52 | |
| 53 | I tested the controller with quake3, and configuration and |
| 54 | in game functionality were OK. However, I find it rather difficult to |
| 55 | play first person shooters with a pad. Your mileage may vary. |
| 56 | |
| 57 | |
Dominic Cerquetti | deb8ee4 | 2006-10-10 14:42:48 -0700 | [diff] [blame] | 58 | 0.2 Xbox Dance Pads |
| 59 | ------------------- |
| 60 | When using a known dance pad, jstest will report 6 axes and 14 buttons. |
| 61 | |
| 62 | For dance style pads (like the redoctane pad) several changes |
| 63 | have been made. The old driver would map the d-pad to axes, resulting |
| 64 | in the driver being unable to report when the user was pressing both |
| 65 | left+right or up+down, making DDR style games unplayable. |
| 66 | |
| 67 | Known dance pads automatically map the d-pad to buttons and will work |
| 68 | correctly out of the box. |
| 69 | |
| 70 | If your dance pad is recognized by the driver but is using axes instead |
| 71 | of buttons, see section 0.3 - Unknown Controllers |
| 72 | |
| 73 | I've tested this with Stepmania, and it works quite well. |
| 74 | |
| 75 | |
Matt LaPlante | a982ac0 | 2007-05-09 07:35:06 +0200 | [diff] [blame] | 76 | 0.3 Unknown Controllers |
Dominic Cerquetti | deb8ee4 | 2006-10-10 14:42:48 -0700 | [diff] [blame] | 77 | ---------------------- |
Matt LaPlante | a982ac0 | 2007-05-09 07:35:06 +0200 | [diff] [blame] | 78 | If you have an unknown xbox controller, it should work just fine with |
Dominic Cerquetti | deb8ee4 | 2006-10-10 14:42:48 -0700 | [diff] [blame] | 79 | the default settings. |
| 80 | |
| 81 | HOWEVER if you have an unknown dance pad not listed below, it will not |
| 82 | work UNLESS you set "dpad_to_buttons" to 1 in the module configuration. |
| 83 | |
Matt LaPlante | a982ac0 | 2007-05-09 07:35:06 +0200 | [diff] [blame] | 84 | PLEASE, if you have an unknown controller, email Dom <binary1230@yahoo.com> with |
Dominic Cerquetti | deb8ee4 | 2006-10-10 14:42:48 -0700 | [diff] [blame] | 85 | a dump from /proc/bus/usb and a description of the pad (manufacturer, country, |
| 86 | whether it is a dance pad or normal controller) so that we can add your pad |
| 87 | to the list of supported devices, ensuring that it will work out of the |
| 88 | box in the future. |
| 89 | |
| 90 | |
Daniel Dressler | 5469b19 | 2014-11-10 16:18:18 +0900 | [diff] [blame] | 91 | 1. USB adapters |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 92 | -------------- |
Daniel Dressler | 5469b19 | 2014-11-10 16:18:18 +0900 | [diff] [blame] | 93 | All generations of Xbox controllers speak USB over the wire. |
| 94 | - Original Xbox controllers use a proprietary connector and require adapters. |
| 95 | - Wireless Xbox 360 controllers require a 'Xbox 360 Wireless Gaming Receiver |
| 96 | for Windows' |
| 97 | - Wired Xbox 360 controllers use standard USB connectors. |
| 98 | - Xbox One controllers can be wireless but speak Wi-Fi Direct and are not |
| 99 | yet supported. |
| 100 | - Xbox One controllers can be wired and use standard Micro-USB connectors. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 101 | |
Daniel Dressler | 5469b19 | 2014-11-10 16:18:18 +0900 | [diff] [blame] | 102 | |
| 103 | |
| 104 | 1.1 Original Xbox USB adapters |
| 105 | -------------- |
| 106 | Using this driver with an Original Xbox controller requires an |
| 107 | adapter cable to break out the proprietary connector's pins to USB. |
| 108 | You can buy these online fairly cheap, or build your own. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 109 | |
Dominic Cerquetti | deb8ee4 | 2006-10-10 14:42:48 -0700 | [diff] [blame] | 110 | Such a cable is pretty easy to build. The Controller itself is a USB |
| 111 | compound device (a hub with three ports for two expansion slots and |
| 112 | the controller device) with the only difference in a nonstandard connector |
Daniel Dressler | 5469b19 | 2014-11-10 16:18:18 +0900 | [diff] [blame] | 113 | (5 pins vs. 4 on standard USB 1.0 connectors). |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 114 | |
| 115 | You just need to solder a USB connector onto the cable and keep the |
| 116 | yellow wire unconnected. The other pins have the same order on both |
| 117 | connectors so there is no magic to it. Detailed info on these matters |
| 118 | can be found on the net ([1], [2], [3]). |
| 119 | |
| 120 | Thanks to the trip splitter found on the cable you don't even need to cut the |
| 121 | original one. You can buy an extension cable and cut that instead. That way, |
| 122 | you can still use the controller with your X-Box, if you have one ;) |
| 123 | |
| 124 | |
Daniel Dressler | 5469b19 | 2014-11-10 16:18:18 +0900 | [diff] [blame] | 125 | |
Dominic Cerquetti | deb8ee4 | 2006-10-10 14:42:48 -0700 | [diff] [blame] | 126 | 2. Driver Installation |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 127 | ---------------------- |
| 128 | |
Daniel Dressler | 5469b19 | 2014-11-10 16:18:18 +0900 | [diff] [blame] | 129 | Once you have the adapter cable, if needed, and the controller connected |
| 130 | the xpad module should be auto loaded. To confirm you can cat |
| 131 | /proc/bus/usb/devices. There should be an entry like the one at the end [4]. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 132 | |
Daniel Dressler | 5469b19 | 2014-11-10 16:18:18 +0900 | [diff] [blame] | 133 | |
| 134 | |
| 135 | 3. Supported Controllers |
| 136 | ------------------------ |
| 137 | For a full list of supported controllers and associated vendor and product |
| 138 | IDs see the xpad_device[] array[6]. |
| 139 | |
| 140 | As of the historic version 0.0.6 (2006-10-10) the following devices |
| 141 | were supported: |
| 142 | original Microsoft XBOX controller (US), vendor=0x045e, product=0x0202 |
| 143 | smaller Microsoft XBOX controller (US), vendor=0x045e, product=0x0289 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 144 | original Microsoft XBOX controller (Japan), vendor=0x045e, product=0x0285 |
Daniel Dressler | 5469b19 | 2014-11-10 16:18:18 +0900 | [diff] [blame] | 145 | InterAct PowerPad Pro (Germany), vendor=0x05fd, product=0x107a |
| 146 | RedOctane Xbox Dance Pad (US), vendor=0x0c12, product=0x8809 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 147 | |
Daniel Dressler | 5469b19 | 2014-11-10 16:18:18 +0900 | [diff] [blame] | 148 | Unrecognized models of Xbox controllers should function as Generic |
| 149 | Xbox controllers. Unrecognized Dance Pad controllers require setting |
| 150 | the module option 'dpad_to_buttons'. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 151 | |
Daniel Dressler | 5469b19 | 2014-11-10 16:18:18 +0900 | [diff] [blame] | 152 | If you have an unrecognized controller please see 0.3 - Unknown Controllers |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 153 | |
Daniel Dressler | 5469b19 | 2014-11-10 16:18:18 +0900 | [diff] [blame] | 154 | |
| 155 | 4. Manual Testing |
| 156 | ----------------- |
| 157 | To test this driver's functionality you may use 'jstest'. |
| 158 | |
| 159 | For example: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 160 | > modprobe xpad |
| 161 | > modprobe joydev |
| 162 | > jstest /dev/js0 |
| 163 | |
Dominic Cerquetti | deb8ee4 | 2006-10-10 14:42:48 -0700 | [diff] [blame] | 164 | If you're using a normal controller, there should be a single line showing |
| 165 | 18 inputs (8 axes, 10 buttons), and its values should change if you move |
| 166 | the sticks and push the buttons. If you're using a dance pad, it should |
| 167 | show 20 inputs (6 axes, 14 buttons). |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 168 | |
Dominic Cerquetti | deb8ee4 | 2006-10-10 14:42:48 -0700 | [diff] [blame] | 169 | It works? Voila, you're done ;) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 170 | |
| 171 | |
Daniel Dressler | 5469b19 | 2014-11-10 16:18:18 +0900 | [diff] [blame] | 172 | |
| 173 | 5. Thanks |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 174 | --------- |
| 175 | |
| 176 | I have to thank ITO Takayuki for the detailed info on his site |
| 177 | http://euc.jp/periphs/xbox-controller.ja.html. |
| 178 | |
| 179 | His useful info and both the usb-skeleton as well as the iforce input driver |
| 180 | (Greg Kroah-Hartmann; Vojtech Pavlik) helped a lot in rapid prototyping |
| 181 | the basic functionality. |
| 182 | |
| 183 | |
Daniel Dressler | 5469b19 | 2014-11-10 16:18:18 +0900 | [diff] [blame] | 184 | |
| 185 | 6. References |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 186 | ------------- |
| 187 | |
Daniel Dressler | 5469b19 | 2014-11-10 16:18:18 +0900 | [diff] [blame] | 188 | [1]: http://euc.jp/periphs/xbox-controller.ja.html (ITO Takayuki) |
| 189 | [2]: http://xpad.xbox-scene.com/ |
| 190 | [3]: http://www.markosweb.com/www/xboxhackz.com/ |
| 191 | [4]: /proc/bus/usb/devices - dump from InterAct PowerPad Pro (Germany): |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 192 | |
| 193 | T: Bus=01 Lev=03 Prnt=04 Port=00 Cnt=01 Dev#= 5 Spd=12 MxCh= 0 |
| 194 | D: Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=32 #Cfgs= 1 |
| 195 | P: Vendor=05fd ProdID=107a Rev= 1.00 |
| 196 | C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=100mA |
| 197 | I: If#= 0 Alt= 0 #EPs= 2 Cls=58(unk. ) Sub=42 Prot=00 Driver=(none) |
| 198 | E: Ad=81(I) Atr=03(Int.) MxPS= 32 Ivl= 10ms |
| 199 | E: Ad=02(O) Atr=03(Int.) MxPS= 32 Ivl= 10ms |
| 200 | |
Daniel Dressler | 5469b19 | 2014-11-10 16:18:18 +0900 | [diff] [blame] | 201 | [5]: /proc/bus/usb/devices - dump from Redoctane Xbox Dance Pad (US): |
Dominic Cerquetti | deb8ee4 | 2006-10-10 14:42:48 -0700 | [diff] [blame] | 202 | |
| 203 | T: Bus=01 Lev=02 Prnt=09 Port=00 Cnt=01 Dev#= 10 Spd=12 MxCh= 0 |
| 204 | D: Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1 |
| 205 | P: Vendor=0c12 ProdID=8809 Rev= 0.01 |
| 206 | S: Product=XBOX DDR |
| 207 | C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=100mA |
| 208 | I: If#= 0 Alt= 0 #EPs= 2 Cls=58(unk. ) Sub=42 Prot=00 Driver=xpad |
| 209 | E: Ad=82(I) Atr=03(Int.) MxPS= 32 Ivl=4ms |
| 210 | E: Ad=02(O) Atr=03(Int.) MxPS= 32 Ivl=4ms |
| 211 | |
Daniel Dressler | 5469b19 | 2014-11-10 16:18:18 +0900 | [diff] [blame] | 212 | [6]: http://lxr.free-electrons.com/ident?i=xpad_device |
| 213 | |
| 214 | |
| 215 | |
| 216 | 7. Historic Edits |
| 217 | ----------------- |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 218 | Marko Friedemann <mfr@bmx-chemnitz.de> |
| 219 | 2002-07-16 |
Dominic Cerquetti | deb8ee4 | 2006-10-10 14:42:48 -0700 | [diff] [blame] | 220 | - original doc |
| 221 | |
| 222 | Dominic Cerquetti <binary1230@yahoo.com> |
| 223 | 2005-03-19 |
| 224 | - added stuff for dance pads, new d-pad->axes mappings |
Daniel Dressler | 5469b19 | 2014-11-10 16:18:18 +0900 | [diff] [blame] | 225 | |
| 226 | Later changes may be viewed with 'git log Documentation/input/xpad.txt' |