Input device: Difference between revisions

Jump to navigation Jump to search
1,566 bytes added ,  26 August 2014
→‎Linux: added newer jscal hints, and udev rule example
(Calibration (Linux only))
(→‎Linux: added newer jscal hints, and udev rule example)
Line 190: Line 190:
<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 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>
</syntaxhighlight>
Copy the command you obtained into your startup script in order to restore calibration automatically.  
Copy the command you obtained into your startup script in order to restore calibration automatically.
 
Recent versions of jscal have this simplified, you can store and restore your calibration settings.
After calibration store the settings:
<syntaxhighlight lang="bash">jscal-store /dev/input/js0
</syntaxhighlight>
 
Then in your startup script recall the settings for the given device:
<syntaxhighlight lang="bash">jscal-restore /dev/input/js0
</syntaxhighlight>
 
However if you have multiple "joysticks", they might be renumbered on pluging/repluging. Best way to insure you get the correct calibration is to create a custom '''udev''' rule-set that you put into /etc/udev/rules.d/00-joystick.rules, similar to the following example:
<syntaxhighlight lang="bash">
#joystick rules to make the names persistent and reload the stored calibration profile
ACTION!="add|change", GOTO="joystick_end"
SUBSYSTEM!="input", GOTO="joystick_end"
 
KERNEL=="js*", ATTRS{idProduct}=="a02f", ATTRS{idVendor}=="12bd", SYMLINK+="input/joystick" RUN+="/etc/udev/scripts/joycal.sh"
KERNEL=="js*", ATTRS{name}=="Logitech Logitech Racing Wheel", SYMLINK+="input/logiwheel" RUN+="/etc/udev/scripts/wheelcal.sh"
 
LABEL="joystick_end"
</syntaxhighlight>
 
Then the scripts called would be as follows:
*/etc/udev/scripts/joycal.sh:
<syntaxhighlight lang="bash">
#!/bin/sh
jscal-restore /dev/input/joystick
</syntaxhighlight>
*/etc/udev/scripts/wheelcal.sh
<syntaxhighlight lang="bash">
#!/bin/sh
jscal-restore /dev/input/logiwheel
</syntaxhighlight>
 
Now each time you plug/replug your joysticks they will get the persistent device names, and will get the correct calibration profile restored.
 


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.
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.
422

edits

Navigation menu