I'm using the Microsoft Xbox 360 Wireless (Gaming) Receiver for Windows in Ubuntu Linux together with multiple “Microsoft Xbox 360 Wireless Controller” gamepads for single or multiplayer games with up to 4 controllers simulatiously.
This solution took me some time to figure out and it might be not the final solution to issues with gamepads in Linux, but these controllers are some of the most supported gamespads in the Linux world and a standard in PC gaming for game developers since their introduction in 2005 until today. This solution works for Xbox and Xbox One Controllers too.
As drivers, I've used xboxdrv and xpad before on my notebook (from Ubuntu LTS-Versions 12.04 until 18.04), but xboxdrv failed to be fully recognised with some games on my new PC with a fresh Kubuntu 18.04 LTS installed, because xboxdrv it is unmaintained now (since about 2 years). The last Ubuntu LTS it was working perfectly for me was 14.04, just with installing the PPA.
Just after installing Kubuntu 18.04 LTS (or Ubuntu 18.04 LTS for that matter), I’ve first tried to use my Xbox360 Wireless Controller gamepads and it worked out of the box with the default kernel driver version of xpad, but only in some games, where the analog bumpers (LB and RB) where not needed. Problems arrived in Steam and Steam Play, for native Linux games as well as Windows games though Steam Play (Valve's Wine adaption inside steam). Valkyria Chronicles played well, in Grand Theft Auto V only the camera worked (unplayable) and in Project Cars 2 I was able to assign the basic controls to buttons that worked, but it was almost unplayable.
I tried every solution with xboxdrv then, that I could find on the net, but it’s just too old now. Valve contributed a lot to linux gaming since then. All buttons worked with xboxdrv, but the configuration mixed up the axis of the right stick and the right bumper and I couldn’t figure out how to solve it.
So here is the solution using xpad that made all the magic happen just by installing it. All the gamepads worked perfectly as it should have been with all the games I tried.
Install the Linux Kernel Driver for the Xbox/ Xbox 360/ Xbox One Controllers
Go to https://github.com/paroj/xpad
Follow the installation instructions there. By the time of writing it goes like this:
Open Terminal
Install git and dkms if you haven't got it by entering:
sudo apt-get install git dkms
or jump to the next step.
If you don't know or are not sure, just enter it anyway and the system checks for a version to update only, if you have it already.
Enter:
sudo git clone https://github.com/paroj/xpad.git /usr/src/xpad-0.4
Enter:
sudo dkms install -m xpad -v 0.4
Optional: reboot (just to be sure)
Enjoy! ;)
Further information to install the hardware you find at Microsoft's support here: https://support.xbox.com/en-US/xbox-on-windows/accessories/xbox-360-wireless-gaming-receiver-windows
Install this PPA with joystickwake to help with Screensavers
Unless a game takes special steps, you also will need a joystick-aware screen waker until the display servers catch up. Joystickwake helps linux gamers who are tired of their screen saver interrupting their fun. The source code and documentation are on github:
https://github.com/foresto/joystickwake
Enter:
sudo add-apt-repository ppa:foresto/toys
Enter
sudo apt-get update
On Ubuntu 16.04 - Xenial (maybe work on above)
Note: Don't work for PS3 Gasia / Shanwan game controllers (China/fake PS3 controllers) -- I tested only with a Shanwan controller!
Install from source
Since the last officially supported version is "vivid"(Ubuntu 15.04) from QtSixA PPA and don't work for Xenial (16.04). So we need compile from the only repo that works (and has updated) and allow to connect two controllers at the same time was the fork of RetroPie:
sudo apt-get install dialog build-essential pyqt4-dev-tools libusb-dev libbluetooth-dev python-dbus -y
wget https://github.com/RetroPie/sixad/archive/master.zip -O sixad-master.zip
unzip sixad-master.zip
cd sixad-master
make
sudo make install
Configuring
1.) First make sure you have Bluetooth on your computer.
2.) Plug in the controller via USB first to do the initial pairing. Run the sixpair command:
sudo sixpair
Sample of output when successful pair:
Current Bluetooth master: XX:XX:XX:XX:XX:XX
Setting master bd_addr to XX:XX:XX:XX:XX:XX
XX:XX:XX:XX:XX:XX is the MAC of your Bluetooth device.
3.) Unplug the controller and run:
sudo sixad -s
This starts the sixad daemon which waits for incoming PS3 controller connections. sixad will completely take over the Bluetooth adapter (exclusive control, so no other Bluetooth devices other than PS3 controllers will work after you start sixad).
4.) Press the ps3 button on your PS3 controller and wait for 2-3 seconds. You'll feel the controller vibrate when it successfully connects.
Sample of output when successful connected:
[ ok ] Starting bluetooth (via systemctl): bluetooth.service.
sixad-bin[23052]: started
sixad-bin[23052]: sixad started, press the PS button now
Watching... (5s)
sixad-sixaxis[23069]: started
sixad-sixaxis[23069]: Connected 'PLAYSTATION(R)3 Controller (**XX:XX:XX:XX:XX:XX**)' [Battery 05]
To turn off sixad and disable control: Just press CTRL+C
Test the functionality [Optional]
You can test the functionality of your controller through Jstest-gtk (install: sudo apt-get install jstest-gtk
)
Disable sixad service [Optional]
Warning: sixad will completely take over the Bluetooth adapter (exclusive control, so no other Bluetooth devices other than PS3 controllers will work after you start sixad).
sudo update-rc.d sixad disable
sudo service sixad stop
References:
https://askubuntu.com/a/834907/139248
https://retropie.org.uk/forum/topic/2913/guide-use-qtsixa-on-ubuntu-16-04-and-derivatives
Best Answer
xboxdrv can do that, but only when the PS3 controller is connected via USB:
As for the ids, I listed them below, but they won't really help you much. As you can see, Xbox360 USB and Xbox360 Wireless use different ones and most games don't care either way, they just use the button one after another and don't care which button is mapped to which physical button, you have to remap them manually in each game.
As for Wine, Wine only supports DirectInput and lacks Xinput support and many modern games require Xinput. To get around that you have to use a Xinput emulation .dll (same trick you have to use on Windows with older gamepads), haven't tried it myself, but it's described here:
-