DIY Gaming

Useful Controller Configuration Tips For a Raspberry Pi Retro Gaming Centre

Christian Cawley 28-06-2013

raspberry pi gaming consoleWhile building my Raspberry Pi retro gaming centre How to Install Game Emulators on the Raspberry Pi Desktop computer, media center, an integral part of a budget space program - is there no end to the versatility of the Raspberry Pi? Seemingly not – because it also does games. Read More I ran into some problems with configuring game controllers.


The challenges were straightforward. Would I use my Xbox 360 controller, or resort to a pair of basic USB controllers for two player gaming?

Establishing a solution was difficult. In the end, despite my preferences, I opted to go for a pair of basic, retro-style game controllers which proved great for some classic two player arcade-style gaming.

Although to be honest the majority of my RetroPie use has been to enjoy some classic strategy titles that I could just as easily load up in DOSBox on my PC.

So, how did I deal with setting up a two player gaming profile on my RetroPie, and how easy is it to add an Xbox 360 controller?

Advantages of a Modern Game Controller

Although retro gaming is fun, the controllers often suck. Back in the day, I would regularly go through several joysticks a year, including the hard-wearing, metal shafted two button types (the Competition Pro and similar).


As for two-hand controllers, I found them unreliable and flimsy, probably due to the lack of microswitches in favour of blister switches.

Clearly there is a distinct advantage in using an Xbox 360 controller (or similar) in place of the retro alternatives, from ergonomic comfort to improved reliability.

Setting Up Xbox Game Controllers On The Raspberry Pi

While it wasn’t my final choice, setting up the Xbox 360 controller proved far simpler than I had envisaged.

If you’ve checked the previous guide on installing and setting up a RetroPie system, you’ll know that the configuration file can be edited so that different controllers can be added. Incidentally, adding an Xbox 360 controller to a Linux system Connect Your Xbox 360 Controller To Your Linux Gaming Rig Linux gaming rigs? Yup, they’re happening. With Valve’s Steam on Linux and a forthcoming Valve Steambox using Steam to run Linux games, the future is looking up for gaming on Linux. You can even install... Read More isn’t all that unusual.


raspberry pi gaming console

To install the Xbox 360 controller driver, you will need to exit EmulationStation from the navigation menu and enter the following in the command line:

sudo apt-get install xboxdrv

Following this, edit /etc/rc.local, adding

xboxdrv --trigger-as-button --wid 0 --led 2 --deadzone 4000 --silent &
sleep 1

This ensures that the driver launches when the computer boots. Note the use of “–wid” in the instruction, which is for wireless controllers. Change it to –id for wired controllers.


Following this, enter

cd ~/RetroPie/emulators/RetroArch/tools

While in this directory, input the following command:

./retroarch-joyconfig -o p1.cfg -p 1 -j 0

You should increase digits by factor of 1 for each additional controller. If entered correctly, the resulting files should be added to retroarch.cfg:

sudo cat p*.cfg >> ~/RetroPie/configs/all/retroarch.cfg

You can then save and reboot to use your Xbox 360 controller.


How To Set Up Dual Controllers

There is one clear reason why you might use more than one controller – to enjoy multiplayer gaming.

While it is possible to use a keyboard and a USB controller, rather than two controllers, you will find that configuring a pair of different devices is difficult. For the best results (and to avoid configuration issues), you should use two identical controllers. If you want more than this, then you will need to use a powered USB hub.

Useful Controller Configuration Tips For a Raspberry Pi Retro Gaming Centre muo raspberrypi controllers usb

Begin by opening the retroarch.cfg file via FTP (or by running Raspbian and browsing to RetroPie > Configs > All) and find this line:

input_player1_joypad_index = "0"

Check the lines that follow, and then copy them, down to the last in that section. After the last line, leave a blank line and then paste the selection. You’ve duplicated the first controller profile, but you will need to edit the new block of code so that each instance of “player1” now reads “player2”

Here’s an example. The first two lines of the pasted segment should read:

input_player2_a_btn = "1"

Repeat until you reach the end of the copied code, then save and close.

Exit Games Using Your Controllers

The default method for exiting a game in EmulationStation is by restarting your Raspberry Pi – something that can corrupt the SD card 3 Reasons Why Your Raspberry Pi Doesn't Work Properly I've been living with the Raspberry Pi for several months now, and have found this astonishing little computer to be even more amazing than expected. Despite its diminutive dimensions, the Raspberry Pi is as fruity... Read More as this is only possible in this scenario by removing the power cable.

raspberry pi gaming console

To overcome this, a workaround exists maps an exit option to your game controller.

You’ll need to edit the retroarch.cfg file to do this, adding the following code:

input_enable_hotkey_btn = "X"
input_exit_emulator_btn = "Y"

You will need to check the retroarch.cfg file to identify the buttons you want to use here. Obviously you don’t want to exit games using the usual controller buttons – instead, you should be looking for the ones that relate to the buttons in the centre of the controller, perhaps labelled “menu” or “start”.

Once you know how these buttons are numbered in the config file, replace “X” and “Y” with the corresponding numbers.

You can then save the file and exit to apply the changes.

Conclusion: If You’re Going to Play Retro, Do It Properly

The tips here should help you get on the retro gaming trail in style on your RetroPie device, but for the absolute classic gaming experience you might want to consider utilizing (or building!) an all-in-one multi-button gaming device to replicate those found on the old arcade cabinets.

Whichever your controller solution, make sure you give it a few test runs before “gaming in anger” – and let us know how you get on, and what controller options you decide upon.

Related topics: Game Controller, Raspberry Pi.

Affiliate Disclosure: By buying the products we recommend, you help keep the site alive. Read more.

Whatsapp Pinterest

Leave a Reply

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

  1. Glenn
    December 22, 2017 at 9:33 pm

    Thank you, very informative.

  2. Isaiah
    January 29, 2015 at 9:32 pm

    when I punch in "cd ~/RetroPie/emulators/RetroArch/tools"
    It says "No such file or directory"

    I know I have Xboxdrv, and obviously I have Retro Pie set up and functioning. Any ideas? Thanks!

    • Isaiah
      January 29, 2015 at 10:07 pm

      After doing some digging, the folder "emulators" is not where it should be. In fact, I can't find it. My Sega 32x emulator works just fine, so I'm sure there are emulators installed somewhere on this thing. Also, I'm using Retro Pie 2.3 if that info helps.

    • Christian Cawley
      February 10, 2015 at 6:13 pm

      We'll have to throw this open as I'm not currently using RetroPie :/

    • Anonymous
      February 21, 2015 at 11:09 am

      cd /opt/retropie/emulators/retroarch

  3. Ben
    December 24, 2013 at 7:20 am

    I was wondering if you could add a 3rd and 4th controller in this way?

  4. Barry M
    October 24, 2013 at 8:21 pm

    For the noobs amongst use I would just like to point out that when you add the xboxdrv command to rc.local make sure it is BEFORE exit 0 or it does not work.

    Makes sense now but as a total linux noob I could not understand why it was not loading.

  5. MK
    September 27, 2013 at 6:24 pm

    Nice writeup! I am attempting to use a Logitech F310 controller with my rPi and am running into some major roadblocks--even though the xboxdrv function apparently in theory works with this controller. While the rPi sees the controller when it's in the X mode (per lsusb), when I run the xboxdrv command you list above, I get a "no xbox controller connected" error. Any ideas?

  6. Kerstinsson
    August 11, 2013 at 6:11 pm

    Is there anyway to install the drivers from a USB memory stick? Long story short, my Pi hasn't got an internet connection. I have located the four files that's needed for the driver installation.

    • Christian Cawley
      August 13, 2013 at 12:09 pm

      You'll need to exit RetroPie and boot into X, then connect the USB stick as you normally would to drop the drivers into the folder. ONce you reboot back into RetroPie you should be fixed

  7. Don Gateley
    June 29, 2013 at 5:15 pm

    Have you considered the wireless Xbox 360 controller or is that a whole different ballgame?