Guide – Configuring XInput support for Linux

Background

On Linux devices it's recommended to use DirectInput (generic joystick) for analog input with Wooting keyboards, however with a few configurations, it's also possible to use Xinput (xbox controller) for analog input. 

Linux does not officially support Xinput. There's a few drivers available such as "xpad" or "xboxdrv" to support these Xinput controllers but they don't support Wooting's native Xinput right out of the box. This guide helps setup the configuration so that the aforementioned drivers can be used for Xinput analog input.

There's two configuration scenarios:

  1. The Xinput driver is automatically applied every time a Wooting keyboard is connected
  2. The driver is applied manually by the user

For the first scenario, a service has to be added to handle the driver which is controlled by udev rules every time a Wooting keyboard is detected.
For the second scenario, other rules need to be added to grant a dedicated group access to the device and the driver. This will require the user to start it with a command and higher privileges.

Preconditions

Some Linux distributions already have "xboxdrv" installed, but if not you need to install that package first by running this command:

sudo apt-get install xboxdrv -y

Scenario 1 – Automatic driver assignment

Creating the service for driver assignment

Create a new file called 'wooting-xinput@.service' under the path '/etc/systemd/system/' with the following content. The name should not be changed because it’s used in the udev rules later on and the file extension must be 'service' otherwise it won't work.

'/etc/systemd/system/wooting-xinput@.service'

[Unit]
Description=Loads the xboxdrv user-space-driver for the native Xbox 360 interface of the Wootings

[Service]
Type=simple
ExecStart=/usr/bin/xboxdrv --type xbox360 --device-by-id 03eb:%I --silent --quiet --detach-kernel-driver --mimic- xpad

Applying the service

In order the service can be used the changed systemd manager configuration need to be reloaded by running this command:sudo systemctl daemon-reload

Creating the rules for controlling the service

Create a new file called 'wooting-xinput.rules' under the path '/etc/udev/rules.d/' with the following content. The name can be changed but the file extension must be 'rules' otherwise it won't work.

'/etc/udev/rules.d/wooting-xinput.rules'

# Wooting One
SUBSYSTEM=="usb", ENV{PRODUCT}=="3eb/ff01/*", ENV{INTERFACE}=="255/93/1", TAG+="systemd", ENV{SYSTEMD_WANTS}="wooting-xinput@ff01"

# Wooting Two
SUBSYSTEM=="usb", ENV{PRODUCT}=="3eb/ff02/*", ENV{INTERFACE}=="255/93/1", TAG+="systemd", ENV{SYSTEMD_WANTS}="wooting-xinput@ff02"

Applying the new rules

To activate the rules they must be loaded and applied by the following command:

sudo udevadm control --reload-rules && sudo udevadm trigger

It can happen that this still doesn't apply and activate the rules, then a reboot of your whole system is required.

Scenario 2 – Manual driver assignment

Creating the rules for granting user access

Create a new file called 'wooting-xinput.rules' under the path '/etc/udev/rules.d/' with the following content. The name can be changed but the file extension must be 'rules' otherwise it won't work.

'/etc/udev/rules.d/wooting-xinput.rules'

# Granting all members of the group "input" user access the XInput driver "xboxdrv" KERNEL=="uinput", MODE="0660", GROUP="input", OPTIONS+="static_node=uinput"

# Wooting One
SUBSYSTEM=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="ff01", MODE="0660", GROUP="input"

# Wooting Two
SUBSYSTEM=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="ff02", MODE="0660", GROUP="input"

These rules will provide every user in the group 'input' the ability to load the driver manually without the need of running the command with advanced privileges such as sudo. This is needed because xboxdrv needs access to the RAW data of the interfaces of the device.

Applying the new rules

To activate the rules they must be loaded and applied by the following command:

sudo udevadm control --reload-rules && sudo udevadm trigger

It can happen that this still doesn't apply and activate the rules, then a reboot of your whole system is required.

Loading the driver

For a Wooting One the driver can be manually loaded by this command:

xboxdrv --type xbox360 --device-by-id 03eb:ff01 --silent --quiet --detach-kernel-driver --mimic-xpad

For a Wooting Two with this command:

xboxdrv --type xbox360 --device-by-id 03eb:ff02 --silent --quiet --detach-kernel-driver --mimic-xpad

The option "silent" and "quiet" suppresses the output of the controls of the device, "detach-kernel-driver" unloads any already used kernel driver for the device like if "xpad" is used and "mimic-xpad" forces the driver to use the same controls and appearance like xpad to provide compatibility for games. 

Credit for this helpdoc: @Rocky_4 on Discord

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us