Articles on: Wooting keyboards

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:

The Xinput driver is automatically applied every time a Wooting keyboard is connected
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:

Debian based (Ubuntu / Linux Mint / Pop! OS etc)



sudo apt-get install xboxdrv -y


Arch based



The official repos do not contain a package for xboxdrv, it's only available in the AUR. If you're using an AUR helper such as yay you can just run this:

yay -S xboxdrv


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
StopWhenUnneeded=true
   
[Service]
Type=simple
ExecStart=/usr/bin/xboxdrv --type xbox360 --device-by-id %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@03eb:ff01"

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

# Wooting Two Lekker Edition
SUBSYSTEM=="usb", ENV{PRODUCT}=="31e3/1210/*", ENV{INTERFACE}=="255/93/1", TAG+="systemd", ENV{SYSTEMD_WANTS}="wooting-xinput@31e3:1210"

# Wooting Two HE
SUBSYSTEM=="usb", ENV{PRODUCT}=="31e3/1220/*", ENV{INTERFACE}=="255/93/1", TAG+="systemd", ENV{SYSTEMD_WANTS}="wooting-xinput@31e3:1220"


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"

# Wooting Two Lekker Edition
SUBSYSTEM=="usb", ATTRS{idVendor}=="31e3", ATTRS{idProduct}=="1210", MODE="0660", GROUP="input"

# Wooting Two HE
SUBSYSTEM=="usb", ATTRS{idVendor}=="31e3", ATTRS{idProduct}=="1220", 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


For a Wooting Two Lekker Edition with this command:

xboxdrv --type xbox360 --device-by-id 31e3:1210 --silent --quiet --detach-kernel-driver --mimic-xpad


For a Wooting Two HE with this command:

xboxdrv --type xbox360 --device-by-id 31e3:1220 --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

Updated on: 19/01/2022

Was this article helpful?

Share your feedback

Cancel

Thank you!