Difference between revisions of "Joystick problems (Linux)"

From Elite Wiki
m (Overview)
(Updating BB links)
 
(68 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 +
[[File:Logitech joystick.jpg|right|320px]]
 
== 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 fairly uncommon, and most reported problems revolve around button detection/assignment, and/or axis range. In the vast majority of cases, joystick problems in Oolite Linux have been traced back to the SDL_JOYSTICK_DEVICE being incorrectly assigned, so this article mostly focuses on that.
+
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 ==
 
== Joystick Detection Problems ==
  
Whilst not Oolite-specific, since xorg started using the evdev driver, default settings for evdev joystick sometimes caused it to be seen as a mouse and keyboard also. This can be solved by installing the xf86-input-joystick package, then creating a ''/etc/X11/xorg.conf-d/50-joystick.conf'' file, with the following content:
+
Whilst not Oolite-specific, since [http://www.x.org/wiki/ X.Org] started using the [https://en.wikipedia.org/wiki/Evdev 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"
 
  Section "InputClass"
        Identifier "joystick catchall"
+
        Identifier "joystick catchall"
        MatchIsJoystick "on"
+
        MatchIsJoystick "on"
        MatchDevicePath "/dev/input/event*"
+
        MatchDevicePath "/dev/input/event*"
        Driver "joystick"
+
        Driver "joystick"
        Option "StartKeysEnabled" "False"      #Disable mouse
+
        Option "StartKeysEnabled" "False"      #Disable joystick keyboard emulation
        Option "StartMouseEnabled" "False"      #support
+
        Option "StartMouseEnabled" "False"      #Disable joystick mouse emulation
 
  EndSection
 
  EndSection
  
 +
The ''StartKeysEnabled'' and ''StartMouseEnabled'' options are the ones that change the default behaviour, the rest are X defaults for the joystick driver.
  
The ''StartKeysEnabled'' and ''StartMouseEnabled'' options are the ones that change the default behaviour, the rest is X defaults for joystick driver.
+
== Sensitivity problems ==
  
== Sensitivity Problems ==
+
Prior to Oolite v1.80, deadzone and responsiveness issues in Oolite Linux could only be solved [https://bb.oolite.space/viewtopic.php?p=178651#p178651 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 [[Dizzy%27s_guide_to_Setting_up_Joystick_Axis_Profiles|here]].
  
Prior to Oolite v1.80, deadzone and responsiveness issues in Oolite Linux could only be solved [http://aegidian.org/bb/viewtopic.php?p=178651#p178651 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 [[Dizzy%27s_guide_to_Setting_up_Joystick_Axis_Profiles_in_Oolite_1.80|here]].
+
== Button Detection & Axis Range Problems ==
  
 +
For unknown reasons, it appears that sometimes SDL ([https://www.libsdl.org/ 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.
  
== Button Detection & Range Problems ==
+
[https://help.ubuntu.com/community/EnvironmentVariables 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:
 +
 
 +
SDL_JOYSTICK_DEVICE="/dev/input/js0"
 +
 
 +
For the change to 'take', you then need to log out and back in again. Rebooting is unnecessary.
  
For unknown reasons, it appears that sometimes SDL ([https://www.libsdl.org/ Simple DirectMedia Layer]) takes raw input from the [https://en.wikipedia.org/wiki/Evdev 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.
+
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.
  
[https://help.ubuntu.com/community/EnvironmentVariables 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, add the following line to the file, and save:
+
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.
  
SDL_JOYSTICK_DEVICE="/dev/input/js0"
+
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.
  
For the change to 'take', you then need to log out and back in again. Rebooting is unnecessary.  
+
== XBox Controllers ==
 +
* See [https://bb.oolite.space/viewtopic.php?f=9&t=16519 Using xboxdrv is actually easy. A basic HOWTO] (2014)
 +
* Also: [https://bb.oolite.space/viewtopic.php?f=2&t=16501 Xbox Controller with xboxdrv: How to add deadzone to conf] (2014)
  
If you prefer changing the ''.bashrc'' startup script instead (since it doesn't require root access to do so), 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.
+
== Other problems ==
  
 +
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 [https://bb.oolite.space/viewforum.php?f=9 Oolite-Linux forum]. The forum has several Linux gurus available, who would be more than happy to assist.
  
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.
+
*Keyboards (non-US) can also be a problem: see [https://bb.oolite.space/viewtopic.php?f=3&t=20822 here].
  
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.
+
== Links ==
 +
*[[Linux Joysticks and Gamepads]] - Guide to setting up for Linux
 +
*[[Joysticks and Gamepads]]
 +
*[[Joysticks: Guide to Setting Up]]
  
 +
*[https://bb.oolite.space/viewtopic.php?f=6&t=5428 Force-Feedback Joystick Support?] (2008-17: see Getafix's last posts for Linux)
  
== Other Problems ==
+
*[[Keyboard Issues]]
  
Should you require further guidance in 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 [http://aegidian.org/bb/viewforum.php?f=9 Oolite-Linux forum]. The forum has several Linux gurus available, who would be more than happy to assist.
+
[[Category:Oolite]][[Category:Help pages]]

Latest revision as of 02:00, 29 February 2024

Logitech joystick.jpg

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

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 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:

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

XBox Controllers

Other problems

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.

Links