Joystick problems (Linux)

From Elite Wiki
Revision as of 05:08, 30 September 2015 by Diziet Sma (talk | contribs) (Overview)

Overview

Generally speaking, Linux is quite good with joystick detection and support, but sometimes things can go wrong. Failing to detect a joystick at all is extremely uncommon, and most problems revolve around button detection/assignment, and/or axis range. In the vast majority of cases, Linux joystick problems in Oolite have been traced back to the SDL_JOYSTICK_DEVICE, so this article mostly focuses on that.

Sensitivity Problems

Prior to Oolite v1.80, deadzone and responsiveness issues in Oolite Linux could only be solved by making use of the jscal, jstest and jstest-gtk utilities, but Oolite now has built-in joystick calibration and tuning software, which can solve these problems. A tutorial on how to set up and tune your joystick can be found here.


Button Detection & Range Problems

For unknown reasons, sometimes SDL (Simple DirectMedia Layer) takes its raw input from the evdev device drivers, instead of using the correct joystick device. By adding the appropriate environment variable to either the /etc/environment file, or the .bashrc startup script, you can force SDL to use the "real" joystick driver for input.

Officially speaking, /etc/environment is the correct place for system-wide environment variables. To add the environment variable to the /etc/environment file, as root, open /etc/environment in your favourite text editor, and add the following line to the file, and save:

SDL_JOYSTICK_DEVICE="/dev/input/js0"

For the change to 'take', you then need to log out and back in again. Rebooting is unnecessary.

If you prefer changing the .bashrc startup script instead (since it doesn't require root access to do so), you should add the same line to .bashrc in your Home folder. As the dot in front of the filename indicates, this is a hidden file, so you may need to set the view in your file browser to "Show Hidden Files" before it will become visible. Once done, save the file and log out, then back in.


Although rare, it sometimes happens that a joystick is assigned a device number other than 'js0'. If the above fails to work for you, this is the most likely reason.

Using your Software Manager, install the jstest-gtk package. Launch the jstest-gtk gui (it will probably be located under "Administration") and under the name of your joystick, it will list the device details, such as "Device:/dev/input/js1". Edit /etc/environment or .bashrc to reflect the correct device number, save, log out and in again, and Oolite should now correctly identify your joystick, and allow you to configure it the way you want.