Guide

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

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

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!

Jonathan Russell

Jonathan is a tech expert who writes and produces videos on technology tutorials and reviews. With over 25 years experience in technology hardware and software, he has a vast array of technology knowledge. For more great content, search TechWizTime on YouTube.

View Comments

  • 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.

  • 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 :)

  • 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
    alternative

  • 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.

    • 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.

Recent Posts

MY FIRST LENOVO TABLET!!! Tab P12 Tablet

Should you buy the Lenovo Tab P12 Tablet? Is it an affordable, versatile tablet that…

14 hours ago

5 Free Software You’ll Actually Want to Try! (2024 Update)

Welcome back to another video in our free software series. In this video I’ll show…

15 hours ago

Best Smart Fitness Band 2024? Xiaomi Smart Band 9 Pro Takes the Lead!

Looking for a detailed review of the Xiaomi Smart Band 9 Pro? Look no further!…

20 hours ago

Top 10 Best Websites to Learn Coding for Free! 2024

If you ever wanted to learn how to code to create mobile apps, PC software…

3 days ago

12 Amazing Room Gadgets for 2025 | Available on Amazon

12 Amazing Room Gadgets for 2025 | Available on Amazon 🔗 LINKS GOVEE x EVANGELION…

3 days ago

Ultimate TECH Holiday GIFTS – Giveaway + Gift Guide FINALE

The final 2024 Gift Guide episode of the year! As always, be sure to sub…

3 days ago