To connect an Xbox controller using Bluetooth, you'll need a terminal window. Open one on Raspberry Pi OS or remote into the Pi using a terminal application of your choice.
1. Disable Enhanced Re-Transmission Mode (ERTM)
If ERTM is enabled, the controller won't pair with the Pi. To disable the ERTM, run the following command:
echo 'options bluetooth disable_ertm=Y' | sudo tee -a /etc/modprobe.d/bluetooth.conf
Restart the Pi.
2. Start Bluetooth Tools
After the Pi reboots, start Bluetooth Tools with the following command:
sudo bluetoothctl
3. Search for the Xbox controller
Now we need to search for the Xbox controller. Don't put the controller into pairing mode just yet. We have a few settings to adjust first.
Enable agent with the following commands:
agent on
default-agent
Next, we'll start scanning for available Bluetooth devices. Run this command to start scanning:
scan on
4. Connect to the Xbox controller
Put the Xbox controller into Pairing mode. It should appear in the list of devices with a unique MAC address and the words "wireless controller" at the end. Take note of the MAC address, we'll need it to connect the controller.
In the terminal window, enter the following command, replacing MAC_ADDRESS
with the Xbox controller MAC address.
connect MAC_ADDRESS
After connecting the controller, make sure it's listed as a trusted device with this command—again replacing
MAC_ADDRESS
with the one for the Xbox.
trust MAC_ADDRESS
Close the bluetoothctl application by typing
quit
5. Test the connection
We'll use the joystick toolset to make sure everything is working. Install it with this command:
sudo apt-get install joystick
When it finishes installing, run this command to start the test:
sudo jstest /dev/input/js0
You will see a screen of numbers. If everything is working properly, pressing buttons on the controller will cause them to change.