Input device: Difference between revisions

Jump to navigation Jump to search
2,371 bytes added ,  25 August 2014
Calibration (Linux only)
(Calibration (Linux only))
Line 173: Line 173:


When you move any control, the numbers change after the axis number corresponding to that moving control and when you depress any button, the “off” after the button number corresponding to the button pressed changes to “on”. In this way, you can quickly write down the axes numbers and button numbers for each function without messing with binary.
When you move any control, the numbers change after the axis number corresponding to that moving control and when you depress any button, the “off” after the button number corresponding to the button pressed changes to “on”. In this way, you can quickly write down the axes numbers and button numbers for each function without messing with binary.
In most modern repositories, there is a graphical version of this program, called "jstest-gtk", where you are given a list of attached devices to choose from, and then get a graphical representation of all axes and buttons.
=== Calibration ===
For many/most joysticks this step might not be necessary.  If either, the centre position of the joystick does not yield near-zero values for relevant axes, or if the maximum value for an axis cannot be reached, or is reached too early, you need to calibrate the joystick. (Note that some calibration problems can be fixed with the flighgear joystick configuration files, but not all, e.g. if the maximum value is reached too early)
==== Linux ====
The program "jscal" (install from repositories if not already available on your system) provides a calibration routine for joysticks.  You need to know or find out the device name of your joystick (usually /dev/js0  or /dev/input/js0 - instead of 0 a different number might need to be used, look at output of js_demo to figure out which). For example to calibrate the joystick with device name /dev/input/js0, execute
<syntaxhighlight lang="bash">jscal -c /dev/input/js0
</syntaxhighlight>
and follow instructions.
The calibration is retained until the joystick is unplugged, or the computer rebooted.  In order to save it for future use, execute
<syntaxhighlight lang="bash">jscal -p /dev/input/js0
</syntaxhighlight>
which will print the command that needs to be entered to restore the calibration, for example
<syntaxhighlight lang="bash">jscal -s 6,1,0,8171,8171,65936,65374,1,0,8166,8166,65928,65494,1,0,128,128,4194176,4227201,1,0,128,128,4194176,4227201,1,0,0,0,536854528,536854528,1,0,0,0,536854528,536854528 /dev/input/js0
</syntaxhighlight>
Copy the command you obtained into your startup script in order to restore calibration automatically.
The calibration is even more comfortable using the program "jstest-gtk", also available from most repositories. Starting this you are given a list of all attached joysticks with their device names. Pick the one you wish to inspect or calibrate and click 'Properties', then calibrate.  This calibration tool offers the possibility to fine-tune the calibration by editing the numbers. The program manipulates the same internals as jscal so you can use jscal to save the calibration information for later use, as before.


=== Writing or editing joystick binding xml files ===
=== Writing or editing joystick binding xml files ===
31

edits

Navigation menu