# Set special options for all joystick devices:
# See "man xorg.conf" for general parameters,
# "man joystick" for joystick specific parameters.
#
# Save this file as...
# /usr/share/X11/xorg.conf.d/52-MyJoystick.conf
# or (preferred) as...
# /etc/X11/xorg.conf.d/52-MyJoystick.conf
#
# The xserver-xorg-input-joystick driver must be installed
# on your system, e.g., via:
#
# sudo apt-get install xserver-xorg-input-joystick
#
# or on Ubuntu 18.04 variants with hardware enablement
# stack (type hwe-support-status in a terminal to find out):
#
# sudo apt install xserver-xorg-input-joystick-hwe-18.04
#
# or on Ubuntu 16.04 variants with hardware enablement
# stack:
#
# sudo apt-get install xserver-xorg-input-joystick-hwe-16.04
#
# You must logout and login once after installing
# the driver and this file for settings to take
# effect.
#
# (w) 2012 by Mario Kleiner.

Section "InputClass"
	# Assign some name to this configuration:
	Identifier "My Joystick configuration"

	# Apply to all joystick devices:
	MatchIsJoystick "on"
	MatchDevicePath "/dev/input/event*"

	# Use 'joystick' driver to control them:
	Driver "joystick"

	# Detach from regular mouse and keyboard, ie.
	# joysticks shall not act as mice or keyboards:
	Option "Floating" "on"
	Option "StartKeysEnabled"  "False"
	Option "StartMouseEnabled" "True"

	# Assign joystick buttons to logical buttons:
	Option "MapButton1"	"button=1"
	Option "MapButton2"	"button=2"
	Option "MapButton3"	"button=3"
	Option "MapButton4"	"button=4"

	# Map joystick axis 1 and 2 (stick deflection)
	# to horizontal axis x and y if used as joystick.
	# Expose raw axis values in additional valuators.
	# Define all values < 5000 as zero.
	# This will expose axis 1 and 2 of the joystick
	# as additional axis 3 and 4 with raw values:
	Option "MapAxis1"	"mode=relative axis=x valuator deadzone=5000"
        Option "MapAxis2"       "mode=relative axis=y valuator deadzone=5000"

	# Map joystick axis 3 (e.g., throttle) to
	# additional valuator axis 5:
        Option "MapAxis3"       "valuator deadzone=5000"
EndSection
