After getting my brand new Raspberry Pi 3, I was excited to get straight into Steam Streaming with Moonlight using an Xbox 360 Controller. But, I came across an issue where the button’s on the 360 Controller weren’t mapped correctly. The Y button was X and vice versa. So, I dug in really deep through the interwebs and found the solution. This solution stopped working for me so I had to do some further testing.

sudo apt-get install debian-keyring
sudo sh -c “echo ‘deb . main’ >> /etc/apt/sources.list”
gpg –keyserver –recv-keys 0C667A3E
gpg –armor –export 0C667A3E | apt-key add –
sudo apt-get update

Moonlight Controller Mapping

I’m still working on getting this 100% right now, so I’ll give you the 90% working solution. This will get everything but the two triggers working.

sudo apt-get install evtest

Once installed launch evtest


You will see a list of event devices. You will need to remember the Xbox controller event number. In my case it was 2. Now, you need to map the controller using moonlight. Where it says FILENAME, choose a name you will remember.

moonlight map -input /dev/input/event3

Go through and map the corresponding buttons to the on screen requests. When you get to triggers, you will need to press the left button or right button instead. This means games that use the triggers and buttons will have issues.

To run moonlight using the newly created map

moonlight stream -mapping

That’s it for the 90% solution. Subscribe to the TechWizTime YouTube Channel to get the 100% solution once I figure it out.

This was the non-working solution underneath.

Raspberry Pi 3 Complete Starter Kit
Raspberry Pi 3 + 2.5A Power Supply
SanDisk Ultra 32GB Micro SDHC

moonlight xbox 360 controller mapping

Old Moonlight Xbox Controller Mapping

First steps, you will need to open a terminal window in Raspbian or through SSH and enter the following commands:

sudo modprobe -r xpad
sudo sh -c “echo ‘blacklist xpad’ >> /etc/modprobe.d/gamepad.conf”
sudo nano /etc/rc.local

The last command will open a text editor where you will need to enter the following BEFORE the line that reads ‘exit 0’

xboxdrv –trigger-as-button –wid 0 –led 2 –deadzone 4000 –dpad-as-button –silent &

Save the file (Ctrl + X) confirm and exit.

Change the directory to the Moonlight directory

cd ~/Moonlight

In order for Moonlight to understand what each button does, a map file will be required. Roelof Berg has created a working map file so all you need to do now is download it with the following command all as one line.


And lastly, we need to tell Moonlight to use the map file we just downloaded.

moonlight stream -mapping

That’s it! Now Moonlight should be correctly mapped to use the Xbox 360 Controller through your Raspberry Pi 3 (Or Pi2 or B+).

Source for all information presented here was from

If this helped you with mapping your Xbox 360 Controller in Moonlight on the Raspberry Pi or maybe you found a better method, then leave me a comment below!