Section "InputDevice" Identifier "devname" Driver "joystick" Option "Device" "devpath" ... EndSection
- Linux's evdev interface - Linux's joystick interface - BSD's usbhid interface
The driver reports cursor movement as well as raw axis values through valuators.
The following Driver Options are supported:
For Linux, joysticks are mostly accessible as /dev/input/jsX or /dev/input/eventX.
In *BSD, joysticks are usually recognized as /dev/uhidX.
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
See special section about key events below.
none, relative, accelerated, absolute
Every axis which's mode is not none will be reported as an additional valuator.
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 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: Keydown and keyup events will be generated repeatedly. The time between a keydown and a keyup event corresponds to the deflection of the axis. If the axis is deflected by 30%, the key will be considered to be down 300ms out of 1 second. The exact intervals may vary and can be adjusted with the amplify parameter. If the axis is deflected by 100%, there will only be one keydown event, so the key is considered down all the time. The keys will be autorepeated according to the Xorg keyboard settings.
See special section about key events below.
Option "DebugLevel" "0" Option "StartKeysEnabled" "True" Option "StartMouseEnabled" "True" Option "MapButton1" "button=1" Option "MapButton2" "button=2" Option "MapButton3" "button=3" Option "MapButton4" "none" ... Option "MapAxis1" "mode=relative axis=+1x deadzone=5000" Option "MapAxis2" "mode=relative axis=+1y deadzone=5000" Option "MapAxis3" "mode=relative axis=+1zx deadzone=5000" Option "MapAxis4" "mode=relative axis=+1zy deadzone=5000" Option "MapAxis5" "mode=accelerated axis=+1x deadzone=5000" Option "MapAxis6" "mode=accelerated axis=+1y deadzone=5000" Option "MapAxis7" "mode=none" ...
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"
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"
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 scancodes per joystick button/axis, which is useful to use modificators. Make sure you use modificators that are necessary to get a certain keysym.
Examples:
Option "MapButton1" "key=64,23"will generate Alt_L+Tab when the button is pressed.
Option "MapButton1" "key=50,40"will generate a Shift_L+d which will be an uppercase d.
Option "MapButton1" "key=65"is for the space key.
Option "MapAxis1" "mode=relative keylow=113 keyhigh=114 axis=0.5key" Option "MapAxis2" "mode=relative keylow=111 keyhigh=116" Option "MapAxis3" "mode=accelerated keylow=113 keyhigh=114" Option "MapAxis4" "mode=accelerated keylow=111 keyhigh=116"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.
There is an example hal policy in ${sourcecode}/config/50-x11-input-joystick.fdi which will take care of hotplugging. Place it in /etc/hal/fdi/policy and customize it to your needs. Pass custom options to the driver using x11_options properties. This requires xorg-server-1.5 or higher.
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.
Example:
InputDevice "Joystick1" "SendCoreEvents"