URL
https://opencores.org/ocsvn/test_project/test_project/trunk
Subversion Repositories test_project
[/] [test_project/] [trunk/] [linux_sd_driver/] [Documentation/] [input/] [joystick.txt] - Rev 78
Go to most recent revision | Compare with Previous | Blame | View Log
Linux Joystick driver v2.0.0(c) 1996-2000 Vojtech Pavlik <vojtech@ucw.cz>Sponsored by SuSE$Id: joystick.txt,v 1.12 2002/03/03 12:13:07 jdeneux Exp $----------------------------------------------------------------------------0. Disclaimer~~~~~~~~~~~~~This program is free software; you can redistribute it and/or modify itunder the terms of the GNU General Public License as published by the FreeSoftware Foundation; either version 2 of the License, or (at your option)any later version.This program is distributed in the hope that it will be useful, butWITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITYor FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License formore details.You should have received a copy of the GNU General Public License alongwith this program; if not, write to the Free Software Foundation, Inc., 59Temple Place, Suite 330, Boston, MA 02111-1307 USAShould you need to contact me, the author, you can do so either by e-mail- mail your message to <vojtech@ucw.cz>, or by paper mail: Vojtech Pavlik,Simunkova 1594, Prague 8, 182 00 Czech RepublicFor your convenience, the GNU General Public License version 2 is includedin the package: See the file COPYING.1. Intro~~~~~~~~The joystick driver for Linux provides support for a variety of joysticksand similar devices. It is based on a larger project aiming to support allinput devices in Linux.Should you encounter any problems while using the driver, or joysticksthis driver can't make complete use of, I'm very interested in hearing aboutthem. Bug reports and success stories are also welcome.The input project website is at:http://atrey.karlin.mff.cuni.cz/~vojtech/input/There is also a mailing list for the driver at:listproc@atrey.karlin.mff.cuni.czsend "subscribe linux-joystick Your Name" to subscribe to it.2. Usage~~~~~~~~For basic usage you just choose the right options in kernel config andyou should be set.2.1 inpututils~~~~~~~~~~~~~~For testing and other purposes (for example serial devices), a set ofutilities is available at the abovementioned website. I suggest you downloadand install it before going on.2.2 Device nodes~~~~~~~~~~~~~~~~For applications to be able to use the joysticks,you'll have to manually create these nodes in /dev:cd /devrm js*mkdir inputmknod input/js0 c 13 0mknod input/js1 c 13 1mknod input/js2 c 13 2mknod input/js3 c 13 3ln -s input/js0 js0ln -s input/js1 js1ln -s input/js2 js2ln -s input/js3 js3For testing with inpututils it's also convenient to create these:mknod input/event0 c 13 64mknod input/event1 c 13 65mknod input/event2 c 13 66mknod input/event3 c 13 672.4 Modules needed~~~~~~~~~~~~~~~~~~For all joystick drivers to function, you'll need the userland interfacemodule in kernel, either loaded or compiled in:modprobe joydevFor gameport joysticks, you'll have to load the gameport driver as well;modprobe ns558And for serial port joysticks, you'll need the serial input linediscipline module loaded and the inputattach utility started:modprobe serportinputattach -xxx /dev/tts/X &In addition to that, you'll need the joystick driver module itself, mostusually you'll have an analog joystick:modprobe analogFor automatic module loading, something like this might work - tailor toyour needs:alias tty-ldisc-2 serportalias char-major-13 inputabove input joydev ns558 analogoptions analog map=gamepad,none,2btn2.5 Verifying that it works~~~~~~~~~~~~~~~~~~~~~~~~~~~For testing the joystick driver functionality, there is the jstestprogram in the utilities package. You run it by typing:jstest /dev/js0And it should show a line with the joystick values, which update as youmove the stick, and press its buttons. The axes should all be zero when thejoystick is in the center position. They should not jitter by themselves toother close values, and they also should be steady in any other position ofthe stick. They should have the full range from -32767 to 32767. If all thisis met, then it's all fine, and you can play the games. :)If it's not, then there might be a problem. Try to calibrate the joystick,and if it still doesn't work, read the drivers section of this file, thetroubleshooting section, and the FAQ.2.6. Calibration~~~~~~~~~~~~~~~~For most joysticks you won't need any manual calibration, since thejoystick should be autocalibrated by the driver automagically. However, withsome analog joysticks, that either do not use linear resistors, or if youwant better precision, you can use the jscal programjscal -c /dev/js0included in the joystick package to set better correction coefficients thanwhat the driver would choose itself.After calibrating the joystick you can verify if you like the newcalibration using the jstest command, and if you do, you then can save thecorrection coefficients into a filejscal -p /dev/js0 > /etc/joystick.calAnd add a line to your rc script executing that filesource /etc/joystick.calThis way, after the next reboot your joystick will remain calibrated. Youcan also add the jscal -p line to your shutdown script.3. HW specific driver information~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~In this section each of the separate hardware specific drivers is described.3.1 Analog joysticks~~~~~~~~~~~~~~~~~~~~The analog.c uses the standard analog inputs of the gameport, and thussupports all standard joysticks and gamepads. It uses a very advancedroutine for this, allowing for data precision that can't be found on anyother system.It also supports extensions like additional hats and buttons compatiblewith CH Flightstick Pro, ThrustMaster FCS or 6 and 8 button gamepads. SaitekCyborg 'digital' joysticks are also supported by this driver, becausethey're basically souped up CHF sticks.However the only types that can be autodetected are:* 2-axis, 4-button joystick* 3-axis, 4-button joystick* 4-axis, 4-button joystick* Saitek Cyborg 'digital' joysticksFor other joystick types (more/less axes, hats, and buttons) supportyou'll need to specify the types either on the kernel command line or on themodule command line, when inserting analog into the kernel. Theparameters are:analog.map=<type1>,<type2>,<type3>,....'type' is type of the joystick from the table below, defining joystickspresent on gameports in the system, starting with gameport0, second 'type'entry defining joystick on gameport1 and so on.Type | Meaning-----------------------------------none | No analog joystick on that portauto | Autodetect joystick2btn | 2-button n-axis joysticky-joy | Two 2-button 2-axis joysticks on an Y-cabley-pad | Two 2-button 2-axis gamepads on an Y-cablefcs | Thrustmaster FCS compatible joystickchf | Joystick with a CH Flightstick compatible hatfullchf | CH Flightstick compatible with two hats and 6 buttonsgamepad | 4/6-button n-axis gamepadgamepad8 | 8-button 2-axis gamepadIn case your joystick doesn't fit in any of the above categories, you canspecify the type as a number by combining the bits in the table below. Thisis not recommended unless you really know what are you doing. It's notdangerous, but not simple either.Bit | Meaning--------------------------0 | Axis X11 | Axis Y12 | Axis X23 | Axis Y24 | Button A5 | Button B6 | Button C7 | Button D8 | CHF Buttons X and Y9 | CHF Hat 110 | CHF Hat 211 | FCS Hat12 | Pad Button X13 | Pad Button Y14 | Pad Button U15 | Pad Button V16 | Saitek F1-F4 Buttons17 | Saitek Digital Mode19 | GamePad20 | Joy2 Axis X121 | Joy2 Axis Y122 | Joy2 Axis X223 | Joy2 Axis Y224 | Joy2 Button A25 | Joy2 Button B26 | Joy2 Button C27 | Joy2 Button D31 | Joy2 GamePad3.2 Microsoft SideWinder joysticks~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Microsoft 'Digital Overdrive' protocol is supported by the sidewinder.cmodule. All currently supported joysticks:* Microsoft SideWinder 3D Pro* Microsoft SideWinder Force Feedback Pro* Microsoft SideWinder Force Feedback Wheel* Microsoft SideWinder FreeStyle Pro* Microsoft SideWinder GamePad (up to four, chained)* Microsoft SideWinder Precision Pro* Microsoft SideWinder Precision Pro USBare autodetected, and thus no module parameters are needed.There is one caveat with the 3D Pro. There are 9 buttons reported,although the joystick has only 8. The 9th button is the mode switch on therear side of the joystick. However, moving it, you'll reset the joystick,and make it unresponsive for about a one third of a second. Furthermore, thejoystick will also re-center itself, taking the position it was in duringthis time as a new center position. Use it if you want, but think first.The SideWinder Standard is not a digital joystick, and thus is supportedby the analog driver described above.3.3 Logitech ADI devices~~~~~~~~~~~~~~~~~~~~~~~~Logitech ADI protocol is supported by the adi.c module. It should supportany Logitech device using this protocol. This includes, but is not limitedto:* Logitech CyberMan 2* Logitech ThunderPad Digital* Logitech WingMan Extreme Digital* Logitech WingMan Formula* Logitech WingMan Interceptor* Logitech WingMan GamePad* Logitech WingMan GamePad USB* Logitech WingMan GamePad Extreme* Logitech WingMan Extreme Digital 3DADI devices are autodetected, and the driver supports up to two (anycombination of) devices on a single gameport, using an Y-cable or chainedtogether.Logitech WingMan Joystick, Logitech WingMan Attack, Logitech WingManExtreme and Logitech WingMan ThunderPad are not digital joysticks and arehandled by the analog driver described above. Logitech WingMan Warrior andLogitech Magellan are supported by serial drivers described below. LogitechWingMan Force and Logitech WingMan Formula Force are supported by theI-Force driver described below. Logitech CyberMan is not supported yet.3.4 Gravis GrIP~~~~~~~~~~~~~~~Gravis GrIP protocol is supported by the grip.c module. It currentlysupports:* Gravis GamePad Pro* Gravis BlackHawk Digital* Gravis Xterminator* Gravis Xterminator DualControlAll these devices are autodetected, and you can even use any combinationof up to two of these pads either chained together or using an Y-cable on asingle gameport.GrIP MultiPort isn't supported yet. Gravis Stinger is a serial device and issupported by the stinger driver. Other Gravis joysticks are supported by theanalog driver.3.5 FPGaming A3D and MadCatz A3D~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~The Assassin 3D protocol created by FPGaming, is used both by FPGamingthemselves and is licensed to MadCatz. A3D devices are supported by thea3d.c module. It currently supports:* FPGaming Assassin 3D* MadCatz Panther* MadCatz Panther XLAll these devices are autodetected. Because the Assassin 3D and the Pantherallow connecting analog joysticks to them, you'll need to load the analogdriver as well to handle the attached joysticks.The trackball should work with USB mousedev module as a normal mouse. Seethe USB documentation for how to setup an USB mouse.3.6 ThrustMaster DirectConnect (BSP)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~The TM DirectConnect (BSP) protocol is supported by the tmdc.cmodule. This includes, but is not limited to:* ThrustMaster Millenium 3D Inceptor* ThrustMaster 3D Rage Pad* ThrustMaster Fusion Digital Game PadDevices not directly supported, but hopefully working are:* ThrustMaster FragMaster* ThrustMaster Attack ThrottleIf you have one of these, contact me.TMDC devices are autodetected, and thus no parameters to the moduleare needed. Up to two TMDC devices can be connected to one gameport, usingan Y-cable.3.7 Creative Labs Blaster~~~~~~~~~~~~~~~~~~~~~~~~~The Blaster protocol is supported by the cobra.c module. It supports onlythe:* Creative Blaster GamePad CobraUp to two of these can be used on a single gameport, using an Y-cable.3.8 Genius Digital joysticks~~~~~~~~~~~~~~~~~~~~~~~~~~~~The Genius digitally communicating joysticks are supported by the gf2k.cmodule. This includes:* Genius Flight2000 F-23 joystick* Genius Flight2000 F-31 joystick* Genius G-09D gamepadOther Genius digital joysticks are not supported yet, but support can beadded fairly easily.3.9 InterAct Digital joysticks~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~The InterAct digitally communicating joysticks are supported by theinteract.c module. This includes:* InterAct HammerHead/FX gamepad* InterAct ProPad8 gamepadOther InterAct digital joysticks are not supported yet, but support can beadded fairly easily.3.10 PDPI Lightning 4 gamecards~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~PDPI Lightning 4 gamecards are supported by the lightning.c module.Once the module is loaded, the analog driver can be used to handle thejoysticks. Digitally communicating joystick will work only on port 0, whileusing Y-cables, you can connect up to 8 analog joysticks to a single L4card, 16 in case you have two in your system.3.11 Trident 4DWave / Aureal Vortex~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Soundcards with a Trident 4DWave DX/NX or Aureal Vortex/Vortex2 chipsetsprovide an "Enhanced Game Port" mode where the soundcard handles polling thejoystick. This mode is supported by the pcigame.c module. Once loaded theanalog driver can use the enhanced features of these gameports..3.13 Crystal SoundFusion~~~~~~~~~~~~~~~~~~~~~~~~Soundcards with Crystal SoundFusion chipsets provide an "Enhanced GamePort", much like the 4DWave or Vortex above. This, and also the normal modefor the port of the SoundFusion is supported by the cs461x.c module.3.14 SoundBlaster Live!~~~~~~~~~~~~~~~~~~~~~~~~The Live! has a special PCI gameport, which, although it doesn't provideany "Enhanced" stuff like 4DWave and friends, is quite a bit faster thanit's ISA counterparts. It also requires special support, hence theemu10k1-gp.c module for it instead of the normal ns558.c one.3.15 SoundBlaster 64 and 128 - ES1370 and ES1371, ESS Solo1 and S3 SonicVibes~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~These PCI soundcards have specific gameports. They are handled by thesound drivers themselves. Make sure you select gameport support in thejoystick menu and sound card support in the sound menu for your appropriatecard.3.16 Amiga~~~~~~~~~~Amiga joysticks, connected to an Amiga, are supported by the amijoy.cdriver. Since they can't be autodetected, the driver has a command line.amijoy.map=<a>,<b>a and b define the joysticks connected to the JOY0DAT and JOY1DAT ports ofthe Amiga.Value | Joystick type---------------------0 | None1 | 1-button digital joystickNo more joystick types are supported now, but that should change in thefuture if I get an Amiga in the reach of my fingers.3.17 Game console and 8-bit pads and joysticks~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~See joystick-parport.txt for more info.3.18 SpaceTec/LabTec devices~~~~~~~~~~~~~~~~~~~~~~~~~~~~SpaceTec serial devices communicate using the SpaceWare protocol. It issupported by the spaceorb.c and spaceball.c drivers. The devices currentlysupported by spaceorb.c are:* SpaceTec SpaceBall Avenger* SpaceTec SpaceOrb 360Devices currently supported by spaceball.c are:* SpaceTec SpaceBall 4000 FLXIn addition to having the spaceorb/spaceball and serport modules in thekernel, you also need to attach a serial port to it. to do that, run theinputattach program:inputattach --spaceorb /dev/tts/x &orinputattach --spaceball /dev/tts/x &where /dev/tts/x is the serial port which the device is connected to. Afterdoing this, the device will be reported and will start working.There is one caveat with the SpaceOrb. The button #6, the on the bottomside of the orb, although reported as an ordinary button, causes internalrecentering of the spaceorb, moving the zero point to the position in whichthe ball is at the moment of pressing the button. So, think first beforeyou bind it to some other function.SpaceTec SpaceBall 2003 FLX and 3003 FLX are not supported yet.3.19 Logitech SWIFT devices~~~~~~~~~~~~~~~~~~~~~~~~~~~The SWIFT serial protocol is supported by the warrior.c module. Itcurrently supports only the:* Logitech WingMan Warriorbut in the future, Logitech CyberMan (the original one, not CM2) could besupported as well. To use the module, you need to run inputattach after youinsert/compile the module into your kernel:inputattach --warrior /dev/tts/x &/dev/tts/x is the serial port your Warrior is attached to.3.20 Magellan / Space Mouse~~~~~~~~~~~~~~~~~~~~~~~~~~~The Magellan (or Space Mouse), manufactured by LogiCad3d (formerly SpaceSystems), for many other companies (Logitech, HP, ...) is supported by thejoy-magellan module. It currently supports only the:* Magellan 3D* Space Mousemodels, the additional buttons on the 'Plus' versions are not supported yet.To use it, you need to attach the serial port to the driver using theinputattach --magellan /dev/tts/x &command. After that the Magellan will be detected, initialized, will beep,and the /dev/input/jsX device should become usable.3.21 I-Force devices~~~~~~~~~~~~~~~~~~~~All I-Force devices are supported by the iforce module. This includes:* AVB Mag Turbo Force* AVB Top Shot Pegasus* AVB Top Shot Force Feedback Racing Wheel* Logitech WingMan Force* Logitech WingMan Force Wheel* Guillemot Race Leader Force Feedback* Guillemot Force Feedback Racing Wheel* Thrustmaster Motor Sport GTTo use it, you need to attach the serial port to the driver using theinputattach --iforce /dev/tts/x &command. After that the I-Force device will be detected, and the/dev/input/jsX device should become usable.In case you're using the device via the USB port, the inputattach commandisn't needed.The I-Force driver now supports force feedback via the event interface.Please note that Logitech WingMan *3D devices are _not_ supported by thismodule, rather by hid. Force feedback is not supported for those devices.Logitech gamepads are also hid devices.3.22 Gravis Stinger gamepad~~~~~~~~~~~~~~~~~~~~~~~~~~~The Gravis Stinger serial port gamepad, designed for use with laptopcomputers, is supported by the stinger.c module. To use it, attach theserial port to the driver using:inputattach --stinger /dev/tty/x &where x is the number of the serial port.4. Troubleshooting~~~~~~~~~~~~~~~~~~There is quite a high probability that you run into some problems. Fortesting whether the driver works, if in doubt, use the jstest utility insome of its modes. The most useful modes are "normal" - for the 1.xinterface, and "old" for the "0.x" interface. You run it by typing:jstest --normal /dev/input/js0jstest --old /dev/input/js0Additionally you can do a test with the evtest utility:evtest /dev/input/event0Oh, and read the FAQ! :)5. FAQ~~~~~~Q: Running 'jstest /dev/js0' results in "File not found" error. What's thecause?A: The device files don't exist. Create them (see section 2.2).Q: Is it possible to connect my old Atari/Commodore/Amiga/console joystickor pad that uses a 9-pin D-type cannon connector to the serial port of myPC?A: Yes, it is possible, but it'll burn your serial port or the pad. Itwon't work, of course.Q: My joystick doesn't work with Quake / Quake 2. What's the cause?A: Quake / Quake 2 don't support joystick. Use joy2key to simulate keypressesfor them.6. Programming Interface~~~~~~~~~~~~~~~~~~~~~~~~The 1.0 driver uses a new, event based approach to the joystick driver.Instead of the user program polling for the joystick values, the joystickdriver now reports only any changes of its state. See joystick-api.txt,joystick.h and jstest.c included in the joystick package for moreinformation. The joystick device can be used in either blocking ornonblocking mode and supports select() calls.For backward compatibility the old (v0.x) interface is still included.Any call to the joystick driver using the old interface will return valuesthat are compatible to the old interface. This interface is still limitedto 2 axes, and applications using it usually decode only 2 buttons, althoughthe driver provides up to 32.
Go to most recent revision | Compare with Previous | Blame | View Log
