A lot of games today need a controller … yes, even on PC you can’t ignore that fact. One of the best controllers out there is (IMHO) the XBox 360 Wireless Controller from Microsoft. The Wired version of this controller can be easily connected through Plug & Play under Linux. The standard loaded driver xpad then can handle it. But what do you have to do if the controller is the wireless Version?
First things first
You need of course a receiver which gets all the signals that are sent from your controller. This receiver is (normally) not included when you’re buying the controller. The receiver also comes from Microsoft and costs round about 20 $. I have also seen some third party products here which are way more cheaper, but actually I really can’t say if they are working that well.
After you plugged in the receiver, the kernel will recognize it but yet it is actually unable to do anything.
Install the driver
As I mentioned before, if you’re useing the wired controller, then you have to nothing to be worried about. Everything will work out of the box.
Anyways, for the wireless XBox 360 Controller you need a driver which is called ‘xboxdrv’.
Under Ubuntu and Debian this driver can be easily installed with apt. This means the driver is already available in the repositorys:
sudo apt-get install xboxdrv
In openSUSE the driver is also in the official repositorys as long as you are on openSUSE Tumbleweed or Leap (>= 42.1):
sudo zypper install xboxdrv
For Fedora, Arch and any other distribution you have to check for your owner whether you need a extra repository for the driver or not.
Start the driver
Starting the driver with default settings is rather simple. The following command starts the driver with default settings:
If you didn’t unloaded the xpad driver before you will run into an error message that the driver couldn’t be loaded because the xpad driver is already loaded.
To unload the xpad module you can use ‘rmmod xpad’ or let the xboxdrv do that for you:
sudo xboxdrv --detach-kernel-driver
Now you should see something like the following output on your terminal window:
Controller: Xbox 360 Wireless Receiver
USB Path: 005:004
Wireless Port: 0
Controller Type: Xbox360 (wireless)
Your Xbox/Xbox360 controller should now be available as:
Press Ctrl-C to quit, use ‘–silent’ to suppress the event output
So this means, you’re ready to go. Useing buttons and pads on the controller should create tons of output which you can ignore. Do disable this output add the ‘–silent’ option to the xboxdrv command:
sudo xboxdrv --detach-kernel-driver --silent
Now you should be able to use your XBox 360 Wireless controller with almost every native Linux game which is available.
Using xboxdrv with WINE
For using xboxdrv with WINE there are a lot of tutorials out there. Some of them recommend to install a mapper which will map controller keys to keyboard keys and many other solutions. For me the simpelst way was to simply add the following parameter to the xboxdrv command line:
sudo xboxdrv --detach-kernel-driver --silent --mimic-xpad
The “–mimic-xpad” option says the xboxdrv driver that he should act and perform like a controller that is connected to your Linux box as an xpad Controller. Now you should be also able to use your controller under WINE games.
NOTE: I recently bought Dark Souls: Prepare to die edition from the Humble Bundle Sping Sale. This game does not come native to Linux but works well here with WINE. To get the correct mapping of your XBox 360 Wireless controller here you have to start xboxdrv like this:
sudo xboxdrv --detach-kernel-driver --silent --mimic-xpad --buttonmap 1=3,3=1,2=4,4=2,rt=start,lt=back,start=rt,back=lt --ui-buttonmap guide=KEY_LEFTSHIFT+KEY_TAB,rt=KEY_END,lt=KEY_G
If you want to play Dark Souls I with a controller on your Linux box with WINE, you have to add the “buttonmap” section to your xboxdrv command. Otherwise the B-Button in game will be the X-Button on your wireless controller for e.g.
Of course, this “buttonmap” section only works with Dark Souls I for now. Other games, other button mapping. You should consult the AppDB from WINE to find the right button mapping for your game.