18c2ecf20Sopenharmony_ci======================================================= 28c2ecf20Sopenharmony_cixpad - Linux USB driver for Xbox compatible controllers 38c2ecf20Sopenharmony_ci======================================================= 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ciThis driver exposes all first-party and third-party Xbox compatible 68c2ecf20Sopenharmony_cicontrollers. It has a long history and has enjoyed considerable usage 78c2ecf20Sopenharmony_cias Window's xinput library caused most PC games to focus on Xbox 88c2ecf20Sopenharmony_cicontroller compatibility. 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ciDue to backwards compatibility all buttons are reported as digital. 118c2ecf20Sopenharmony_ciThis only effects Original Xbox controllers. All later controller models 128c2ecf20Sopenharmony_cihave only digital face buttons. 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ciRumble is supported on some models of Xbox 360 controllers but not of 158c2ecf20Sopenharmony_ciOriginal Xbox controllers nor on Xbox One controllers. As of writing 168c2ecf20Sopenharmony_cithe Xbox One's rumble protocol has not been reverse engineered but in 178c2ecf20Sopenharmony_cithe future could be supported. 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ciNotes 218c2ecf20Sopenharmony_ci===== 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_ciThe number of buttons/axes reported varies based on 3 things: 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci- if you are using a known controller 268c2ecf20Sopenharmony_ci- if you are using a known dance pad 278c2ecf20Sopenharmony_ci- if using an unknown device (one not listed below), what you set in the 288c2ecf20Sopenharmony_ci module configuration for "Map D-PAD to buttons rather than axes for unknown 298c2ecf20Sopenharmony_ci pads" (module option dpad_to_buttons) 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ciIf you set dpad_to_buttons to N and you are using an unknown device 328c2ecf20Sopenharmony_cithe driver will map the directional pad to axes (X/Y). 338c2ecf20Sopenharmony_ciIf you said Y it will map the d-pad to buttons, which is needed for dance 348c2ecf20Sopenharmony_cistyle games to function correctly. The default is Y. 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_cidpad_to_buttons has no effect for known pads. A erroneous commit message 378c2ecf20Sopenharmony_ciclaimed dpad_to_buttons could be used to force behavior on known devices. 388c2ecf20Sopenharmony_ciThis is not true. Both dpad_to_buttons and triggers_to_buttons only affect 398c2ecf20Sopenharmony_ciunknown controllers. 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ciNormal Controllers 438c2ecf20Sopenharmony_ci------------------ 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_ciWith a normal controller, the directional pad is mapped to its own X/Y axes. 468c2ecf20Sopenharmony_ciThe jstest-program from joystick-1.2.15 (jstest-version 2.1.0) will report 8 478c2ecf20Sopenharmony_ciaxes and 10 buttons. 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ciAll 8 axes work, though they all have the same range (-32768..32767) 508c2ecf20Sopenharmony_ciand the zero-setting is not correct for the triggers (I don't know if that 518c2ecf20Sopenharmony_ciis some limitation of jstest, since the input device setup should be fine. I 528c2ecf20Sopenharmony_cididn't have a look at jstest itself yet). 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_ciAll of the 10 buttons work (in digital mode). The six buttons on the 558c2ecf20Sopenharmony_ciright side (A, B, X, Y, black, white) are said to be "analog" and 568c2ecf20Sopenharmony_cireport their values as 8 bit unsigned, not sure what this is good for. 578c2ecf20Sopenharmony_ci 588c2ecf20Sopenharmony_ciI tested the controller with quake3, and configuration and 598c2ecf20Sopenharmony_ciin game functionality were OK. However, I find it rather difficult to 608c2ecf20Sopenharmony_ciplay first person shooters with a pad. Your mileage may vary. 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_ci 638c2ecf20Sopenharmony_ciXbox Dance Pads 648c2ecf20Sopenharmony_ci--------------- 658c2ecf20Sopenharmony_ci 668c2ecf20Sopenharmony_ciWhen using a known dance pad, jstest will report 6 axes and 14 buttons. 678c2ecf20Sopenharmony_ci 688c2ecf20Sopenharmony_ciFor dance style pads (like the redoctane pad) several changes 698c2ecf20Sopenharmony_cihave been made. The old driver would map the d-pad to axes, resulting 708c2ecf20Sopenharmony_ciin the driver being unable to report when the user was pressing both 718c2ecf20Sopenharmony_cileft+right or up+down, making DDR style games unplayable. 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_ciKnown dance pads automatically map the d-pad to buttons and will work 748c2ecf20Sopenharmony_cicorrectly out of the box. 758c2ecf20Sopenharmony_ci 768c2ecf20Sopenharmony_ciIf your dance pad is recognized by the driver but is using axes instead 778c2ecf20Sopenharmony_ciof buttons, see section 0.3 - Unknown Controllers 788c2ecf20Sopenharmony_ci 798c2ecf20Sopenharmony_ciI've tested this with Stepmania, and it works quite well. 808c2ecf20Sopenharmony_ci 818c2ecf20Sopenharmony_ci 828c2ecf20Sopenharmony_ciUnknown Controllers 838c2ecf20Sopenharmony_ci------------------- 848c2ecf20Sopenharmony_ci 858c2ecf20Sopenharmony_ciIf you have an unknown xbox controller, it should work just fine with 868c2ecf20Sopenharmony_cithe default settings. 878c2ecf20Sopenharmony_ci 888c2ecf20Sopenharmony_ciHOWEVER if you have an unknown dance pad not listed below, it will not 898c2ecf20Sopenharmony_ciwork UNLESS you set "dpad_to_buttons" to 1 in the module configuration. 908c2ecf20Sopenharmony_ci 918c2ecf20Sopenharmony_ci 928c2ecf20Sopenharmony_ciUSB adapters 938c2ecf20Sopenharmony_ci============ 948c2ecf20Sopenharmony_ci 958c2ecf20Sopenharmony_ciAll generations of Xbox controllers speak USB over the wire. 968c2ecf20Sopenharmony_ci 978c2ecf20Sopenharmony_ci- Original Xbox controllers use a proprietary connector and require adapters. 988c2ecf20Sopenharmony_ci- Wireless Xbox 360 controllers require a 'Xbox 360 Wireless Gaming Receiver 998c2ecf20Sopenharmony_ci for Windows' 1008c2ecf20Sopenharmony_ci- Wired Xbox 360 controllers use standard USB connectors. 1018c2ecf20Sopenharmony_ci- Xbox One controllers can be wireless but speak Wi-Fi Direct and are not 1028c2ecf20Sopenharmony_ci yet supported. 1038c2ecf20Sopenharmony_ci- Xbox One controllers can be wired and use standard Micro-USB connectors. 1048c2ecf20Sopenharmony_ci 1058c2ecf20Sopenharmony_ci 1068c2ecf20Sopenharmony_ci 1078c2ecf20Sopenharmony_ciOriginal Xbox USB adapters 1088c2ecf20Sopenharmony_ci-------------------------- 1098c2ecf20Sopenharmony_ci 1108c2ecf20Sopenharmony_ciUsing this driver with an Original Xbox controller requires an 1118c2ecf20Sopenharmony_ciadapter cable to break out the proprietary connector's pins to USB. 1128c2ecf20Sopenharmony_ciYou can buy these online fairly cheap, or build your own. 1138c2ecf20Sopenharmony_ci 1148c2ecf20Sopenharmony_ciSuch a cable is pretty easy to build. The Controller itself is a USB 1158c2ecf20Sopenharmony_cicompound device (a hub with three ports for two expansion slots and 1168c2ecf20Sopenharmony_cithe controller device) with the only difference in a nonstandard connector 1178c2ecf20Sopenharmony_ci(5 pins vs. 4 on standard USB 1.0 connectors). 1188c2ecf20Sopenharmony_ci 1198c2ecf20Sopenharmony_ciYou just need to solder a USB connector onto the cable and keep the 1208c2ecf20Sopenharmony_ciyellow wire unconnected. The other pins have the same order on both 1218c2ecf20Sopenharmony_ciconnectors so there is no magic to it. Detailed info on these matters 1228c2ecf20Sopenharmony_cican be found on the net ([1]_, [2]_, [3]_). 1238c2ecf20Sopenharmony_ci 1248c2ecf20Sopenharmony_ciThanks to the trip splitter found on the cable you don't even need to cut the 1258c2ecf20Sopenharmony_cioriginal one. You can buy an extension cable and cut that instead. That way, 1268c2ecf20Sopenharmony_ciyou can still use the controller with your X-Box, if you have one ;) 1278c2ecf20Sopenharmony_ci 1288c2ecf20Sopenharmony_ci 1298c2ecf20Sopenharmony_ci 1308c2ecf20Sopenharmony_ciDriver Installation 1318c2ecf20Sopenharmony_ci=================== 1328c2ecf20Sopenharmony_ci 1338c2ecf20Sopenharmony_ciOnce you have the adapter cable, if needed, and the controller connected 1348c2ecf20Sopenharmony_cithe xpad module should be auto loaded. To confirm you can cat 1358c2ecf20Sopenharmony_ci/sys/kernel/debug/usb/devices. There should be an entry like those: 1368c2ecf20Sopenharmony_ci 1378c2ecf20Sopenharmony_ci.. code-block:: none 1388c2ecf20Sopenharmony_ci :caption: dump from InterAct PowerPad Pro (Germany) 1398c2ecf20Sopenharmony_ci 1408c2ecf20Sopenharmony_ci T: Bus=01 Lev=03 Prnt=04 Port=00 Cnt=01 Dev#= 5 Spd=12 MxCh= 0 1418c2ecf20Sopenharmony_ci D: Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=32 #Cfgs= 1 1428c2ecf20Sopenharmony_ci P: Vendor=05fd ProdID=107a Rev= 1.00 1438c2ecf20Sopenharmony_ci C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=100mA 1448c2ecf20Sopenharmony_ci I: If#= 0 Alt= 0 #EPs= 2 Cls=58(unk. ) Sub=42 Prot=00 Driver=(none) 1458c2ecf20Sopenharmony_ci E: Ad=81(I) Atr=03(Int.) MxPS= 32 Ivl= 10ms 1468c2ecf20Sopenharmony_ci E: Ad=02(O) Atr=03(Int.) MxPS= 32 Ivl= 10ms 1478c2ecf20Sopenharmony_ci 1488c2ecf20Sopenharmony_ci.. code-block:: none 1498c2ecf20Sopenharmony_ci :caption: dump from Redoctane Xbox Dance Pad (US) 1508c2ecf20Sopenharmony_ci 1518c2ecf20Sopenharmony_ci T: Bus=01 Lev=02 Prnt=09 Port=00 Cnt=01 Dev#= 10 Spd=12 MxCh= 0 1528c2ecf20Sopenharmony_ci D: Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1 1538c2ecf20Sopenharmony_ci P: Vendor=0c12 ProdID=8809 Rev= 0.01 1548c2ecf20Sopenharmony_ci S: Product=XBOX DDR 1558c2ecf20Sopenharmony_ci C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=100mA 1568c2ecf20Sopenharmony_ci I: If#= 0 Alt= 0 #EPs= 2 Cls=58(unk. ) Sub=42 Prot=00 Driver=xpad 1578c2ecf20Sopenharmony_ci E: Ad=82(I) Atr=03(Int.) MxPS= 32 Ivl=4ms 1588c2ecf20Sopenharmony_ci E: Ad=02(O) Atr=03(Int.) MxPS= 32 Ivl=4ms 1598c2ecf20Sopenharmony_ci 1608c2ecf20Sopenharmony_ci 1618c2ecf20Sopenharmony_ciSupported Controllers 1628c2ecf20Sopenharmony_ci===================== 1638c2ecf20Sopenharmony_ci 1648c2ecf20Sopenharmony_ciFor a full list of supported controllers and associated vendor and product 1658c2ecf20Sopenharmony_ciIDs see the xpad_device[] array\ [4]_. 1668c2ecf20Sopenharmony_ci 1678c2ecf20Sopenharmony_ciAs of the historic version 0.0.6 (2006-10-10) the following devices 1688c2ecf20Sopenharmony_ciwere supported:: 1698c2ecf20Sopenharmony_ci 1708c2ecf20Sopenharmony_ci original Microsoft XBOX controller (US), vendor=0x045e, product=0x0202 1718c2ecf20Sopenharmony_ci smaller Microsoft XBOX controller (US), vendor=0x045e, product=0x0289 1728c2ecf20Sopenharmony_ci original Microsoft XBOX controller (Japan), vendor=0x045e, product=0x0285 1738c2ecf20Sopenharmony_ci InterAct PowerPad Pro (Germany), vendor=0x05fd, product=0x107a 1748c2ecf20Sopenharmony_ci RedOctane Xbox Dance Pad (US), vendor=0x0c12, product=0x8809 1758c2ecf20Sopenharmony_ci 1768c2ecf20Sopenharmony_ciUnrecognized models of Xbox controllers should function as Generic 1778c2ecf20Sopenharmony_ciXbox controllers. Unrecognized Dance Pad controllers require setting 1788c2ecf20Sopenharmony_cithe module option 'dpad_to_buttons'. 1798c2ecf20Sopenharmony_ci 1808c2ecf20Sopenharmony_ciIf you have an unrecognized controller please see 0.3 - Unknown Controllers 1818c2ecf20Sopenharmony_ci 1828c2ecf20Sopenharmony_ci 1838c2ecf20Sopenharmony_ciManual Testing 1848c2ecf20Sopenharmony_ci============== 1858c2ecf20Sopenharmony_ci 1868c2ecf20Sopenharmony_ciTo test this driver's functionality you may use 'jstest'. 1878c2ecf20Sopenharmony_ci 1888c2ecf20Sopenharmony_ciFor example:: 1898c2ecf20Sopenharmony_ci 1908c2ecf20Sopenharmony_ci > modprobe xpad 1918c2ecf20Sopenharmony_ci > modprobe joydev 1928c2ecf20Sopenharmony_ci > jstest /dev/js0 1938c2ecf20Sopenharmony_ci 1948c2ecf20Sopenharmony_ciIf you're using a normal controller, there should be a single line showing 1958c2ecf20Sopenharmony_ci18 inputs (8 axes, 10 buttons), and its values should change if you move 1968c2ecf20Sopenharmony_cithe sticks and push the buttons. If you're using a dance pad, it should 1978c2ecf20Sopenharmony_cishow 20 inputs (6 axes, 14 buttons). 1988c2ecf20Sopenharmony_ci 1998c2ecf20Sopenharmony_ciIt works? Voila, you're done ;) 2008c2ecf20Sopenharmony_ci 2018c2ecf20Sopenharmony_ci 2028c2ecf20Sopenharmony_ci 2038c2ecf20Sopenharmony_ciThanks 2048c2ecf20Sopenharmony_ci====== 2058c2ecf20Sopenharmony_ci 2068c2ecf20Sopenharmony_ciI have to thank ITO Takayuki for the detailed info on his site 2078c2ecf20Sopenharmony_ci http://euc.jp/periphs/xbox-controller.ja.html. 2088c2ecf20Sopenharmony_ci 2098c2ecf20Sopenharmony_ciHis useful info and both the usb-skeleton as well as the iforce input driver 2108c2ecf20Sopenharmony_ci(Greg Kroah-Hartmann; Vojtech Pavlik) helped a lot in rapid prototyping 2118c2ecf20Sopenharmony_cithe basic functionality. 2128c2ecf20Sopenharmony_ci 2138c2ecf20Sopenharmony_ci 2148c2ecf20Sopenharmony_ci 2158c2ecf20Sopenharmony_ciReferences 2168c2ecf20Sopenharmony_ci========== 2178c2ecf20Sopenharmony_ci 2188c2ecf20Sopenharmony_ci.. [1] http://euc.jp/periphs/xbox-controller.ja.html (ITO Takayuki) 2198c2ecf20Sopenharmony_ci.. [2] http://xpad.xbox-scene.com/ 2208c2ecf20Sopenharmony_ci.. [3] http://www.markosweb.com/www/xboxhackz.com/ 2218c2ecf20Sopenharmony_ci.. [4] https://elixir.bootlin.com/linux/latest/ident/xpad_device 2228c2ecf20Sopenharmony_ci 2238c2ecf20Sopenharmony_ci 2248c2ecf20Sopenharmony_ciHistoric Edits 2258c2ecf20Sopenharmony_ci============== 2268c2ecf20Sopenharmony_ci 2278c2ecf20Sopenharmony_ci2002-07-16 - Marko Friedemann <mfr@bmx-chemnitz.de> 2288c2ecf20Sopenharmony_ci - original doc 2298c2ecf20Sopenharmony_ci 2308c2ecf20Sopenharmony_ci2005-03-19 - Dominic Cerquetti <binary1230@yahoo.com> 2318c2ecf20Sopenharmony_ci - added stuff for dance pads, new d-pad->axes mappings 2328c2ecf20Sopenharmony_ci 2338c2ecf20Sopenharmony_ciLater changes may be viewed with 2348c2ecf20Sopenharmony_ci'git log --follow Documentation/input/devices/xpad.rst' 235