Forums

Full Version: Deadzone problem and solution
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Using my G25 wheel, I had a deadzone problem even after calibrating the wheel with jscal or KDE control center.

I found the solution here : http://github.com/Grumbel/jstest-gtk/tree/master

At least on Ubuntu 9.04, SDL seems not to use the joystick interface anymore but instead, it uses the event interface.
The calibration mapping are therefore ignored by SDL.

There is one way to force SDL to use the joystick interface :
you have to export an environment variable like this :
export SDL_JOYSTICK_DEVICE=/dev/input/js0

After setting this, I don't have any deadzone problem anymore.
The G25 manage tool has been enhanced in order to be able to set the default deadzone values.
This function should work for every wheel or joystick through the event interface.

With this tool, no need for the forementioned trick.
And SDL can use several joysticks again
Works great for me. Before, I had to recalibrate every time I plugged in my joystick to get rid of the deadzone; now I can just run your tool.
glad to see it's useful to you !

You do not need to run the tool manually.
It can be run by the udev process as soon as it detects your joystick is plugged in.

As an example, here are my udev rules :
this is the content of /etc/udev/rules.d/99-logitech-wheels.rules:

Code:
# for a joystick detected by the kernel event interface, with a model name "G25_Racing_Wheel change the permissions on the device file
# and add a symlink to the event device file
KERNEL=="event[0-9]*", ENV{ID_CLASS}=="joystick", ENV{ID_MODEL}=="G25_Racing_Wheel", MODE="0664", GROUP="games", SYMLINK+="input/G25event"
# for each joystick detected by the kernel joystick interface, change the permissions on the device file
KERNEL=="js[0-9]*", ENV{ID_CLASS}=="joystick", MODE="0664'", GROUP="games"
# If a joystick is added with a product name "G25 Racing Wheel" from the vendor "046d" with the id "c294", switch it to native mode
BUS=="usb", SYSFS{product}=="G25 Racing Wheel", SYSFS{idVendor}=="046d",SYSFS{idProduct}=="c294", ACTION=="add", RUN+="/usr/local/bin/G25manage --nativemode"
# No deadzone for the wheel on the G25 in native mode
KERNEL=="event[0-9]*", ENV{ID_CLASS}=="joystick", ENV{ID_MODEL_ID}=="c299", RUN+="/usr/local/bin/G25manage --evdev=/dev/input/G25event --deadzone=0 --axis=0"
# No deadzone for the clutch pedal on the G25 in native mode
KERNEL=="event[0-9]*", ENV{ID_CLASS}=="joystick", ENV{ID_MODEL_ID}=="c299", RUN+="/usr/local/bin/G25manage --evdev=/dev/input/G25event --deadzone=0 --axis=1"
# No deadzone for the break pedal on the G25 in native mode
KERNEL=="event[0-9]*", ENV{ID_CLASS}=="joystick", ENV{ID_MODEL_ID}=="c299", RUN+="/usr/local/bin/G25manage --evdev=/dev/input/G25event --deadzone=0 --axis=2"
# No deadzone for the throttle pedal on the G25 in native mode
KERNEL=="event[0-9]*", ENV{ID_CLASS}=="joystick", ENV{ID_MODEL_ID}=="c299", RUN+="/usr/local/bin/G25manage --evdev=/dev/input/G25event --deadzone=0 --axis=5"

There could be also a rule to send a jscal command for the games dealing with the joystick interface

I think I'll soon write a little article in the wiki about using udev rules.

If your joystick is not the G25 could you send the result of the following commands :

udevadm info --query=all --name=/dev/input/jsX
udevadm info --query=all --name=/dev/input/eventX
G25manage --showcalibration=/dev/input/eventX