SSH with Mobaxterm
Use GUI and Command Line Interface with Linux
Linux Operating System (OS) installed.
Clone the repository from Github
sudo git clone https://github.com/brisbaneroboticsclub/XboxController
For the Xbox controller to maintain the connection, the ERTM will need to be enabled. The temporary solution will be reset when shutdown. The permanent solution will not lose the settings when shutdown.
Temporary ERTM solution.
Enter the command below in terminal to determine if the ‘ETRM’ is disabled. If the value is ‘N’ then enter the following command.
If the ‘ERTM’ value from above is ‘N’, then run the following command to make it ‘Y’.
You will need to run this command every time you start your Nano/Pi/EV3.
sudo bash -c "echo 1 > /sys/module/bluetooth/parameters/disable_ertm"
Now verify the ‘ERTM’ value has changed to ‘Y’
Once you have changed the ‘ERTM’ value to ‘Y’, go into the desktop and add the bluetooth controller.
Permanent ERTM solution (Nano/Pi)
This is a permanent solution for Pi and Nano users.
echo 'options bluetooth disable_ertm=Y' | sudo tee -a /etc/modprobe.d/bluetooth.conf
Connect Xbox using GUI (Nano/Pi)
Exit the command line interface and use the Linux GUI to connect the Xbox controller. In the top left of the screen you will see the icon for wi-fi and bluetooth. Follow the commands and connect your xbox controller. You will need to turn your Xbox controller on.
After pairing, the connection will not be maintained, there is a little bit more work to do.
Connect Xbox to EV3 using menus (EV3)
On the EV3 device, navigate the menu system and connect the Xbox via Bluetooth. Then follow the CLI commands below using your SSH intferace.
Connect thur CLI (Nano/Pi/EV3)
Turn your Xbox controller on and from the command line interface, enter the following commands.
sudo bluetoothctl agent on default-agent scan on
Locate your device and copy the MAC_ADDRESS
connect YOUR_MAC_ADDRESS trust YOUR_MAC_ADDRESS quit
The light on your Xbox controller should now be ON.
Confirm Xbox is connected.
Enter the following commands from terminal.
The Xbox controller will be sending data to the ‘js0’ file and an ‘event’ file.
We need to determine which ‘event’ file the Xbox is using.
Enter the following command to open the event device folder.
cd /dev/input ls
The Xbox controller is usually the last ‘event’ in the list.
Try the following command for event0, event1.. etc. As you move the Xbox controller the data will fill the screen. Enter ‘Ctrl+C’ to exit.
Now install ‘evdev’ for Python3 from Terminal.
sudo pip3 install evdev
For more information on evdev, see the PyPi website.
Test your connection
Run the following code and run it from the CLI.
The program will automatically detect the Xbox controller.
Did it work?
If you had an issue, please report it on the our github page.