| 1 | [](https://travis-ci.org/Grumbel/jstest-gtk) |
| 2 | |
| 3 | jstest-gtk |
| 4 | ========== |
| 5 | |
| 6 | > **Important: obsolete Linux joystick interface (joydev)** |
| 7 | > |
| 8 | > jstest-gtk talks to the old Linux **joydev** layer (`/dev/input/js*`). |
| 9 | > That interface is a compatibility shim. On modern systems the real |
| 10 | > driver path is **evdev** (`/dev/input/event*`), which is what the |
| 11 | > kernel, libinput, most desktop stacks, and almost all current games |
| 12 | > and engines actually use. |
| 13 | > |
| 14 | > **What that means in practice** |
| 15 | > |
| 16 | > - The live button/axis display can still be useful for a quick check |
| 17 | > that a pad is seen as a joystick device. |
| 18 | > - **Calibration, axis remapping, and button remapping done in this |
| 19 | > tool only change joydev.** They do **not** change the underlying |
| 20 | > evdev device. Steam, SDL2 (in its usual configuration), Proton, |
| 21 | > native games, and most other software will ignore those settings. |
| 22 | > - If a game “does not pick up” a calibration you set here, that is |
| 23 | > expected: the game is almost certainly reading evdev (or a higher |
| 24 | > abstraction built on it), not joydev. |
| 25 | > |
| 26 | > **Background (short)** |
| 27 | > |
| 28 | > Linux exposes input hardware through the input subsystem. Each |
| 29 | > physical device typically shows up as an **event** node |
| 30 | > (`/dev/input/eventN`) with rich, typed events (keys, absolute axes, |
| 31 | > hats, and so on). For older joystick-centric apps, the kernel can |
| 32 | > also present a simplified **js** node (`/dev/input/jsN`) with a fixed |
| 33 | > “axes + buttons” model and optional in-kernel correction coefficients. |
| 34 | > jstest-gtk configures that simplified view. It never rewrites the |
| 35 | > modern event stream. |
| 36 | > |
| 37 | > **Prefer these tools for modern testing** |
| 38 | > |
| 39 | > - [**evtest**](https://cgit.freedesktop.org/evtest/) — command-line |
| 40 | > monitor for `/dev/input/event*` (often `sudo evtest`) |
| 41 | > - [**evtest-qt**](https://github.com/Grumbel/evtest-qt) — Qt GUI along |
| 42 | > the same lines as jstest-gtk, but against **evdev** |
| 43 | > |
| 44 | > Use jstest-gtk only when you deliberately care about the legacy |
| 45 | > joydev nodes (old engines, specialized software, or debugging the |
| 46 | > compatibility layer itself). |
| 47 | |
| 48 | jstest-gtk is a simple joystick tester based on Gtk+. The main window |
| 49 | lets you pick an attached joystick from a drop-down, shows button and |
| 50 | axis activity, and can remap axes/buttons and calibrate the device |
| 51 | (Linux joydev only; see the disclaimer above). |
| 52 | |
| 53 | You can find the latest version at: |
| 54 | |
| 55 | * http://github.com/Grumbel/jstest-gtk/tree/master |
| 56 | |
| 57 | Questions, comments and bug reports can be given to: |
| 58 | |
| 59 | * Ingo Ruhnke <[email protected]> |
| 60 | |
| 61 | |
| 62 | Compiling |
| 63 | --------- |
| 64 | |
| 65 | Make sure you have the following pieces of software installed (they |
| 66 | are part of most distributions): |
| 67 | |
| 68 | * cmake |
| 69 | * sigc++ |
| 70 | * gtkmm |
| 71 | |
| 72 | You can compile it by typing: |
| 73 | |
| 74 | ```bash |
| 75 | $ mkdir build |
| 76 | $ cd build |
| 77 | $ cmake .. |
| 78 | $ make |
| 79 | ``` |
| 80 | |
| 81 | |
| 82 | Usage |
| 83 | ----- |
| 84 | |
| 85 | Once compiled you can start jstest-gtk with: |
| 86 | |
| 87 | ```bash |
| 88 | $ ./jstest-gtk |
| 89 | ``` |
| 90 | |
| 91 | or if you know the device you want to test with: |
| 92 | |
| 93 | ```bash |
| 94 | $ ./jstest-gtk /dev/input/js0 |
| 95 | ``` |
| 96 | |
| 97 | The main window opens on the joystick tester. Use the drop-down at the top to switch devices; when none are connected the selector is disabled. |
| 98 | |
| 99 | |
| 100 | The mapping dialog allows you to reorder the buttons and axis. This is |
| 101 | useful for example when a game expects the dpad to be on axis 0 and 1, |
| 102 | while in reality it is often on axis 4 and 5 on a dual-analogstick |
| 103 | gamepad. |
| 104 | |
| 105 | The calibration dialog allows you to manipulate some low level details |
| 106 | on how the raw axis values are mapped to the joystick device. For |
| 107 | example you can inverse an axis, disable an axis or remove its |
| 108 | deadzone, to gain more fine control on small movements. This is |
| 109 | especially useful as the default calibration values for most joysticks |
| 110 | give it a far bigger deadzone then needed, thus reducing your ability |
| 111 | for fine movements. |
| 112 | |
| 113 | |
| 114 | SDL Notes |
| 115 | --------- |
| 116 | |
| 117 | Depending on what version and what compilation flags where used, your |
| 118 | version of SDL might not use the joystick interface at all, but |
| 119 | instead use the /dev/input/event* device directly. That means that any |
| 120 | calibration or button/axis mapping will be ignored, as those apply to |
| 121 | the joystick interface, not evdev. |
| 122 | |
| 123 | To work around that you have to set an environment variable that |
| 124 | forces SDL to use the joystick device: |
| 125 | |
| 126 | ```bash |
| 127 | $ SDL_JOYSTICK_DEVICE="/dev/input/js0" |
| 128 | $ export SDL_JOYSTICK_DEVICE |
| 129 | ``` |
| 130 | |
| 131 | When you need two or more joysticks this will not work and you might |
| 132 | need to recompile SDL and disable the evdev support. |
| 133 | |
| 134 | More info can be found at: |
| 135 | |
| 136 | * ftp://ptah.lnf.kth.se/pub/misc/sdl-env-vars |
| 137 | |
| 138 | `SDL_LINUX_JOYSTICK`: |
| 139 | Special joystick configuration string for linux. The format is |
| 140 | `name numaxes numhats numballs` |
| 141 | where name is the name string of the joystick (possibly in single |
| 142 | quotes), and the rest are the number of axes, hats and balls |
| 143 | respectively. |
| 144 | |
| 145 | `SDL_JOYSTICK_DEVICE`: |
| 146 | Joystick device to use in the linux joystick driver, in addition to |
| 147 | the usual: `/dev/js*`, `/dev/input/event*`, `/dev/input/js*` |