GPIO input + external joypad

Various user-contributed guides for software-related things
Post Reply
User avatar
Posts: 127
Joined: Wed May 11, 2016 3:10 pm
Has thanked: 4 times
Been thanked: 36 times

GPIO input + external joypad

Post by Cannikin » Sun May 29, 2016 4:42 pm

I had to fight with this for a while but I figured it out and wanted to save everyone else the pain!

If you're using GPIO for input (this may apply for the Teensy as well) and want to have a joypad connected via USB so you can have two players, you need to make a couple of edits to the retroarch.cfg file. Without these edits your connected joypad acts like player 1 and will do the same thing as the controls on the GB itself.

Set up your joypad first (press START and go to Configure Input and follow the prompts). Now exit emulationstation and from the terminal type:

Code: Select all

nano /opt/retropie/configs/all/retroarch.cfg
Move down to the lines where you see input_player1_a, input_player1_b, etc. (Actually these config settings could go anywhere in the file, but having them here with the rest of the input stuff is cleaner.)

Now, your USB joypad will be considered input 0. For whatever reason, apparently the GPIO keyboard (and maybe Teensy) will be considered input -1. I haven't found this recorded anywhere, I just tried it and it worked. Add these two lines before or after the input_player1 lines:

Code: Select all

input_player1_joypad_index = -1
input_player2_joypad_index = 0
Hope that helps someone else!

User avatar
Posts: 354
Joined: Thu May 05, 2016 12:58 am
Location: Berlin
Has thanked: 29 times
Been thanked: 71 times

Re: GPIO input + external joypad

Post by Popcorn » Tue May 31, 2016 10:27 pm

Interesting. "-1" means false or disable. So I think, what is happening is that you are disabling gamepads for player 1. And the Teensy is acting as a keyboard so that's ok. Nice find.

User avatar
Posts: 143
Joined: Wed May 04, 2016 8:36 pm
Has thanked: 9 times
Been thanked: 17 times

Re: GPIO input + external joypad

Post by 1461748123 » Tue May 31, 2016 10:40 pm

Nice! Moving this to software tutorial section :)

Posts: 42
Joined: Mon May 23, 2016 4:10 am
Has thanked: 17 times

Re: GPIO input + external joypad

Post by GnobarEl » Sun Jul 17, 2016 5:53 am

What a "simple" solution! I was having a pain with it!

Thanks for sharing.


Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest