Recently I solved an issue for setting up my Wireless (via Bluetooth) controller on Steam for Linux (distr. Ubuntu 18.10), and decided to elaborate my experience a little better, and share my results and observations with you all.
In my previous article on the same topic, I dealt with the basic setup of the driver and the application for games which run natively on Linux. In the following sections I have considered instead the cases of games running with Wine or Proton (via Steam Play).
The relevant steps mentioned in the previous article are the ones that enabled us to launch the xboxdrv with the following command:
$ xboxdrv --evdev "/dev/input/event-asus-gamepad" --config xboxdrv.config
And that consequently enabled us to launch the Steam environment with a similar script:
#!/bin/sh if [ -h /dev/input/event-asus-gamepad ] then # remove any previous instance: killall -KILL xboxdrv # start the new driver in userspace mode: xboxdrv --evdev "/dev/input/event-asus-gamepad" \ --config xboxdrv.config & fi /usr/bin/steam %U
The configuration steps might vary according to the specific input API used in the game implementation.
Games running on Wine/Proton with DirectInput support
Most of the games issued until 2015 used to have support for the DirectInput API, which used to be the first Microsoft API (available in the DirectX library package) to process data from a joystick, or other game controller. Additional information on the API are available in the official Microsoft API documentation.
Few games such as Dark Souls (the original release and the Prepare to Die edition, but not the Remastered), Dark Souls II (both the original and Scholar of the First Sin releases), One Piece Pirate Warriors 3 and several else I tried are actually still using this API.
Before setting up the DirectInput controller configuration, make sure to turn the controller on and launch the xboxdriver as shown in the section above, with the following statement:
$ xboxdrv --evdev "/dev/input/event-asus-gamepad" --config xboxdrv.config
Then, in order to access to the driver setup, you have to run the following command:
$ WINEPREFIX={path to the Wine Prefix for the specific game} wine control
Please keep in mind that in case of use of Steam Play (Proton) the WINEPREFIX is usually the following:
$ export WINEPREFIX=~/.steam/steam/steamapps/compatdata/${GAME_ID}/pfx
and the wine executable to use is under the following path:
~/.steam/steam/steamapps/common/Proton\ ${VERSION}/dist/bin/
where:
- ${GAME_ID} is the Unique App ID of the specific game in the Steam Store (i.e. 211420 for Dark Souls: Prepare to Die, 335300 for Dark Souls II: Scholar of the First Sin, etc.);
- ${VERSION} is the version of Proton that Steam Play uses specifically for that game, available with the following statement:
$ cat .steam/steam/steamapps/compatdata/${GAME_ID}/version
I.e., for "Dark Souls II: Scholar of the First Sin", the wine control statement above would look like this:
$ WINEPREFIX=~/.steam/steam/steamapps/compatdata/335300/pfx/ ~/.steam/steam/steamapps/common/Proton\ 3.16/dist/bin/wine control
Once you launch the wine control statement, select the Game Controllers app from the newly opened window:
In the list, select the entry corresponding to the hardware controller (in my case "ASUS Gamepad") and press Disable, as show in the picture here below:
Press then OK and close the wine control application. This will make sure that DirectInput will get the Input just from the virtual controller defined via the xboxdrv driver.
Open them Steam and run the game to try the applied settings.
Alternatively to the guided procedure above, more skilled users might perform the same activity via the Registry Keys defined for that specific Wine Prefix. All the documentation is available at this link.
Games running on Wine/Proton with Xinput support
Most recent games (such as The Witcher 3: Wild Hunt, Dark Souls Remastered, Dark Souls 3 and generally all the games running just for the Windows 64bit architecture) use the Microsoft Xinput API. Additional information for this API are available in the official Microsoft documentation.
If the Xbox Controller Support has been correctly configured in Steam (as shown in the picture here below), there is nothing else you need to do. The in-game Xinput API will recognise the controller automatically as soon as you press any button or move any axis.
Conclusions
The observations I have collected in these two articles have just the purpose to share my favourite procedure and setup for using the same controller (and keeping the same configuration) in several cases.
I find this procedure particularly useful either if I am looking for a casual gaming day (where I swap between several games in my Steam library) or when I decide to focus for just one of them for the whole day.
The two main reasons I decided to migrate (100% successfully) to a Bluetooth controller are of course the following:
- It's wireless
- It's a standard
But of course feel free to add your own comments and observations about the topic. I'll be pretty glad to answer and discuss about the topic.
If it's not detected in games, sounds like you don't have udev rules setup for it. You can setup that easily by installing steam-devices on Ubuntu, which seriously should be a dependency on the Steam install. I've bugged Canonical about it multiple times.
That, or you may now be experiencing an issue as a result of it now having a driver in the Linux Kernel (noted here.
I haven't had any problems with it. It's actually really great as a companion to a regular controller, for those games that are keyboard only.
It used to happen to me as well. Decided to disable the screensaver at the moment, but I'm looking for a workaround.
yes unfortunately the most insidious issue for me was with the triggers and the axes: without any configuration, the RT was mapping the horizontal right axis (and then the camera controls). It was quite some fun to see the whole world spinning around when launching the game.
Hi Feda,
what happens if you try the evtest command? Do you get the expected keys in output for the pressed buttons in input?
$ evtest /dev/input/eventX
Last edited by LordDaveTheKind on 28 January 2019 at 1:05 pm UTC
Hi officernice,
I have never used Kodi with a controller before honestly, but I did some checks today.
It seems that the package kodi-peripheral-joystick is missing in the Ubuntu 18.10 official repository. I had to install the Kodi release coming from the development team:
$ sudo add-apt-repository ppa:team-xbmc/ppa
$ sudo apt-get update
I've turned on my gamepad and then run the xboxdrv driver with the same configuration:
$ xboxdrv --evdev /dev/input/event-asus-gamepad --config ~/.config/xboxdrv/native.conf &
And launched Kody. In the menu Settings / System / Input, I've configured the "Xbox controller (userspace driver)" as a Kodi controller and checked each key mapping. And it worked.
Last edited by LordDaveTheKind on 29 January 2019 at 6:34 pm UTC