Langue: en

Version: xf86-input-joystick 1.2.3 (mandriva - 22/10/07)

Section: 4 (Pilotes et protocoles réseau)


joystick - Joystick input driver


 Section "InputDevice"
   Identifier "devname"
   Driver "joystick"
   Option "Device"   "devpath"


joystick is an Xorg input driver for Joysticks, using either Linux's joystick devices or *BSD's uhid devices. The driver reports cursor movement as well as raw axis values through valuators.


In general, every by the kernel supported joystick should be supported through the joystick driver. The driver assumes that the joystick is calibrated and reports axis values between -32768 and 32768. See the Linux kernel documentation for a complete list of supported devices.


Please refer to xorg.conf(5) for general configuration details. This section only covers configuration details specific to this driver.

The following Driver Options are supported:

Option "Device" "string"
Specifies the device through which the joystick can be accessed. This option is mandatory and there is no default setting.

For Linux, joysticks are mostly accessible as /dev/input/jsX.

For *BSD, joysticks are recognized as /dev/uhidX.

Option "DebugLevel" "integer"
If compiled with debugging information, controls the verbosity of the driver. The higher the DebugLevel, the more output is produced. Default: 0
Option "MapButton<number>" "string"
Sets the mapping of the joystick button to the desired action. Counting of buttons starts with 1, Possible options are:
This joystick button won't do anything.
The joystick button will generate a click with the specified button (starting with 1).
Where <axis> is one of: X, Y, ZX, ZY

and <factor> is an optional amplifier of the axis, like -, +, -5, 0.4, 1.3, ... Use positive and negative values to control the direction. Default: 1.0

Amplifies the movement of all axes by the given factor when pressed. Different factors can be combined.
When button is pressed, a series of keydown events with the specified keycode is generated. When the button is released, there are keyup events in the opposite order generated. You can specify up to 4 keycodes per button.

See special section about key events below.

Disables either the generation of mouse events, key events or the generation of all X events by the driver. Press button again to allow the driver to generate events again.
Option "MapAxis<number>" "string"
Sets the mapping of the axis to the desired action. Counting of axes starts with 1, the parameter may contain:
Where <string> can be one of:

none, relative, accelerated, absolute

Every axis which's mode is not none will be reported as an additional valuator.

Where <axis> is one of: X, Y, ZX, ZY, KEY (see keylow/keyhigh)

and <factor> is an optional amplifier of the axis, like -, +, -5, 0.4, 1.3, ... Negative values will invert the movement. Default: 1.0

"keylow= <keycode>[,<keycode>[,<keycode>[,<keycode>]]]
When the axis is moved out of the deadzone, a series of keydown events according to the direction of the movement is generated. When the axis is released, keyup events will be generated. You can specify up to 4 keycodes for each direction.

keylow defines the keys to be generated when the axis is moved in negative direction (ie. left or up), keyhigh defines the keys to be generated when the axis is moved in positive direction (ie. right or down).

If mode is set to relative: The driver will emulate autorepeat according to the current value of the axis. A keydown and subsequent keyup event will be generated in short time intervals. To modify that interval and the autorepeat speed, supply the "axis=[<factor>]KEY" parameter.

If mode is set to accelerated: One keydown event is generated, when the axis is moved out of the deadzone, the keyup event is generated, when the axis moves back to the deadzone. The keys will be autorepeated according to the keyboard settings.

See special section about key events below.

Sets the unresponsive range of the axis to <number>. This can be between 0 and 30000. Default: 1000

The default configuration looks as follows:

   Option "MapButton1"   "button=1"
   Option "MapButton2"   "button=2"
   Option "MapButton3"   "button=3"
   Option "MapButton4"   "none"
   Option "MapAxis1"     "mode=relative axis=+1x deadzone=1000"
   Option "MapAxis2"     "mode=relative axis=+1y deadzone=1000"
   Option "MapAxis3"     "mode=none"


Accelerated mode should be selected, if the axis is a pad, which reports only three states: negative, center, positive. It will produce a smooth acceleration of the movement when the axis is deflected. The speed will be affected by the factor of the axis, but not the acceleration speed.

This example will set up the axis as scrolling vertically inverted, which half of the speed:

   Option "MapAxis1"     "mode=accelerated axis=-0.5zy"

This example maps four buttons to the four half axes, so you can use them like a pad. The movement will get half the normal speed:

   Option "MapButton1"     "axis=+0.5x"
   Option "MapButton2"     "axis=-0.5x"
   Option "MapButton3"     "axis=+0.5y"
   Option "MapButton4"     "axis=-0.5y"


With the absolute axis mode, the position of the cursor will be fixed to the position, according to the deflection of the axis. This fixed position is calculated around the previous position of the cursor. You can specify the range in pixels, the cursor can move. The default range is the width of the screen, when mapped to the x-axis and the height of the screen, when mapped to the y-axis. This mode can be combines with the other modes without problems.

In this example the first axis gets a range from left to the right of the screen. The second axis gets a total range of 200 pixels, 100 to the top and 100 to the bottom:

   Option "MapAxis1"     "mode=absolute axis=x"
   Option "MapAxis2"     "mode=absolute axis=200y"


Proving a "key=<keycode>[,<keycode>[...]]" option will generate X Events with the specified keycodes in order, when the joystick button is pressed or the axis changed it's position. When the button/axis is released, the keys are released in the reverse order. To lookup keycodes for KeySyms, you can use xmodmap -pk. You can use unused keycodes and map them to a KeySym of your choice using xmodmap(1). You can specify up to 4 keycodes per joystick button/axis.


   Option "MapButton1"     "key=64,23"
will generate Alt_L+Tab when the button is pressed.
   Option "MapButton1"     "key=40"
will generate a lowercase d.
   Option "MapButton1"     "key=65"
is for the space key.
   Option  "MapAxis1"      "mode=relative    keylow=100 keyhigh=102 axis=0.5key"
   Option  "MapAxis2"      "mode=relative    keylow=98  keyhigh=104"
   Option  "MapAxis3"      "mode=accelerated keylow=100 keyhigh=102"
   Option  "MapAxis4"      "mode=accelerated keylow=98  keyhigh=104"
will map the first and third axis to the arrow keys left and right and the second and fourth axis to the arrow keys up and down. The keys for the first two axes will be generated in an interval according to the value of the axis. The autorepeat speed of the first axis will be half the speed of that of the second axis. The keys for the third and fourth axis are generated once when the axis moves out of the deadzone and when it moves back into the deadzone. X.Org will autorepeat those keys according to current keyboard settings.


The driver reports relative cursor movement as valuators 0 and 1.

Every axis will be associated with an additional valuator, reporting the absolute raw values of the axis in the range of -32768 to 32768.

Axes in the mode "none" will be ignored. The mode has no effect on the reported value. The axis does not need to be assigned to a direction.


The driver does not do hotplugging. The joystick needs to be plugged in when the driver is loaded. If the joystick is unplugged, the driver deactivates itself.

Make sure you add the "SendCoreEvents" keyword to the device entry of your ServerLayout section of the xorg.conf file, otherwise the device won't report core pointer and core key events.


     InputDevice     "Joystick1"     "SendCoreEvents"


Xorg(1), xorg.conf(5), xorgconfig(1), Xserver(1), X(7), xmodmap(1)


Sascha Hlusiak (2007), Frederic Lepied (1995-1999)