How to get your XBox 360 Wireless Controller working under your Linux box

Xbox 360 Wireless Controller, source: wikipedia.org
Image source: wikipedia.org

 

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 in the wild is (IMHO) the XBox 360 Wireless Controller from Microsoft. The Wired version of this controller can be easily connected through Plug & Play. The standard loaded driver xpad then can handle it.
But what do you have to do if the controller is the wireless Version?

1. 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 ~ 19,-€ here in the EU. 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.

 

2. 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.

 

3. Start the driver

Starting the driver with default settings is rather simple. The following command starts the driver with default settings:

sudo xboxdrv

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
Vendor/Product: 045e:0719
USB Path: 005:004
Wireless Port: 0
Controller Type: Xbox360 (wireless)

Your Xbox/Xbox360 controller should now be available as:
/dev/input/js0
/dev/input/event19

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.

 

4. Useing xboxdrv with WINE
For useing 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.

2 thoughts on “How to get your XBox 360 Wireless Controller working under your Linux box

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s