Joystick problems (Linux)
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 fairly uncommon, and most reported problems revolve around button detection/assignment, and/or axis range. This article provides explanations and solutions for the various joystick-related problems that have been encountered in Oolite Linux.
Joystick Detection Problems
Whilst not Oolite-specific, since X.Org started using the evdev driver, the default settings for evdev joystick can cause the joystick to be seen as a mouse and keyboard also. This can be solved by installing the xf86-input-joystick package, then, as root, creating a /etc/X11/xorg.conf-d/50-joystick.conf file, with the following content:
Section "InputClass" Identifier "joystick catchall" MatchIsJoystick "on" MatchDevicePath "/dev/input/event*" Driver "joystick" Option "StartKeysEnabled" "False" #Disable joystick keyboard emulation Option "StartMouseEnabled" "False" #Disable joystick mouse emulation EndSection
The StartKeysEnabled and StartMouseEnabled options are the ones that change the default behaviour, the rest are X defaults for the joystick driver.
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 configuration 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 & Axis Range Problems
For unknown reasons, it appears that sometimes SDL (Simple DirectMedia Layer) takes 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 text editor, add the following (on a new line) to the file, and save:
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, you should add the above 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 in the System Menu under "Administration") and, underneath the name of your joystick, it will list the device details, such as "Device:/dev/input/js1". You can now edit /etc/environment or .bashrc to reflect the correct device number, save, log out and in again, after which Oolite should correctly identify your joystick, and allow you to configure it the way you want.
- See Using xboxdrv is actually easy. A basic HOWTO (2014)
- Also: Xbox Controller with xboxdrv: How to add deadzone to conf (2014)
Should you require further guidance in creating or editing the above files, or the methods given above fail to resolve, or don't address your particular problem, please don't hesitate to post a thread detailing the issue, and your attempts to fix it, to the Oolite-Linux forum. The forum has several Linux gurus available, who would be more than happy to assist.
- Keyboards (non-US) can also be a problem: see here.