How To Fix Xbox 360 Controller Button Map for Moonlight Raspberry Pi 3

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 http://vontaene.de/raspbian-updates/ . main’ >> /etc/apt/sources.list”
gpg –keyserver pgp.mit.edu –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 FILNAME.map

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 FILENAME.map

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.

wget https://raw.githubusercontent.com/RoelofBerg/moonlightpisteambox/master/xbox.map

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

moonlight stream -mapping xbox.map

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 http://embedded-software-architecture.com/?page_id=140

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!

9 thoughts on “How To Fix Xbox 360 Controller Button Map for Moonlight Raspberry Pi 3”

  1. It helped me a lot, Ty 🙂 after, i had some random issues with moonlight mapping (lt and rt stopped working), i fixed it running moonlight map command with sudo.

  2. when I plug my controller into the raspberry pi my controller just vibrates for a short amount of time. no light appear. It is recognized with evtest but when I try to set up the mapping it seems that nothing happens when I try to move the analog stick the direction it says. Please help if anybody still reads comments on threads 🙂

  3. I see you don’t monetize your blog, don’t waste your traffic,
    you can earn additional bucks every month because you’ve got hi quality content.

    If you want to know how to make extra bucks, search for: Boorfe’s tips best adsense

  4. I have an arcade cabinet setup with arcade stick and buttons using a raspberry pi 3 and retropie. I have made it all the way to connecting to my pc and opening steam no problem. The problem i’m running into is it does not recognize my arcade stick and buttons that is connected to the pi with usb. I was really hoping to stream some fighting games like newer street fighters, blazeblue, guilty gear, and new DBZ fighter, on my cabinet using my arcade sticks. Is there a way or am i wasting my time. thanks a lot.

    1. Turns out, while i cant use my arcade sticks to select games in steam while streaming, if i start the game on my computer, my arcade sticks work perfectly. Both player one and two work. Just got done playing some street fighter IV streaming to my arcade cabinet. It would be nice to be able to do everything from the arcade cabinet though. Right now I have the cabinet in the same room as the computer, but I will eventually be moving the cabinet upstairs.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.