joystick.rst 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586
  1. .. include:: <isonum.txt>
  2. .. _joystick-doc:
  3. Introduction
  4. ============
  5. The joystick driver for Linux provides support for a variety of joysticks
  6. and similar devices. It is based on a larger project aiming to support all
  7. input devices in Linux.
  8. The mailing list for the project is:
  9. [email protected]
  10. send "subscribe linux-input" to [email protected] to subscribe to it.
  11. Usage
  12. =====
  13. For basic usage you just choose the right options in kernel config and
  14. you should be set.
  15. Utilities
  16. ---------
  17. For testing and other purposes (for example serial devices), there is a set
  18. of utilities, such as ``jstest``, ``jscal``, and ``evtest``,
  19. usually packaged as ``joystick``, ``input-utils``, ``evtest``, and so on.
  20. ``inputattach`` utility is required if your joystick is connected to a
  21. serial port.
  22. Device nodes
  23. ------------
  24. For applications to be able to use the joysticks, device nodes should be
  25. created in /dev. Normally it is done automatically by the system, but
  26. it can also be done by hand::
  27. cd /dev
  28. rm js*
  29. mkdir input
  30. mknod input/js0 c 13 0
  31. mknod input/js1 c 13 1
  32. mknod input/js2 c 13 2
  33. mknod input/js3 c 13 3
  34. ln -s input/js0 js0
  35. ln -s input/js1 js1
  36. ln -s input/js2 js2
  37. ln -s input/js3 js3
  38. For testing with inpututils it's also convenient to create these::
  39. mknod input/event0 c 13 64
  40. mknod input/event1 c 13 65
  41. mknod input/event2 c 13 66
  42. mknod input/event3 c 13 67
  43. Modules needed
  44. --------------
  45. For all joystick drivers to function, you'll need the userland interface
  46. module in kernel, either loaded or compiled in::
  47. modprobe joydev
  48. For gameport joysticks, you'll have to load the gameport driver as well::
  49. modprobe ns558
  50. And for serial port joysticks, you'll need the serial input line
  51. discipline module loaded and the inputattach utility started::
  52. modprobe serport
  53. inputattach -xxx /dev/tts/X &
  54. In addition to that, you'll need the joystick driver module itself, most
  55. usually you'll have an analog joystick::
  56. modprobe analog
  57. For automatic module loading, something like this might work - tailor to
  58. your needs::
  59. alias tty-ldisc-2 serport
  60. alias char-major-13 input
  61. above input joydev ns558 analog
  62. options analog map=gamepad,none,2btn
  63. Verifying that it works
  64. -----------------------
  65. For testing the joystick driver functionality, there is the jstest
  66. program in the utilities package. You run it by typing::
  67. jstest /dev/input/js0
  68. And it should show a line with the joystick values, which update as you
  69. move the stick, and press its buttons. The axes should all be zero when the
  70. joystick is in the center position. They should not jitter by themselves to
  71. other close values, and they also should be steady in any other position of
  72. the stick. They should have the full range from -32767 to 32767. If all this
  73. is met, then it's all fine, and you can play the games. :)
  74. If it's not, then there might be a problem. Try to calibrate the joystick,
  75. and if it still doesn't work, read the drivers section of this file, the
  76. troubleshooting section, and the FAQ.
  77. Calibration
  78. -----------
  79. For most joysticks you won't need any manual calibration, since the
  80. joystick should be autocalibrated by the driver automagically. However, with
  81. some analog joysticks, that either do not use linear resistors, or if you
  82. want better precision, you can use the jscal program::
  83. jscal -c /dev/input/js0
  84. included in the joystick package to set better correction coefficients than
  85. what the driver would choose itself.
  86. After calibrating the joystick you can verify if you like the new
  87. calibration using the jstest command, and if you do, you then can save the
  88. correction coefficients into a file::
  89. jscal -p /dev/input/js0 > /etc/joystick.cal
  90. And add a line to your rc script executing that file::
  91. source /etc/joystick.cal
  92. This way, after the next reboot your joystick will remain calibrated. You
  93. can also add the ``jscal -p`` line to your shutdown script.
  94. Hardware-specific driver information
  95. ====================================
  96. In this section each of the separate hardware specific drivers is described.
  97. Analog joysticks
  98. ----------------
  99. The analog.c driver uses the standard analog inputs of the gameport, and thus
  100. supports all standard joysticks and gamepads. It uses a very advanced
  101. routine for this, allowing for data precision that can't be found on any
  102. other system.
  103. It also supports extensions like additional hats and buttons compatible
  104. with CH Flightstick Pro, ThrustMaster FCS or 6 and 8 button gamepads. Saitek
  105. Cyborg 'digital' joysticks are also supported by this driver, because
  106. they're basically souped up CHF sticks.
  107. However the only types that can be autodetected are:
  108. * 2-axis, 4-button joystick
  109. * 3-axis, 4-button joystick
  110. * 4-axis, 4-button joystick
  111. * Saitek Cyborg 'digital' joysticks
  112. For other joystick types (more/less axes, hats, and buttons) support
  113. you'll need to specify the types either on the kernel command line or on the
  114. module command line, when inserting analog into the kernel. The
  115. parameters are::
  116. analog.map=<type1>,<type2>,<type3>,....
  117. 'type' is type of the joystick from the table below, defining joysticks
  118. present on gameports in the system, starting with gameport0, second 'type'
  119. entry defining joystick on gameport1 and so on.
  120. ========= =====================================================
  121. Type Meaning
  122. ========= =====================================================
  123. none No analog joystick on that port
  124. auto Autodetect joystick
  125. 2btn 2-button n-axis joystick
  126. y-joy Two 2-button 2-axis joysticks on an Y-cable
  127. y-pad Two 2-button 2-axis gamepads on an Y-cable
  128. fcs Thrustmaster FCS compatible joystick
  129. chf Joystick with a CH Flightstick compatible hat
  130. fullchf CH Flightstick compatible with two hats and 6 buttons
  131. gamepad 4/6-button n-axis gamepad
  132. gamepad8 8-button 2-axis gamepad
  133. ========= =====================================================
  134. In case your joystick doesn't fit in any of the above categories, you can
  135. specify the type as a number by combining the bits in the table below. This
  136. is not recommended unless you really know what are you doing. It's not
  137. dangerous, but not simple either.
  138. ==== =========================
  139. Bit Meaning
  140. ==== =========================
  141. 0 Axis X1
  142. 1 Axis Y1
  143. 2 Axis X2
  144. 3 Axis Y2
  145. 4 Button A
  146. 5 Button B
  147. 6 Button C
  148. 7 Button D
  149. 8 CHF Buttons X and Y
  150. 9 CHF Hat 1
  151. 10 CHF Hat 2
  152. 11 FCS Hat
  153. 12 Pad Button X
  154. 13 Pad Button Y
  155. 14 Pad Button U
  156. 15 Pad Button V
  157. 16 Saitek F1-F4 Buttons
  158. 17 Saitek Digital Mode
  159. 19 GamePad
  160. 20 Joy2 Axis X1
  161. 21 Joy2 Axis Y1
  162. 22 Joy2 Axis X2
  163. 23 Joy2 Axis Y2
  164. 24 Joy2 Button A
  165. 25 Joy2 Button B
  166. 26 Joy2 Button C
  167. 27 Joy2 Button D
  168. 31 Joy2 GamePad
  169. ==== =========================
  170. Microsoft SideWinder joysticks
  171. ------------------------------
  172. Microsoft 'Digital Overdrive' protocol is supported by the sidewinder.c
  173. module. All currently supported joysticks:
  174. * Microsoft SideWinder 3D Pro
  175. * Microsoft SideWinder Force Feedback Pro
  176. * Microsoft SideWinder Force Feedback Wheel
  177. * Microsoft SideWinder FreeStyle Pro
  178. * Microsoft SideWinder GamePad (up to four, chained)
  179. * Microsoft SideWinder Precision Pro
  180. * Microsoft SideWinder Precision Pro USB
  181. are autodetected, and thus no module parameters are needed.
  182. There is one caveat with the 3D Pro. There are 9 buttons reported,
  183. although the joystick has only 8. The 9th button is the mode switch on the
  184. rear side of the joystick. However, moving it, you'll reset the joystick,
  185. and make it unresponsive for about a one third of a second. Furthermore, the
  186. joystick will also re-center itself, taking the position it was in during
  187. this time as a new center position. Use it if you want, but think first.
  188. The SideWinder Standard is not a digital joystick, and thus is supported
  189. by the analog driver described above.
  190. Logitech ADI devices
  191. --------------------
  192. Logitech ADI protocol is supported by the adi.c module. It should support
  193. any Logitech device using this protocol. This includes, but is not limited
  194. to:
  195. * Logitech CyberMan 2
  196. * Logitech ThunderPad Digital
  197. * Logitech WingMan Extreme Digital
  198. * Logitech WingMan Formula
  199. * Logitech WingMan Interceptor
  200. * Logitech WingMan GamePad
  201. * Logitech WingMan GamePad USB
  202. * Logitech WingMan GamePad Extreme
  203. * Logitech WingMan Extreme Digital 3D
  204. ADI devices are autodetected, and the driver supports up to two (any
  205. combination of) devices on a single gameport, using a Y-cable or chained
  206. together.
  207. Logitech WingMan Joystick, Logitech WingMan Attack, Logitech WingMan
  208. Extreme and Logitech WingMan ThunderPad are not digital joysticks and are
  209. handled by the analog driver described above. Logitech WingMan Warrior and
  210. Logitech Magellan are supported by serial drivers described below. Logitech
  211. WingMan Force and Logitech WingMan Formula Force are supported by the
  212. I-Force driver described below. Logitech CyberMan is not supported yet.
  213. Gravis GrIP
  214. -----------
  215. Gravis GrIP protocol is supported by the grip.c module. It currently
  216. supports:
  217. * Gravis GamePad Pro
  218. * Gravis BlackHawk Digital
  219. * Gravis Xterminator
  220. * Gravis Xterminator DualControl
  221. All these devices are autodetected, and you can even use any combination
  222. of up to two of these pads either chained together or using a Y-cable on a
  223. single gameport.
  224. GrIP MultiPort isn't supported yet. Gravis Stinger is a serial device and is
  225. supported by the stinger driver. Other Gravis joysticks are supported by the
  226. analog driver.
  227. FPGaming A3D and MadCatz A3D
  228. ----------------------------
  229. The Assassin 3D protocol created by FPGaming, is used both by FPGaming
  230. themselves and is licensed to MadCatz. A3D devices are supported by the
  231. a3d.c module. It currently supports:
  232. * FPGaming Assassin 3D
  233. * MadCatz Panther
  234. * MadCatz Panther XL
  235. All these devices are autodetected. Because the Assassin 3D and the Panther
  236. allow connecting analog joysticks to them, you'll need to load the analog
  237. driver as well to handle the attached joysticks.
  238. The trackball should work with USB mousedev module as a normal mouse. See
  239. the USB documentation for how to setup a USB mouse.
  240. ThrustMaster DirectConnect (BSP)
  241. --------------------------------
  242. The TM DirectConnect (BSP) protocol is supported by the tmdc.c
  243. module. This includes, but is not limited to:
  244. * ThrustMaster Millennium 3D Interceptor
  245. * ThrustMaster 3D Rage Pad
  246. * ThrustMaster Fusion Digital Game Pad
  247. Devices not directly supported, but hopefully working are:
  248. * ThrustMaster FragMaster
  249. * ThrustMaster Attack Throttle
  250. If you have one of these, contact me.
  251. TMDC devices are autodetected, and thus no parameters to the module
  252. are needed. Up to two TMDC devices can be connected to one gameport, using
  253. a Y-cable.
  254. Creative Labs Blaster
  255. ---------------------
  256. The Blaster protocol is supported by the cobra.c module. It supports only
  257. the:
  258. * Creative Blaster GamePad Cobra
  259. Up to two of these can be used on a single gameport, using a Y-cable.
  260. Genius Digital joysticks
  261. ------------------------
  262. The Genius digitally communicating joysticks are supported by the gf2k.c
  263. module. This includes:
  264. * Genius Flight2000 F-23 joystick
  265. * Genius Flight2000 F-31 joystick
  266. * Genius G-09D gamepad
  267. Other Genius digital joysticks are not supported yet, but support can be
  268. added fairly easily.
  269. InterAct Digital joysticks
  270. --------------------------
  271. The InterAct digitally communicating joysticks are supported by the
  272. interact.c module. This includes:
  273. * InterAct HammerHead/FX gamepad
  274. * InterAct ProPad8 gamepad
  275. Other InterAct digital joysticks are not supported yet, but support can be
  276. added fairly easily.
  277. PDPI Lightning 4 gamecards
  278. --------------------------
  279. PDPI Lightning 4 gamecards are supported by the lightning.c module.
  280. Once the module is loaded, the analog driver can be used to handle the
  281. joysticks. Digitally communicating joystick will work only on port 0, while
  282. using Y-cables, you can connect up to 8 analog joysticks to a single L4
  283. card, 16 in case you have two in your system.
  284. Trident 4DWave / Aureal Vortex
  285. ------------------------------
  286. Soundcards with a Trident 4DWave DX/NX or Aureal Vortex/Vortex2 chipset
  287. provide an "Enhanced Game Port" mode where the soundcard handles polling the
  288. joystick. This mode is supported by the pcigame.c module. Once loaded the
  289. analog driver can use the enhanced features of these gameports..
  290. Crystal SoundFusion
  291. -------------------
  292. Soundcards with Crystal SoundFusion chipsets provide an "Enhanced Game
  293. Port", much like the 4DWave or Vortex above. This, and also the normal mode
  294. for the port of the SoundFusion is supported by the cs461x.c module.
  295. SoundBlaster Live!
  296. ------------------
  297. The Live! has a special PCI gameport, which, although it doesn't provide
  298. any "Enhanced" stuff like 4DWave and friends, is quite a bit faster than
  299. its ISA counterparts. It also requires special support, hence the
  300. emu10k1-gp.c module for it instead of the normal ns558.c one.
  301. SoundBlaster 64 and 128 - ES1370 and ES1371, ESS Solo1 and S3 SonicVibes
  302. ------------------------------------------------------------------------
  303. These PCI soundcards have specific gameports. They are handled by the
  304. sound drivers themselves. Make sure you select gameport support in the
  305. joystick menu and sound card support in the sound menu for your appropriate
  306. card.
  307. Amiga
  308. -----
  309. Amiga joysticks, connected to an Amiga, are supported by the amijoy.c
  310. driver. Since they can't be autodetected, the driver has a command line:
  311. amijoy.map=<a>,<b>
  312. a and b define the joysticks connected to the JOY0DAT and JOY1DAT ports of
  313. the Amiga.
  314. ====== ===========================
  315. Value Joystick type
  316. ====== ===========================
  317. 0 None
  318. 1 1-button digital joystick
  319. ====== ===========================
  320. No more joystick types are supported now, but that should change in the
  321. future if I get an Amiga in the reach of my fingers.
  322. Game console and 8-bit pads and joysticks
  323. -----------------------------------------
  324. These pads and joysticks are not designed for PCs and other computers
  325. Linux runs on, and usually require a special connector for attaching
  326. them through a parallel port.
  327. See :ref:`joystick-parport` for more info.
  328. SpaceTec/LabTec devices
  329. -----------------------
  330. SpaceTec serial devices communicate using the SpaceWare protocol. It is
  331. supported by the spaceorb.c and spaceball.c drivers. The devices currently
  332. supported by spaceorb.c are:
  333. * SpaceTec SpaceBall Avenger
  334. * SpaceTec SpaceOrb 360
  335. Devices currently supported by spaceball.c are:
  336. * SpaceTec SpaceBall 4000 FLX
  337. In addition to having the spaceorb/spaceball and serport modules in the
  338. kernel, you also need to attach a serial port to it. To do that, run the
  339. inputattach program::
  340. inputattach --spaceorb /dev/tts/x &
  341. or::
  342. inputattach --spaceball /dev/tts/x &
  343. where /dev/tts/x is the serial port which the device is connected to. After
  344. doing this, the device will be reported and will start working.
  345. There is one caveat with the SpaceOrb. The button #6, the one on the bottom
  346. side of the orb, although reported as an ordinary button, causes internal
  347. recentering of the spaceorb, moving the zero point to the position in which
  348. the ball is at the moment of pressing the button. So, think first before
  349. you bind it to some other function.
  350. SpaceTec SpaceBall 2003 FLX and 3003 FLX are not supported yet.
  351. Logitech SWIFT devices
  352. ----------------------
  353. The SWIFT serial protocol is supported by the warrior.c module. It
  354. currently supports only the:
  355. * Logitech WingMan Warrior
  356. but in the future, Logitech CyberMan (the original one, not CM2) could be
  357. supported as well. To use the module, you need to run inputattach after you
  358. insert/compile the module into your kernel::
  359. inputattach --warrior /dev/tts/x &
  360. /dev/tts/x is the serial port your Warrior is attached to.
  361. Magellan / Space Mouse
  362. ----------------------
  363. The Magellan (or Space Mouse), manufactured by LogiCad3d (formerly Space
  364. Systems), for many other companies (Logitech, HP, ...) is supported by the
  365. joy-magellan module. It currently supports only the:
  366. * Magellan 3D
  367. * Space Mouse
  368. models; the additional buttons on the 'Plus' versions are not supported yet.
  369. To use it, you need to attach the serial port to the driver using the::
  370. inputattach --magellan /dev/tts/x &
  371. command. After that the Magellan will be detected, initialized, will beep,
  372. and the /dev/input/jsX device should become usable.
  373. I-Force devices
  374. ---------------
  375. All I-Force devices are supported by the iforce module. This includes:
  376. * AVB Mag Turbo Force
  377. * AVB Top Shot Pegasus
  378. * AVB Top Shot Force Feedback Racing Wheel
  379. * Boeder Force Feedback Wheel
  380. * Logitech WingMan Force
  381. * Logitech WingMan Force Wheel
  382. * Guillemot Race Leader Force Feedback
  383. * Guillemot Force Feedback Racing Wheel
  384. * Thrustmaster Motor Sport GT
  385. To use it, you need to attach the serial port to the driver using the::
  386. inputattach --iforce /dev/tts/x &
  387. command. After that the I-Force device will be detected, and the
  388. /dev/input/jsX device should become usable.
  389. In case you're using the device via the USB port, the inputattach command
  390. isn't needed.
  391. The I-Force driver now supports force feedback via the event interface.
  392. Please note that Logitech WingMan 3D devices are _not_ supported by this
  393. module, rather by hid. Force feedback is not supported for those devices.
  394. Logitech gamepads are also hid devices.
  395. Gravis Stinger gamepad
  396. ----------------------
  397. The Gravis Stinger serial port gamepad, designed for use with laptop
  398. computers, is supported by the stinger.c module. To use it, attach the
  399. serial port to the driver using::
  400. inputattach --stinger /dev/tty/x &
  401. where x is the number of the serial port.
  402. Troubleshooting
  403. ===============
  404. There is quite a high probability that you run into some problems. For
  405. testing whether the driver works, if in doubt, use the jstest utility in
  406. some of its modes. The most useful modes are "normal" - for the 1.x
  407. interface, and "old" for the "0.x" interface. You run it by typing::
  408. jstest --normal /dev/input/js0
  409. jstest --old /dev/input/js0
  410. Additionally you can do a test with the evtest utility::
  411. evtest /dev/input/event0
  412. Oh, and read the FAQ! :)
  413. FAQ
  414. ===
  415. :Q: Running 'jstest /dev/input/js0' results in "File not found" error. What's the
  416. cause?
  417. :A: The device files don't exist. Create them (see section 2.2).
  418. :Q: Is it possible to connect my old Atari/Commodore/Amiga/console joystick
  419. or pad that uses a 9-pin D-type Cannon connector to the serial port of my
  420. PC?
  421. :A: Yes, it is possible, but it'll burn your serial port or the pad. It
  422. won't work, of course.
  423. :Q: My joystick doesn't work with Quake / Quake 2. What's the cause?
  424. :A: Quake / Quake 2 don't support joystick. Use joy2key to simulate keypresses
  425. for them.