Calibrating a controller on Linux
#1
Hi all,
After many frustrations about having to constantly recalibrate my controller (Graupner MZ-12 via a cheap HobbyKing's wireless 9 in 1 adapter in wired mode), I wanted to explain how I solved the issue.
First, you need the jstest and jscal utilities (in Fedora these are in the linuxconsoletools package), or alternately there's a graphical version of jstest (jstest-gtk or similar).
Find your joystick device:
2
$ ls /dev/input/
by-id by-path event0 event1 event10 event11 event12 event13 event14 event15 event16 event17 event18 event19 event2 event3 event4 event5 event6 event7 event8 event9 js0 mice mouse0
It looks like /dev/input/js0 is my joystick. Lets test it:
2
3
4
5
6
$ jstest /dev/input/js0
Driver version is 2.1.0.
Joystick (FeiYing Model SAILI Simulator - G6 Controller) has 6 axes (X, Y, Z, Rx, Ry, (null))
and 5 buttons (Trigger, ThumbBtn, ThumbBtn2, TopBtn, TopBtn2).
Testing ... (interrupt to exit)
Axes: 0: -5958 1: 0 2: 0 3: 32766 4: 0 5: 0 Buttons: 0:off 1:off 2:off 3:off 4:off ^C
Move the sticks. The values should vary between -32768 and 32767, with the sticks centered at 0 (well, approximately). If this is the case then you're done (press Ctrl+C to quit the test app), otherwise you need to calibrate.
2
$ jscal /dev/input/js0
...
Do as the program says (it may want you to hold the sticks in position for a couple of seconds sometimes to estimate jitter). Afterwards, run jstest again to test that you get the correct values out. If you do... great, fire up neXt, do neXt's calibration (you shouldn't need to repeat this), and go fly.
... except, you want to make the calibration persistant, right? While the calibration is still correct, run jscal-store (sudo for root). [Note: this may not be available on all distros; see below.]
$ sudo jscal-store /dev/input/js0
Now, whenever you reconnect the transmitter/adapter, you'll still need to restore the calibration, but it's easy:
$ jscal-restore /dev/input/js0
It should be possible to restore the calibration automatically [apparently this is done for you on Debian] with something like the following udev rule; however it doesn't work for me. You can find suitable ATTRS to identify your device via "udevadm info --attribute-walk /dev/input/js0".
2
$ cat /etc/udev/rules.d/91-tx.rules
SUBSYSTEM=="input", ATTRS{idVendor}=="1781", ACTION=="add", RUN+="/usr/bin/jscal-restore"
Note: this was tested on Fedora 21. On Debian-based distros it should be similar (except that apparently jscal-restore is automated). On Arch it looks a little different according to the wiki.
#2
Update: I noticed that the jscal calibration leaves quite large dead-zones, which makes flying horrible (no precision with the sticks close to center).
Instead, use jstest-gtk to do the calibration (jscal-store etc. as before). It lets you adjust the calibration manually so you can check there are no dead-zones. [If jstest-gtk is not available as a package, you can download the source from github and compile it yourself; it's pretty easy:]
2
3
4
sudo yum install git scons gtkmm24-devel
git clone https://github.com/Grumbel/jstest-gtk.git
scons
./jstest-gtk
I also noticed that output from the HobbyKing wireless adapter was very jittery in wireless mode. It's much better wired.
- neXt - CGM RC Flight Simulator - English
- News: neXt - CGM RC Flight Simulator
- FAQ
- Feature Suggestions
- Model Setups
- neXt - CGM RC Flight Simulator - Deutsch
- Neuigkeiten: neXt - CGM RC Flight Simulator
- Fragen und Antworten zum neXt
- Gewünschte Funktionen
- Modell Setups
- Verschiedenes
- Marktplatz: Kaufen und Verkaufen
- Align
- FBL-Systeme
- Blade
- Advertising
Related topics
Register now!
Sign up now!