Gamepad

Many gamepads are working out-of-the-box nowadays, but there are still many potential problems and sources for errors since gamepad support in applications varies by a lot.

Linux has two different input systems for gamepads – the original Joystick interface and the newer evdev-based interface.

/dev/input/jsX maps to the Joystick API interface and /dev/input/event* maps to the evdev ones (this also includes other input devices such as mice and keyboards). Symbolic links to those devices are also available in /dev/input/by-id/ and /dev/input/by-path/ where the legacy Joystick API has names ending with -joystick while the evdev have names ending with -event-joystick.

Most new games will default to the evdev interface as it gives more detailed information about the buttons and axes available and also adds support for force feedback.

While SDL1 defaults to evdev interface you can force it to use the old Joystick API by setting the environment variable SDL_JOYSTICK_DEVICE=/dev/input/js0. This can help many games such as X3. SDL2 supports only the new evdev interface.

Installation

Unless you are using very old joystick that uses Gameport or a proprietary USB protocol, you will need just the generic USB Human Interface Device (HID) modules.

For an extensive overview of all joystick related modules in Linux, you will need access to the Linux kernel sources — specifically the Documentation section. Unfortunately, official kernel packages do not include what we need. If you have the kernel sources downloaded, have a look at Documentation/input/joydev/. You can browse the kernel source tree at kernel.org by clicking the "browse" (cgit - the git frontend) link for the kernel that you are using, then clicking the "tree" link near the top. Alternatively, see documentation from the latest kernel.

Some joysticks need specific modules, such as the Microsoft Sidewinder controllers (sidewinder), or the Logitech digital controllers (adi). Many older joysticks will work with the simple module. If your joystick is plugging in to a gameport provided by your soundcard, you will need your soundcard drivers loaded — however, some cards, like the Soundblaster Live, have a specific gameport driver (). Older ISA soundcards may need the module, which is a standard gameport module.

As you can see, there are many different modules related to getting your joystick working in Linux, so everything is not covered here. Please have a look at the documentation mentioned above for details.

Loading the modules for analogue devices

You need to load a module for your gameport (, , cs461x, etc...), a module for your joystick (, sidewinder, adi, etc...), and finally the kernel joystick device driver (joydev). You can load the module at boot, or simply modprobe it. The module should load automatically, as this is a dependency of the other modules.

USB gamepads

You need to get USB working, and then modprobe your gamepad driver, which is , as well as joydev. If you use a usb mouse or keyboard, will be loaded already and you just have to load the joydev module.

Configuration

Testing

Once the modules are loaded, you should be able to find a new device: and a file ending with -event-joystick in directory. You can simply those devices to see if the joystick works — move the stick around, press all the buttons - you should see mojibake printed when you move the sticks or press buttons.

If you get a permission error, see #Device permissions.

Both interfaces are also supported in wine and reported as separate devices. You can test them (including vibration feedback) with .

Joystick API

There are a lot of applications that can test this old API, jstest from the package is the simplest one. If the output is unreadable because the line printed is too long you can also use graphical tools. KDE Plasma has a built in one in System Settings > Input Devices > Game Controller. There is jstest-gtk-gitAUR as an alternative.

Use of jstest is fairly simple, you just run and it will print a line with state of all the axes (normalised to ) and buttons.

After you start , it will just show you a list of joysticks available, you just need to select one and press Properties.

evdev API

The new 'evdev' API can be tested using the SDL2 joystick test application or using from or from . Install and then run sdl2-jstest --test 0. Use to get IDs of other controllers if you have multiple ones connected.

To test force feedback on the device, use from linuxconsole:

$ fftest /dev/input/by-id/usb-*event-joystick

HTML5 Gamepad API

Go to https://gamepad-tester.com/. Currently, testing vibration and producing a visual of the gamepad is supported in Chromium but not Firefox. Additionally, as of version 107.0.5304.121-1, Chromium can read Joystick devices but not evdev.

Setting up deadzones and calibration

If you want to set up the deadzones (or remove them completely) of your analog input you have to do it separately for the xorg (for mouse and keyboard emulation), Joystick API and evdev API.

Wine deadzones

Add the following registry entry and set it to a string from 0 to 10000 (affects all axes):

HKEY_CURRENT_USER\Software\Wine\DirectInput\DefaultDeadZone

Source: UsefulRegistryKeys

Xorg deadzones

Add a similar line to (create if it does not exist):

1000 is the default value, but you can set anything between 0 and 30 000. To get the axis number see the "Testing Your Configuration" section of this article. If you already have an option with a specific axis just type in the at the end of the parameter separated by a space.

Joystick API deadzones

The easiest way is using from jstest-gtk-gitAUR. Select the joystick you want to edit, click the Properties button. On this new window, click the Calibration button (do not click Start Calibration after that). You can then set the and values, which control the center deadzone, and and RangeMax, which control the end of throw deadzones. Note that the calibration settings are applied when the application opens the device, so you need to restart your game or test application to see updated calibration settings.

After you set the deadzones, you also can create an udev rule to make all changes permanent:

First, grab the vendor id of your joystick (replace with your joystick's number, it's usually ):

$ udevadm info -q property --property ID_VENDOR_ID --value /dev/input/jsX

Also rab the model id:

$ udevadm info -q property --property ID_MODEL_ID --value /dev/input/jsX

If the commands above give you an empty output, it could be because your controller is connected via Bluetooth, making these unique attributes only visible on the parent device(s). To mitigate this, you could try finding other unique attributes by running:

$ udevadm info -a /dev/input/jsX

This will list all available attributes from your device (and parent devices). So, for example, if the parent device of your joystick has the attribute , or maybe both and ATTRS{idProduct}=="09cc", then you can use these instead of and in the udev rule below.

You can also have both rules at the same time, just separate them with a new line.

Anyway, now use to dump the new calibration settings of your joystick:

$ jscal -p /dev/input/jsX

Now, modify this udev rule with the values you got:

This rule will automatically run whenever you connect a joystick with vendor id 054c and model id . The part is required to automatically determine the correct joystick, so do not remove it.

Finally, load this new udev rule.

evdev API deadzones

The tool from the package can be used to view and change deadzones and calibration for API devices.

To view your device configuration:

$ evdev-joystick --showcal /dev/input/by-id/usb-*-event-joystick

To change the deadzone for a particular axis, use a command like:

$ evdev-joystick --evdev /dev/input/by-id/usb-*-event-joystick --axis 0 --deadzone 0

To set the same deadzone for all axes at once, omit the option.

Use udev rules file to set them automatically when the controller is connected.

Note that inside the kernel, the value is called flatness and is set using the .

Default configuration will look like similar to this:

While a more reasonable setting would be achieved with something like this (repeat for other axes):

$ evdev-joystick --evdev /dev/input/by-id/usb-Madcatz_Saitek_Pro_Flight_X-55_Rhino_Stick_G0000090-event-joystick --axis 0 --deadzone 512
Event device file: /dev/input/by-id/usb-Madcatz_Saitek_Pro_Flight_X-55_Rhino_Stick_G0000090-event-joystick
 Axis index to deal with: 0
 New dead zone value: 512
 Trying to set axis 0 deadzone to: 512
   Absolute axis 0x00 (0) (X Axis) Setting deadzone value to : 512
 (min: 0, max: 65535, flatness: 512 (=0.78%), fuzz: 255)

Configuring curves and responsiveness

In case your game requires just limited amount of buttons or has good support for multiple controllers, you may have good results with using to change response curves of the joystick.

Below are example setups for Saitek X-55 HOTAS:

$ xboxdrv --evdev /dev/input/by-id/usb-Madcatz_Saitek_Pro_Flight_X-55_Rhino_Throttle_G0000021-event-joystick \
  --evdev-no-grab --evdev-absmap 'ABS_#40=x1,ABS_#41=y1,ABS_X=x2,ABS_Y=y2' --device-name 'Hat and throttle' \
  --ui-axismap 'x2^cal:-32000:0:32000=,y2^cal:-32000:0:32000=' --silent

this maps the EV_ABS event with id of 40 and 41 (use xboxdrv with to see the events registered), which is the normally inaccessible "mouse pointer" on the throttle, to first gamepad joystick and throttles to second joystick, it also clamps the top and lower ranges as they not always register fully.

A bit more interesting is the setup for the stick:

$ xboxdrv --evdev /dev/input/by-id/usb-Madcatz_Saitek_Pro_Flight_X-55_Rhino_Stick_G0000090-event-joystick \
  --evdev-no-grab --evdev-absmap 'ABS_X=x1' --evdev-absmap 'ABS_Y=y1' --device-name 'Joystick' \
  --ui-axismap 'x1^cal:-32537:-455:32561=,x1^dead:-900:700:1=,x1^resp:-32768:-21845:-2000:0:2000:21485:32767=' \
  --ui-axismap 'y1^cal:-32539:-177:32532=,y1^dead:-700:2500:1=,y1^resp:-32768:-21845:-2000:0:2000:21485:32767=' \
  --evdev-absmap 'ABS_RZ=x2' --ui-axismap 'x2^cal:-32000:-100:32000,x2^dead:-1500:1000:1=,x2^resp:-32768:-21845:-2000:0:2000:21485:32767=' \
  --silent

this maps the 3 joystick axes to gamepad axes and changes the calibration (min value, centre value, max value), dead zones (negative side, positive side, flag to turn smoothing) and finally change of response curve to a more flat one in the middle.

You can also modify the responsiveness by setting the 'sen' (sensitivity). Setting it to value of 0 will give you a linear sensitivity, value of -1 will give very insensitive axis while value of 1 will give very sensitive axis. You can use intermediate values to make it less or more sensitive. Internally xboxdrv uses a quadratic formula to calculate the resulting value, so this setting gives a more smooth result than 'resp' shown above.

Nice thing about xboxdrv is that it exports resulting device as both old Joystick API and new style evdev API so it should be compatible with basically any application.

Disable joystick from controlling mouse

If you want to play games with your gamepad, you might want to disable its joystick control over mouse cursor. To do this, edit (create if it does not exists) so that it looks like this:

Using gamepad to send keystrokes

A couple of programs exist to map gamepad buttons to keyboard keys, including:

All work well without the need for additional X.org configuration.

Xorg configuration example

This is a good solution for systems where restarting Xorg is a rare event because it is a static configuration loaded only on X startup. The example runs on a Kodi media PC, controlled with a Logitech Cordless RumblePad 2. Due to a problem with the d-pad (a.k.a. "hat") being recognized as another axis, Joy2key was used as a workaround. Since version 11.0 and 1.6.3-1, this setup no longer worked and the following was created for letting Xorg handle joystick events.

First, install the xf86-input-joystickAUR package. Then, create an X configuration file:

Remapping of gamepad buttons and more

With some programs you can also configure your gamepad further, including the following potential features:

  • Remapping buttons and axes.
    • Assigning mapping profiles to different games.
  • Emulating a different type of gamepad. As noted in #Mimic Xbox 360 controller, software can often behave better when seemingly given an Xbox 360 Controller, as this is a very common controller that many games have been tested with.
  • Additional functionality such as Macros, On-Screen-Displays etc.

List of software:

Remapping of gamepad on SDL2 applications

Gamepads can be remapped for SDL2 applications using the environment variable. For each line, it includes the gamepad's GUID, a name, button / axis mappings and a platform. The controller's GUID can be retreived by installing and then running .

For example, to map Microsoft Xbox 360 controllers with different GUIDs:

Some apps extract mapping information from a gamecontrollerdb.txt file. It can be edited graphically with . An up to date database can be found on .

Specific devices

While most gamepads, especially USB based ones should just work, some may require (or give better results) if you use alternative drivers. If it does not work the first time, do not give up, and read the following sections thoroughly!

Dance pads

Most dance pads should work. However some pads, especially those used from a video game console via an adapter, have a tendency to map the directional buttons as axis buttons. This prevents hitting left-right or up-down simultaneously. This behavior can be fixed for devices recognized by xpad via a module option:

# modprobe -r xpad
# modprobe xpad dpad_to_buttons=1

If that did not work, you can try or patching the joydev kernel module (https://github.com/adiel-mittmann/dancepad).

Logitech Thunderpad Digital

Logitech Thunderpad Digital will not show all the buttons if you use the analog module. Use the device specific adi module for this controller.

Nintendo Gamecube Controller

Dolphin Emulator has a page on their wiki that explains how to use the official Nintendo USB adapter with a Gamecube controller. This configuration also works with the Mayflash Controller Adapter if the switch is set to "Wii U".

Using the kernel Nintendo HID driver

The hid-nintendo kernel HID driver was mainlined in kernel 5.16. If you are using an earlier kernel, you will need to install the DKMS module named . The driver provides support for rumble, battery level, and control of the player and home LEDs. It supports the Nintendo Switch Pro Controller over both USB and Bluetooth in addition to the Joy-Cons.

An alternate DKMS module named patches in support for the Switch Online NES and SNES controllers.

Using joycond userspace daemon

The hid-nintendo kernel driver does not handle the combination of two Joy-Cons into one virtual input device. That functionality has been left up to userspace. is a userspace daemon that combines two kernel Joy-Con evdev devices into one virtual input device using uinput. An application can use two Joy-Cons as if they are a single controller. When the daemon is active, Switch controllers will be placed in a pseudo pairing mode, and the LEDs will start flashing. Holding the triggers can be used to pair controllers and make them usable. To pair two Joy-Cons together, press one trigger on each Joy-Con.

Using hid-nintendo Pro Controller with Steam games (without joycond)

The hid-nintendo driver currently conflicts with Steam using hidraw to implement its own Pro Controller driver. If you wish to use the Steam implementation, the hid-nintendo driver can be blacklisted. Alternatively if you want to use hid-nintendo with a Steam game directly, Steam can be started without access to hidraw using firejail:

$ firejail --noprofile --blacklist=/sys/class/hidraw/ steam

An issue has been opened on the steam-for-linux GitHub repo.

Using hid-nintendo Pro Controller with Steam games (with joycond)

A workaround has been added to joycond to have udev rules to block Steam from accessing hidraw for the Pro Controller.

That alone is not enough though, since Steam will not recognize the Pro Controller when access to hidraw is blocked. To get around that issue, joycond supports creating a virtual Pro Controller with a different product ID. Steam will view this as a typical controller. This gives the best of both worlds, where hid-nintendo can be used both inside and outside of Steam simultaneously.

To pair the Pro Controller in virtual mode, press the Plus and Minus buttons simultaneously (instead of using the triggers). You must be using a version of joycond including this commit.

Mimic Xbox 360 controller

Some games and emulators are hardcoded to work with an Xbox 360 controller, and will not work with other controllers. To get around this, you need to create a virtual Xbox 360 controller that emulates the expected interface, but is bound to your controller's inputs. This can be done with Steam Input or xboxdrv.

Use positional layout on SDL2 applications

By default, SDL2 maps buttons on Nintendo controllers according to the gamepad's label instead of the button's position. This is enabled by the SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS setting, which defaults to for controllers known to use the Nintendo button layout, and for other controllers. This behavior can be overridden for all controllers by setting the environment variable. For example, if Nintendo's conception of A/B and X/Y is undesirable, set .

iPEGA-9017s and other Bluetooth gamepads

If you want to use one of the widely available Bluetooth gamepads, such as iPEGA-9017s designed mostly for Android and iOS devices you would need xboxdrvAUR, , , and . You should connect it in gamepad mode (if there are different modes, choose the gamepad one). Technically it is ready to be used, but in most cases games would not recognize it, and you would have to map it individually for all application. The best way to simplify it and make it work with all applications is to mimic Microsoft X360 controller with xboxdrvAUR. Once connected you can create a udev rule to give it a persistent name, that would come in handy when setting it up.

Replace "Bluetooth Gamepad" with your device name and "00:17:02:01:ae:2a" with your device's address.

Next, create a configuration for xboxdrvAUR somewhere, for example:

~/.config/xboxdrv/ipega.conf
#iPEGA PG-9017S Config 

[xboxdrv]
evdev-debug = true
evdev-grab = true
rumble = false
mimic-xpad = true

[evdev-absmap]
ABS_HAT0X = dpad_x
ABS_HAT0Y = dpad_y

ABS_X = X1
ABS_Y = Y1

ABS_Z  = X2
ABS_RZ = Y2

[axismap]
-Y1 = Y1
-Y2 = Y2

[evdev-keymap]
BTN_EAST=a
BTN_C=b
BTN_NORTH=y
BTN_SOUTH=x
BTN_TR2=start
BTN_TL2=back
BTN_Z=rt
BTN_WEST=lt

BTN_MODE = guide

Refer to to see all the options.

Now when you have the configuration and your device is connected you can start the xboxdrvAUR like so:

# xboxdrv --evdev /dev/btjoy --config .config/xboxdrv/ipega.conf

Your games will now work with bluetooth gamepad as long as xboxdrv is running.

iPEGA-9068 and 9087

For this model, use the same procedures as above, but with the configs:

Defender X7

For this model, use the same procedures as above, but with the configs:

Now when you have the configuration and your device is connected you can start the xboxdrvAUR like so:

# xboxdrv --evdev /dev/btjoy --config .config/xboxdrv/defender.conf

Stadia Controller

The Stadia controller can also be mapped with xboxdrv:

Steam Controller

The Steam client will recognize the controller and provide keyboard/mouse/gamepad emulation while Steam is running. The in-game Steam overlay needs to be enabled and working in order for gamepad emulation to work. You may need to run with root privileges or plug the dongle out and in again, if the controller does not work immediately after installing and running Steam. If all else fails, try restarting the computer while the dongle is plugged in.

If you are using the controller connected via Bluetooth LE, make sure the user is part of the input group.

If you cannot get the Steam Controller to work, see #Steam Controller not pairing.

Alternatively you can install to have controller and mouse emulation without Steam or for a versatile graphical configuration tool simillar to what is provided by the Steam client.

Wine

can also be used to make the Steam Controller work for games running under Wine. You need to find and download the application  (e.g. from here). Then copy the files , , xinput1_3.dll and  to the directory that contains your game executable. Edit  and only change the following values under  to remap the Steam Controller correctly to a XBox controller.

Now start python-steamcontroller in Xbox360 mode (). You might also want to copy XInputTest.exe from to the same directory and run it with Wine in order to test if the mappings work correctly. However neither mouse nor keyboard emulation work with this method.

Alternatively you can use for a similar graphical setup as Steam's own configurator. As of writing, it is a bit buggy here and there but offers an easy click and go way of configuring the controller.

Xbox 360 controller

Both the wired and wireless (with the Xbox 360 Wireless Receiver for Windows) controllers are supported by the kernel module and should work without additional packages. Note that using a wireless Xbox360 controller with the Play&Charge USB cable will not work. The cable is for recharging only and does not transmit any input data over the wire.

It has been reported that the default xpad driver has some issues with a few newer wired and wireless controllers, such as:

If you use the TLP power management tool, you may experience connection issues with your Microsoft wireless adapter (e.g. the indicator LED will go out after the adapter has been connected for a few seconds, and controller connection attempts fail, four LEDs keep blinking but controller works). This is due to TLP's USB autosuspend functionality, and the solution is to add the Microsoft wireless adapter's device ID to TLP blacklist (to check device ID to blacklist, run ; for original MS wireless dongle just add to ), check TLP configuration for more details.

If you experience such issues, you can use #xboxdrv as the default driver instead.

If you wish to use the controller for controlling the mouse, or mapping buttons to keys, etc. you should use the xf86-input-joystickAUR package (configuration help can be found using ). If the mouse locks itself in a corner, it might help changing the MatchDevicePath in from /dev/input/event* to .

In order to connect via Bluetooth using KDE, add the following kernel parameter .

If you experience problems with the rumble feature not working in games, it may be necessary to set the environment variable

xboxdrv

xboxdrv is an alternative to which provides more functionality and might work better with certain controllers. It works in userspace and can be launched as system service.

Install it with the xboxdrvAUR package. Then start/enable xboxdrv.service.

If you have issues with the controller being recognized but not working in steam games or working but with incorrect mappings, it may be required to modify you configuration as such:

Then restart xboxdrv.service.

Multiple controllers

xboxdrv supports a multitude of controllers, but they need to be set up in . For each extra controller, add an line. For example, when using 4 controllers, add it 3 times:

Then restart xboxdrv.service.

Mimic Xbox 360 controller with other controllers

xboxdrv can be used to make any controller register as an Xbox 360 controller with the switch. This may be desirable for games that support Xbox 360 controllers out of the box, but have trouble detecting or working with other gamepads.

First, you need to find out what each button and axis on the controller is called. You can use for this. Run and select the device event ID number (/dev/input/event*) that corresponds to your controller. Press the buttons on the controller and move the axes to read the names of each button and axis.

Here is an example of the output:

Event: time 1380985017.964843, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90003
Event: time 1380985017.964843, type 1 (EV_KEY), code 290 (BTN_THUMB2), value 1
Event: time 1380985017.964843, -------------- SYN_REPORT ------------
Event: time 1380985018.076843, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90003
Event: time 1380985018.076843, type 1 (EV_KEY), code 290 (BTN_THUMB2), value 0
Event: time 1380985018.076843, -------------- SYN_REPORT ------------
Event: time 1380985018.460841, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90002
Event: time 1380985018.460841, type 1 (EV_KEY), code 289 (BTN_THUMB), value 1
Event: time 1380985018.460841, -------------- SYN_REPORT ------------
Event: time 1380985018.572835, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90002
Event: time 1380985018.572835, type 1 (EV_KEY), code 289 (BTN_THUMB), value 0
Event: time 1380985018.572835, -------------- SYN_REPORT ------------
Event: time 1380985019.980824, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90006
Event: time 1380985019.980824, type 1 (EV_KEY), code 293 (BTN_PINKIE), value 1
Event: time 1380985019.980824, -------------- SYN_REPORT ------------
Event: time 1380985020.092835, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90006
Event: time 1380985020.092835, type 1 (EV_KEY), code 293 (BTN_PINKIE), value 0
Event: time 1380985020.092835, -------------- SYN_REPORT ------------
Event: time 1380985023.596806, type 3 (EV_ABS), code 3 (ABS_RX), value 18
Event: time 1380985023.596806, -------------- SYN_REPORT ------------
Event: time 1380985023.612811, type 3 (EV_ABS), code 3 (ABS_RX), value 0
Event: time 1380985023.612811, -------------- SYN_REPORT ------------
Event: time 1380985023.708768, type 3 (EV_ABS), code 3 (ABS_RX), value 14
Event: time 1380985023.708768, -------------- SYN_REPORT ------------
Event: time 1380985023.724772, type 3 (EV_ABS), code 3 (ABS_RX), value 128
Event: time 1380985023.724772, -------------- SYN_REPORT ------------

In this case, , and are buttons and is the X axis of the right analogue stick. You can now mimic an Xbox 360 controller with the following command:

$ xboxdrv --evdev /dev/input/event* --evdev-absmap ABS_RX=X2 --evdev-keymap BTN_THUMB2=a,BTN_THUMB=b,BTN_PINKIE=rt --mimic-xpad

The above example is incomplete. It only maps one axis and 3 buttons for demonstration purposes. Use to see the names of the Xbox controller buttons and axes and bind them accordingly by expanding the command above. Axes mappings should go after and button mappings follow (comma separated list; no spaces).

By default, xboxdrv outputs all events to the terminal. You can use this to test that the mappings are correct. Append the --silent option to keep it quiet.

Using generic/clone controllers

Some clone gamepads might require a specific initialization sequence in order to work (Super User answer). For that you should run the following python script as the root user:

Connect Xbox Wireless Controller with USB cable

This is supported by the kernel and works any without additional packages.

Update controller firmware via Windows 10

The firmware of the Xbox Wireless Controller used to cause loops of connecting/disconnecting with Bluez. The best workaround is to plug the controller (via a USB cord) to a Windows 10 computer, download the Xbox Accessories application through the Microsoft Store, and update the firmware of the controller.

xpadneo

A relatively new driver which does support the Xbox One S and Xbox Series X|S controller via Bluetooth is called xpadneo. In addition to these two models, it has also basic support for the Xbox Elite Series 2 Wireless controller. In exchange for fully supporting just two controllers so far, it enables one to read out the correct battery level, supports rumble (even the one on the trigger buttons - L2/R2), corrects the (sometimes wrong) button mapping and more.

Installation is done using DKMS: .

xone

xone is a Linux kernel driver for Xbox One and Xbox Series X|S accessories. It serves as a modern replacement for xpad, supersedes xow. Currently working via wired or with the wireless dongle. This driver is still in active development.

Install xone-dkmsAUR and, if using the wireless dongle, . Reboot your system.

If the controller performs poorly (low polling rate) after being paired, you will need to update the controller's firmware in Windows using the "Xbox Accessories" app from the Microsoft Store. Theoretically this should be possible with USB passthrough to a Windows virtual machine, but you may need to dual boot to an actual (baremetal) Windows installation for the Xbox Accessories application to see the controller and do the firmware update.

Also, if you dual boot Windows, pairing the controller & adapter in Windows may cause the pairing to be lost in Linux. You will need to re-pair the controller & dongle when you reboot into Linux. This also happens in the other direction — when the controller & dongle are paired in Linux, they will need to be re-paired the next time you want to use them in Windows.

xow

xow is a project that allows connection with a wireless dongle. It is currently in very early stages of development. It can be installed via

xone (made by the same developer) supersedes xow; using xone instead of xow is "highly recommended."

Logitech Dual Action

The Logitech Dual Action gamepad has a very similar mapping to the PS2 pad, but some buttons and triggers need to be swapped to mimic the Xbox controller.

# xboxdrv --evdev /dev/input/event* \
   --evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_RZ=x2,ABS_Z=y2,ABS_HAT0X=dpad_x,ABS_HAT0Y=dpad_y \
   --axismap -Y1=Y1,-Y2=Y2 \
   --evdev-keymap BTN_TRIGGER=x,BTN_TOP=y,BTN_THUMB=a,BTN_THUMB2=b,BTN_BASE3=back,BTN_BASE4=start,BTN_BASE=lt,BTN_BASE2=rt,BTN_TOP2=lb,BTN_PINKIE=rb,BTN_BASE5=tl,BTN_BASE6=tr \
   --mimic-xpad --silent

PlayStation 2 controller via USB adapter

To fix the button mapping of PS2 dual adapters and mimic the Xbox controller you can run the following command:

# xboxdrv --evdev /dev/input/event* \
   --evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_RZ=x2,ABS_Z=y2,ABS_HAT0X=dpad_x,ABS_HAT0Y=dpad_y \
   --axismap -Y1=Y1,-Y2=Y2 \
   --evdev-keymap   BTN_TOP=x,BTN_TRIGGER=y,BTN_THUMB2=a,BTN_THUMB=b,BTN_BASE3=back,BTN_BASE4=start,BTN_BASE=lb,BTN_BASE2=rb,BTN_TOP2=lt,BTN_PINKIE=rt,BTN_BASE5=tl,BTN_BASE6=tr \
   --mimic-xpad --silent

Pairing via USB

If you own a PS3 controller and can connect with USB, plug it to your computer and press the PS button. The controller will power up and one of the four LEDs should light up indicating the controller's number.

Pairing via Bluetooth

Install . Make sure bluetooth is working by following the first five steps of Bluetooth#Pairing and leave the bluetoothctl command running, then turn on the controller by pressing the middle 'PS' button(all 4 leds should be blinking quickly ~4 hz) and connect to your computer using usb. Lastly, type yes in the bluetoothctl prompt when asked ''.

Alternative instructions: To connect your PS3 controller to your computer using Bluetooth, you first need to install and then connect your controller via USB. A pop-up should appear asking for pairing. Click on Trust & Authorize. You can now unplug your controller and press the PS button. The controller will connect and a LED will remain solid. You can now use it to play games. Connecting using the USB cable is only needed after the controller has been connected to another system.

PlayStation 3/4 controller

The DualShock 3, DualShock 4 and Sixaxis controllers work out of the box when plugged in via USB (the PS button will need to be pushed to begin). They can also be used wirelessly via Bluetooth.

Steam properly recognizes it as a PS3 pad and Big Picture can be launched with the PS button. Big Picture and some games may act as if it was a 360 controller. Gamepad control over mouse is on by default. You may want to turn it off before playing games, see #Joystick moving mouse.

Pairing via Bluetooth

Install the , , and packages, which includes the sixaxis plugin. Then start the bluetooth service and ensure bluetooth is powered on. If using bluetoothctl start it in a terminal and then plug the controller in via USB. You should be prompted to trust the controller in bluetoothctl. A graphical bluetooth front-end may program your PC's bluetooth address into the controller automatically. Hit the PlayStation button and check that the controller works while plugged in.

You can now disconnect your controller. The next time you hit the PlayStation button it will connect without asking anything else.

Alternatively, on a PS4 controller you can hold the share button and the PlayStation button simultaneously (for a few seconds) to put the gamepad in pairing mode, and pair as you would normally.

GNOME's Settings also provides a graphical interface to pair sixaxis controllers when connected by wire.

Remember to disconnect the controller when you are done as the controller will stay on when connected and drain the battery.

Using generic/clone controllers

Using generic/clone Dualshock controllers is possible, however there is an issue that may require to install a patched package. The default Bluetooth protocol stack does not detect some of the clone controllers. The package is a version patched to be able to detect them. bluez-plugins-ps3AUR is another package that only patch the bluez-plugins may work for some controllers.

Pairing via USB

Connect your controller via USB and press the button.

Pairing via Bluetooth

If you want to use bluetooth mode, hold down the button and button together. The white LED of the controller should blink very quickly, and the wireless controller can be paired with your bluetooth manager (bluez, gnome-bluetooth).

Disable touchpad acting as mouse

This fixes conflicts with games that actually use touchpad as part of the gamepad, such as Rise of the Tomb Raider. This will work with both DualShock4 and DualSense controllers.

Define the touchpad as ignored in the X configuration file:

Then, restart X11.

Playstation 5 (Dualsense) controller

Configure button mapping (thanks to yoyossef):

# xboxdrv \
  --evdev /dev/input/by-id/usb-Sony_Interactive_Entertainment_Wireless_Controller-if03-event-joystick \
  --evdev-absmap ABS_HAT0X=dpad_x,ABS_HAT0Y=dpad_y,ABS_X=X1,ABS_Y=Y1,ABS_RX=X2,ABS_RY=Y2,ABS_Z=LT,ABS_RZ=RT \
  --evdev-keymap BTN_SOUTH=A,BTN_EAST=B,BTN_NORTH=Y,BTN_WEST=X,BTN_START=start,BTN_MODE=guide,BTN_SELECT=back \
  --evdev-keymap BTN_TL=LB,BTN_TR=RB,BTN_TL2=LT,BTN_TR2=RT,BTN_THUMBL=TL,BTN_THUMBR=TR \
  --axismap -y1=y1,-y2=y2                          \
  --mimic-xpad                                     \
  --silent

Some applications, for example, Steam inside Geforce NOW inside web browser, may be confused with original joystick events, which shadow the newly created event source. Simply deleting works this around.

The PlayStation and mode buttons still do not work, however.

dualsensectl

dualsensectl is a tool that can toggle the lightbar and microphone (and its LED), monitor the battery status, and power off the controller. To use it, install dualsensectl-gitAUR.

Tips and Tricks

Gamepad over network

If you want to use your gamepad with another computer over a network, you can use USB/IP or to do this.

Troubleshooting

Device permissions

Gamepad devices are affected by udev rules: unless they grant access to the device, it simply will not be readable by users. This section investigates the possibility of you already having a configuration file handling this.

Any gamepad device, regardless of whether it is over USB or Bluetooth, is handled by the "input" subsystem of the kernel, corresponding with . It's also common for udev rules to target the "hidraw" kernel module. Combining these, we can understand udev's handling of these devices by inspecting the configuration shipped by packages:

$ grep --extended-regexp 'SUBSYSTEM=="input"|KERNEL=="hidraw' --recursive /usr/lib/udev/rules.d

Some examples of applications which ship noteworthy rules:

  • systemd's default rules set the group of all input devices to input, and the mode of joystick devices to .
  • Steam ships udev rules allowing access to a variety of controllers. See this Steam discussion for further info about the contents of the rules.
  • Dolphin emulator ships udev rules allowing access to controllers it supports.

If your system does not already happen to have a udev rule for the device you want to use, you can either write one yourself or install the package and restart your computer.

Joystick moving mouse

Sometimes USB gamepad can be recognized as HID mouse (only in X, it is still being installed as as well). Known issue is cursor being moved by the joystick, or escaping to en edge of a screen right after plugin. If your application can detect gamepad by itself, you can remove the xf86-input-joystickAUR package.

A more gentle solution is described in #Disable joystick from controlling mouse.

Gamepad is not working in FNA/SDL based games

If you are using a generic non-widely used gamepad you may encounter issues getting the gamepad recognized in games based on SDL. Since 14 May 2015, FNA supports dropping a gamecontrollerdb.txt into the executable folder of the game, for example the SDL_GameControllerDB.

As an alternative and for older versions of FNA or for SDL you can generate a mapping yourself by downloading the SDL source code via https://libsdl.org/, navigating to , compile the controllermap.c program (alternatively install ) and run the test. After completing the controllermap test, a GUID will be generated that you can put in the environment variable which will then be picked up by SDL/FNA games. For example:

$ export SDL_GAMECONTROLLERCONFIG="030000008f0e00000300000010010000,GreenAsia Inc. USB Joystick ,platform:Linux,x:b3,a:b2,b:b1,y:b0,back:b8,start:b9,dpleft:h0.8,dpdown:h0.0,dpdown:h0.4,dpright:h0.0,dpright:h0.2,dpup:h0.0,dpup:h0.1,leftshoulder:h0.0,leftshoulder:b6,lefttrigger:b4,rightshoulder:b7,righttrigger:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a3,righty:a2,"

Gamepad is not recognized by all programs

Some software, Steam for example, will only recognize the first gamepad it encounters. Due to a bug in the driver for Microsoft wireless periphery devices this can in fact be the bluetooth dongle. If you find you have a and /dev/input/event* belonging to you keyboard's bluetooth transceiver you can get automatically get rid of it by creating according udev rules:

Correct the to match your device. The correct value can be found by running

# udevadm info -an /dev/input/js0

Assuming the device in question is . After you placed the rule reload the rules with

# udevadm control --reload

Then replug the device making you trouble. The joystick and event devices should be gone, although their number will still be reserved. But the files are out of the way.

Vibration does not work in certain Windows games

Some Windows games look for an Xbox 360 controller in particular, causing vibration to not work even with otherwise functional XInput gamepads. One example of such game is Inside.

As a work-around for these games:

  • Unload the kernel module.
  • Launch , including Xbox 360 mimicking gamepad and with vibration support:
# xboxdrv --mimic-xpad --force-feedback

Steam Controller not pairing

There are some unknown cases where the packaged udev rule for the Steam controller does not work (). The most reliable workaround is to make the controller world readable. Copy the rule to with a later prioritiy and change anything that says MODE="0660" to e.g.

You may have to reboot in order for the change to take effect.

Steam Controller makes a game crash or not recognized

If your Steam Controller is working well in Steam Big Picture mode, but not recognized by a game or the game starts crashing when you plug in the controller, this may be because of the native driver that has been added to the Linux kernel 4.18. Try to unload it, restart Steam and replug the controller.

The module name of the driver is , so to unload it you may perform:

# rmmod hid_steam

Xbox One Wireless Gamepad detected but no inputs recognized

This can occur when using a third party Xbox One controller with the or #xboxdrv drivers. Try switching to #xpadneo.

Controller not recognized when using Bluetooth

Install the package and run it with the hidraw (ds4drv --hidraw) backend parameter.

Button mapping

To fix the button mapping of PS4 controller you can use the following command with xboxdrv (or try with the ds4drv program, ):

# xboxdrv \
   --evdev /dev/input/by-id/usb-Sony_Computer_Entertainment_Wireless_Controller-event-joystick\
   --evdev-absmap ABS_X=x1,ABS_Y=y1                 \
   --evdev-absmap ABS_Z=x2,ABS_RZ=y2                \
   --evdev-absmap ABS_HAT0X=dpad_x,ABS_HAT0Y=dpad_y \
   --evdev-keymap BTN_A=x,BTN_B=a                   \
   --evdev-keymap BTN_C=b,BTN_X=y                   \
   --evdev-keymap BTN_Y=lb,BTN_Z=rb                 \
   --evdev-keymap BTN_TL=lt,BTN_TR=rt               \
   --evdev-keymap BTN_SELECT=tl,BTN_START=tr        \
   --evdev-keymap BTN_TL2=back,BTN_TR2=start        \
   --evdev-keymap BTN_MODE=guide                    \
   --axismap -y1=y1,-y2=y2                          \
   --mimic-xpad                                     \
   --silent

Fix Motion control conflict (gamepad will not work on some applications)

Dualshock 4 V1 and V2 are both like 3 devices, touchpad, motion control, and joypad.

With some software like Parsec and Shadow cloud gaming streaming applications, motion control is in conflict with joypad, you can disable touchpad and motion control by adding the following udev rule:

This should work in USB and Bluetooth mode.

gollark: We can only transfer a few bytes per second into lyricspace™. The message inference on your end is quite bad.
gollark: https://www.definder.net/apioform ← a gender.
gollark: Which one?
gollark: What about GTech™ GPunctuation™?
gollark: '' is 121.
This article is issued from Archlinux. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.