Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

Retropie configure 2 GPIO joysticks



  • Hello there

    I've recently set up my Raspberry Pi 3 with retrogame, and my goal is to play with 2 joysticks and 6 buttons (3 buttons each).
    The problem is that I haven´t been able to figure out how to find a program that lets me use both joysticks. Atm, I'm using adafruits Adafruits retrogame, and its worked well with 1 joystick. But they only let you configure 1 joystick with 6 buttons at max, and since i need another joystick it dosen't fulfil my goal. I've seen GPIOneer and know that it's an alternative to retrogame, but im not sure if that lets you use two joysticks?

    Basically my question is, do you guys know if GPIOner will work, or do you have a better idea?

    Grateful for fast answers since this is a school project.

    Thanks in advance!


  • Global Moderator

    Take a look at the mk_arcade_joystick_rpi gamepad driver - it allows you to map more than 1 joystick (over GPIO) to a Raspberry Pi. The driver is easily installable from the RetroPie setup drivers' section, but you'll have to load it and configure it accordingly.



  • @mitu Thanks for the reply. I'm having trouble installing, stuck on something about not finding kernel headers? I'm going to install a fresh copy of retropie again tomorrow to see if it does the trick. I'll let you know how it goes



  • For the missing kernel headers, check if the package raspberrypi-kernel-headers is installed with:

    apt-cache policy raspberrypi-kernel-headers. If you get an output like this:

    raspberrypi-kernel-headers:
      Installed: 1.20190215-1
      Candidate: 1.20190215-1
      Version table:
     *** 1.20190215-1 500
            500 http://archive.raspberrypi.org/debian stretch/main armhf Packages
            100 /var/lib/dpkg/status
    

    the mk_arcade_joystick_rpi should build out-of-the-box, eerm, out-of-the-setupscript as mitu noted.
    If the headers are missing (no version in Installed:), issue: sudo apt-get install raspberrypi-kernel-headers. Then build the mk_arcade_joystick_rpi from the setupscript.

    After the build process has finished check if the modules are loaded, check with: lsmod | grep mk_arcade_joystick_rpi, it should give you a result with one line.

    Alternatively you may check with jstest /dev/input/js0and jstest /dev/input/js1 if both GPIO controller are recognized.

    HTH



  • This post is deleted!


  • @Lolonois I didn't realise he meant there was an installation driver built into the retropie so i followed the steps on Github.

    Since it didn't work yesterday, I tried to download it through the drivers section instead, and it worked (says it's installed).
    I ran "apt-cache policy raspberrypi-kernel-headers" and i got the result you listed.

    So then i tried to load the driver (like the steps shown at github), but when i write:
    "sudo modprobe mk_arcade_joystick_rpi map=1,2", i get the following message:
    "modprobe: FATAL: Moudle mk_arcade_joystick_rpi not found in directory /lib/modules/4.19.27-v7+".

    Also I couldn't get the Ismod command to work, just said that it couldn't find the command. I'm probably just writing it wrong, still fairly new to this.


  • Global Moderator

    @Freddy00 said in Retropie configure 2 GPIO joysticks:

    I didn't realise he meant there was an installation driver built into the retropie so i followed the steps on Github.

    What exactly wasn't clear from my reply ? I'm genuinely interested to know, it's not a reproach.

    The driver is easily installable from the RetroPie setup drivers' section, but you'll have to load it and configure it accordingly.



  • @mitu You did nothing wrong, I might have just read it to fast and overlooked it. I clicked the link and it took me to the page and I thought you meant it was easily installable by following the steps on that link (which it should be either way, don't know why I can't get it to work).



  • @Freddy00 Driver installation with sudo ~/Retropie-Setup/retropie_setup.sh should work. If you want to review the compile log see zless ~/~/RetroPie-Setup/logs/rps_2019-03-15_194311.log.gz when back on commandline (your date and time may vary).

    You can type lsmod alone, you should spot the mk_arcade... driver loaded.
    (If the command still is not found you should install kmod, but it should be already there, so there should no need to issue sudo apt-get install kmod.

    Then, and only then when lsmod shows the module, proceed with https://github.com/recalbox/mk_arcade_joystick_rpi#auto-load-at-startup edit the mk_arcade_joystick.conf and change the map=1 to map=1,2. Save the file, reboot and then you can configure your joysticks with emulationstation.

    If you use the retropie_setup.sh method you should succeed. If not please do post the build log as noted above.

    PS: I would refrain from following the Github tutorial from A to Z, a) it is tailored towards another Retro-Distro (Recalbox), b) if you get stuck it's hard to help and c) last but not least this is a forum about Retropie-Distro (and not Recalbox).



Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.