Joystick

From Gentoo Linux Wiki

Jump to: navigation, search

Contents

[edit] Kernel Configuration

You need to enable the following your kernel:

Linux Kernel Configuration: Joystick Support
Device Drivers -->
    Input Device Support -->
        <*> Joystick Interface
        <*> Event Interface

Additionally, if you choose to compile the joystick interface as a module, it will be called joydev.

[edit] Gameport Joysticks

If you have a joystick that connects to a parallel or game port, you need to enable support for the joystick under Joysticks/Gamepads.

Linux Kernel Configuration: Joystick Support
Device Drivers -->
    Input Device Support -->
        <*> Joystick Interface
        <*> Event Interface
        [*]   Joysticks/Gamepads  --->

Gameport joysticks must also have the gameport on the PCI card enabled. Often, there is a driver for the gameport separate from the card's driver. Select the card from this list:

Linux Kernel Configuration: Gameport Support
Device Drivers -->
    Input device support  --->
        Hardware I/O ports  --->
            <*> Gameport support  --->

If the card shown is not listed, then often, the module will require a kernel parameter to enable the gameport. This is specific to each module.

[edit] USB Joysticks

If you have a joystick that connects to a USB port, you first need to enable HID support:

Linux Kernel Configuration: USB Joystick Support
Device Drivers -->
    HID Devices  --->
        <*>   USB Human Interface Device (full HID) support

See Special HID drivers and enable support for you joystick if it's listed there.

Linux Kernel Configuration: Special HID Joystick Support
        Special HID drivers  --->

Also, if you have a PID device, you will have to enable PID support.

If you have a USB joystick that wasn't listed here, it's probable that is works with just USB Human Interface Device (full HID) support enabled.

[edit] Tools

The old jstest and jscal programs and utilities can be found in the games-util/joystick package,

emerge -av joystick

[edit] Testing

You can use dmesg to see how your joystick identified itself,

dmesg | grep -i Joystick

The output would for example be:

  input: USB HID v1.00 Joystick [Saitek Cyborg USB Stick] on usb2:2.0

If you see something like this, then your joystick is detected and /dev/input/jsX should have been created.

ls /dev/input/js*

will show you if you have the device detected.

A simple test to see what /dev/input/jsX entry is is to cat the node while using the joystick:

cat /dev/input/js0

This will produce a string of garbage to the console for stick movement and button clicks.

[edit] jstest

You can test your joystick with the jstest tool,

jstest /dev/input/js0

[edit] Calibration

Many joysticks, in particular gameport joysticks, should be calibrated before use (to reduce drift and inaccuracy). This can be done with the jscal utility:

jscal -c /dev/input/js0
Personal tools