Page 1 of 1

[Solved] analog joystick dead zone

Posted: Fri Aug 03, 2012 1:33 pm
by Tichy
Hi! Does someone know how to set the dead zone in analog joysticks on gnu-linux?
I use a Logitech extreme 3d pro. I roll and pitch with the x and y axis, and yaw twisting the stick. My problem is that the twist is very sensitive and it's too easy to activate the yaw movement by mistake.

I already searched for similar problems, but all I was able to find was windows related, i.e.: install the logitech utilities.

Re: analog joystick dead zone

Posted: Fri Aug 03, 2012 10:23 pm
by CommRLock78
Tichy wrote:
Hi! Does someone know how to set the dead zone in analog joysticks on gnu-linux?
I use a Logitech extreme 3d pro. I roll and pitch with the x and y axis, and yaw twisting the stick. My problem is that the twist is very sensitive and it's too easy to activate the yaw movement by mistake.

I already searched for similar problems, but all I was able to find was windows related, i.e.: install the logitech utilities.
I guess the first question to ask is what distro are you using?

Re: analog joystick dead zone

Posted: Fri Aug 03, 2012 10:34 pm
by Tichy
I'm using Arch

Re: analog joystick dead zone

Posted: Fri Aug 03, 2012 11:37 pm
by CommRLock78
I'm a couple years from Arch yet (I'm still learning with Mint in the Debian branch), but I found this site. I hope it helps:
http://www.thelinuxblog.com/linux-man-pages/4/joystick

Re: analog joystick dead zone

Posted: Sat Aug 04, 2012 9:08 am
by Tichy
I installed the X11 driver (xf86-input-joystick). When using the joystick in X11 as mouse and keyboard, the deadzone option works, but looks like the game ignores it. Maybe oolite hooks directly to the kernel driver, not the x11 input device.

Re: analog joystick dead zone

Posted: Sat Aug 04, 2012 11:49 am
by Tichy
Problem solved! You need jscal and jstest ("joyutils" package in Arch's AUR). There's also al frontend called jstest-gtk.
Calibrate and set the dead zone with jstest-gtk. We need to set CenterMin and CenterMax values.
My settings:
Image

Then you need to save these values, in order to reload them every time you plug the joystick. This is done by making jscal dump the actual values in a script file:

Code: Select all

jscal -p /dev/input/js0 > jscal.sh
Edit the file and add this on top of it

Code: Select all

#!/bin/bash
Make the script executable (chmod +x jscal.sh) and move it in /usr/local/bin

Now, we need to make this to automatically load every time we plug in the device. To do so, we'll make an udev rule.
Create a file in /etc/udev/rules.d and name it 85-jscal.rules (or something similar).
This is mine

Code: Select all

SUBSYSTEM=="input", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c215", ACTION=="add", RUN+="/usr/local/bin/jscal.sh"
If a device matching these rules is plugged, the script specified in RUN+= will be executed. You need to adapt it to your device. To find your idVendor and idProduct, launch

Code: Select all

udevadm info --attribute-walk --name /dev/input/js0
or, with lsusb (Bus ... Device ...: ID vedor:product Name):

Code: Select all

Bus 005 Device 011: ID 046d:c215 Logitech, Inc. Extreme 3D Pro
The last thing to do, is to export an enviroinment variable that says to the SDL libraries that we are using /dev/input/js0 as joystick. Without it, Oolite would ignore our settings.
Put in your .profile or .bashrc or where you usually set your evniroinment variables that line

Code: Select all

export SDL_JOYSTICK_DEVICE=/dev/input/js0
ps. I hope that the guide is understandable. And forgive my grammar: english is not my native language. :)

Re: [solved] analog joystick dead zone

Posted: Sat Aug 04, 2012 8:22 pm
by CommRLock78
I'm glad you got it figured out :mrgreen: ; sorry I couldn't be of much assistance.

Re: [solved] analog joystick dead zone

Posted: Sat Aug 04, 2012 11:51 pm
by Tichy
No problem ;)

Re: [solved] analog joystick dead zone

Posted: Wed Aug 08, 2012 2:50 am
by captain122
Wow. I have been searching for an answer to that issue for years. I just rediscovered my account here and the first thing I see is just what I needed. I am very impressed and happy! (Also amazed at how many of the old faces are still around and how many are long gone!)

Re: [Solved] analog joystick dead zone

Posted: Thu Jan 10, 2013 3:22 pm
by cybertiger
Sorry for thread necromancy, but this solution is worth a sticky.

Calibrating joysticks in linux is non obvious and is not helped that SDL by default ignores your calibration (without setting SDL_JOYSTICK_DEVICE to /dev/input/jsX).

Re: [Solved] analog joystick dead zone

Posted: Sat Feb 16, 2013 7:57 am
by hayden
Does this fix work in windows at all, or purely Linux?

Re: [Solved] analog joystick dead zone

Posted: Sat Feb 16, 2013 9:30 am
by Tichy
Only gnu-linux. :)