RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login
    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

    Adding a 9th button to GPIO

    Scheduled Pinned Locked Moved Help and Support
    retropiebutton mappinggpio
    49 Posts 7 Posters 11.5k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • simonsterS
      simonster
      last edited by simonster

      I just ran this command and it cloned successfully:

      git clone https://github.com/recalbox/mk_arcade_joystick_rpi.git -b hotkeybtn

      I am trying to compile it at the moment (there are a few issues with the code), there is also the matter of the missing headers, so bear with me and when I get something I will update this thread.

      1 Reply Last reply Reply Quote 0
      • simonsterS
        simonster
        last edited by

        Hi @theRog05

        How are you using kernel 4.9.35-v7+? I have just run an update in RetroPie-Setup and am still using kernel 4.4.50-v7+

        Can you fill in the detail list in https://retropie.org.uk/forum/topic/3/read-this-first

        T 1 Reply Last reply Reply Quote 0
        • T
          theRog05 @simonster
          last edited by

          @simonster I've been working on this all day so far and started getting some other funky errors (probably from me messing around in there). So I decided to wipe the card and start fresh. Once I get my card loaded up, I'll give this a try again. Sorry, wish I saw this message before I went and formatted the card.

          P.S. - Thanks for your continuous help on this!

          simonsterS 1 Reply Last reply Reply Quote 0
          • simonsterS
            simonster @theRog05
            last edited by

            @theRog05

            No problem, I can only assume you had run rpi-update at some point and ended up with a unstable beta kernel.

            T 1 Reply Last reply Reply Quote 0
            • T
              theRog05 @simonster
              last edited by

              @simonster I'm pretty sure I did run rpi-update at some point in the past 7 hours. haha. I do remember using kernel 4.4.50-v7+ and I was also wondering why 4.9.35-v7+ was being used. Oh well, starting fresh now. As soon as I get it loaded on the Pi, I'll follow your steps again to clone the hotkeybtn branch in the mk_arcade_joystick_rpi repo and see what I can come up with. Thanks again!

              1 Reply Last reply Reply Quote 0
              • simonsterS
                simonster
                last edited by simonster

                I have just tried this method and it worked for me completely:

                Install MK_Arcade_Joystick from the drivers in the retropie setup. Then exit Emulation Station by pressing F4

                rm -r mk_arcade_joystick_rpi
                git clone https://github.com/recalbox/mk_arcade_joystick_rpi.git -b hotkeybtn
                sudo mkdir /usr/src/mk_arcade_joystick_rpi-0.1.5.1/
                cd mk_arcade_joystick_rpi/
                nano dkms.conf

                change the line that begins PACKAGE_VERSION to read

                PACKAGE_VERSION="0.1.5.1"

                Press Ctrl+X and then Y and Enter to exit and save changes

                sudo cp -a * /usr/src/mk_arcade_joystick_rpi-0.1.5.1/
                sudo dkms build -m mk_arcade_joystick_rpi -v 0.1.5.1
                sudo dkms install -m mk_arcade_joystick_rpi -v 0.1.5.1 --force

                Once installed, restart the Pi using the following command

                sudo shutdown -r -t 0 now

                T P 2 Replies Last reply Reply Quote 1
                • T
                  theRog05 @simonster
                  last edited by

                  @simonster Awesome. I'll give that a try when the card loads back up. And after I replace my sisters shock in her car. -____-

                  1 Reply Last reply Reply Quote 0
                  • loujezL
                    loujez
                    last edited by

                    @simonster your advices on this topic are the most usefull on the net. I'm sorry that therog05 don't follow his own topic. I'm in the same case so i follow every step you are describing with the 4.9.35-v7+ kernel.

                    On the line :
                    git clone https://github.com/recalbox/mk_arcade_joystick_rpi.git -b hotkeybtn

                    i get :
                    fatal: destination path mk_arcade_joystick_rpi already exist and is not an empty directory

                    It is impossible to go after.

                    If you are always following this topic, i'm very intersting by what you can belong to me with your knowledge.

                    Cheers my friend

                    1 Reply Last reply Reply Quote 0
                    • simonsterS
                      simonster
                      last edited by simonster

                      @loujez said in Adding a 9th button to GPIO:

                      On the line :
                      git clone https://github.com/recalbox/mk_arcade_joystick_rpi.git -b hotkeybtn

                      i get :
                      fatal: destination path mk_arcade_joystick_rpi already exist and is not an empty directory

                      This means that the folder is already there from a previous installation. Try this before that line:

                      rm -r mk_arcade_joystick_rpi

                      I have update the previous post to reflect this.

                      1 Reply Last reply Reply Quote 1
                      • T
                        theRog05
                        last edited by

                        I'm so sorry that I didn't reply to this sooner. I actually never got back to this until a couple days ago and it still took some finagling, but I finally got it! The main issue I was having was that I needed to change the PACKAG_VERSION in the dkms.conf file. After that I started having a problem with my second joystick not working. I followed the steps to include both controllers, but for some reason the file being used was named differently than I expected. I updated the correct file and everything started to work.

                        @loujez is correct, @simonster, you have been extremely helpful to get this up and running for me. THANK YOU! I don't think many people are using the hotkey button in retropie so that's probably why we don't see much support out there for it.

                        @loujez: I couldn't get 'git clone https://github.com/recalbox/mk_arcade_joystick_rpi.git -b hotkeybtn' to work for some reason, so I checked out the main branch and then switched branches with 'git checkout -b hotkeybtn'. The fatal error you're getting is because the mk_arcade_joystick_rpi folder already exists and has files in it. You can use 'rm -r mk_arcade_joystick_rpi' to remove the folder before trying to clone. Good luck! I'll try to stay more current with this post.

                        1 Reply Last reply Reply Quote 1
                        • simonsterS
                          simonster
                          last edited by

                          Thanks guys,

                          When I was installing my arcade unit, I found the mk_arcade_joystick module and installed it manually (back on RetroPie 2.6 and well before it was in the RetroPie script). On running into issues, I tried to get support from Recalbox and the developers of it and never seemed to get any queries answered, so I set about learning as much as I could about it.

                          As a result, I try to assist anyone who has queries on it, as I've probably looked at most of the code at some point in the last 18 months and have various versions of the git repository stored on my PC.

                          Si

                          1 Reply Last reply Reply Quote 2
                          • loujezL
                            loujez
                            last edited by loujez

                            Thank you @theRog05 for all theses explanations. Actually i had the similar issues with the 2nd player configuration but i've managed to overpass them.

                            Now @simonster i'm just blocked on the hotkey butn setup but i will try to set it up correctly tomorrow by following your advices. (18 months !!! I sympathize. 2 weeks of headache and i'm just dead )

                            I just have another new issue.. I dont know if both are able to give me some directions. Until I set up the 2nd GPIO arcade controller player with some commands that i can explain to you. I have no more sound when i launch a game (on all emulators) but i got it into the emulastionstation menu.
                            Have you already met this issue or am i the only one lol?

                            Just to mentioned that sometime i have a yellow undervoltage symbol appearing on the right side of my screen. Do you think that it could be the core issue or it comes to something that i have outpassing or unfollow ? (don't know how to explain myself in english, i'm hoping you understand me)

                            Cheers and sorry to not relaunch about the topic subjet plus another one on this time. Despite of all that things, this thread will be very usefull for people like me in this situation. However I will give you a feedback tomorrow about my hotkeybtn configuration

                            Best regard
                            Looking forward to reading both of you

                            T simonsterS 2 Replies Last reply Reply Quote 0
                            • T
                              theRog05 @loujez
                              last edited by

                              @loujez Make sure you're using a power supply that can handle the pi. This could be why you don't have sound. How are you outputting sound? HDMI or audio jack? Take a look at your main config file. There are options to comment or uncomment lines depending on how you're outputting the sound.

                              1 Reply Last reply Reply Quote 0
                              • simonsterS
                                simonster @loujez
                                last edited by simonster

                                @loujez

                                I would suggest, if you are getting a lightning bolt, that you should look to replace the power supply. A Pi3 really wants a minimum of 5.2V @ 2.5A. I use one of these: https://www.rapidonline.com/stontronics-t5875dv-official-raspberry-pi-psu-5-2v-2-5a-uk-euro-plugs-75-0532

                                How are you outputting sound from your Pi? Also could you post a copy of your /boot/config.txt (remember to enclose it in code blocks or put it on pastebin and post a link here)?

                                Si

                                1 Reply Last reply Reply Quote 0
                                • loujezL
                                  loujez
                                  last edited by loujez

                                  Thank you guys for your fast answers.

                                  @theRog05 Actually i have a 5v power supply with 3amp connected to a Western digital external hard drive (called PiDrive), which redistributes power to my raspberry, my arcade controllers and so on.

                                  Regarding to my arcade cabinet audio outputting, i'm using an amplifier + 2 audio speakers which are linked directly to the raspberry with the jack 3.5 cable.

                                  @simonster Here is my /boot/config.txt (sorry dont know how to code block):
                                  https://pastebin.com/h4CyQc1d


                                  Just to say that sound was working in game before i set my 2nd player arcade controllers. After it was done, nothing comes out from my speakers except in the emulationstation menu. Because gamepad 2 was not detected, i used theses command lines :

                                  sudo nano /etc/modules

                                  i 've added:

                                  mk_arcade_joystick_rpi
                                  mk_arcade_joystick_rpi map=1,2

                                  then i tapped:

                                  sudo nano /etc/modprobe.d/mk_arcade_joystick.conf

                                  and added:

                                  mk_arcade_joystick_rpi map=1,2

                                  Then (to see which options were launch at the boot) :

                                  grep "mk_arcade_joystick_rpi" /etc/modprobe.d/*

                                  Then i've seen 2 options one with map=1,2 and an other one with "mk_arcade_joystick_rpi.conf with map=1"
                                  So i changed it by adding map=1,2 to the line

                                  Then

                                  sudo reboot

                                  But there are still to different .conf options launch at the boot system. I supposed one isn't useful

                                  @simonster Regarding to the hotkeybuton, i'm going to use the "rm -r mk_arcade_joystick_rpi" line that you gave me this afternoon. I will give you a feedback

                                  Thank you again guys, your help is very nice.
                                  Looking forward to reading you

                                  EDIT: i've just tried to enter theses command lines:
                                  sudo apt-get update
                                  sudo apt-get upgrade
                                  sudo apt-get install alsa-utils
                                  sudo modprobe snd_bcm2835

                                  On the last one i get :

                                  pi@retropie:~ $ sudo modprobe snd_bcm2835
                                  libkmod: ERROR ../libkmod/libkmod-config.c:673 kmod_config_parse: /etc/modprobe.d/mk_arcade_joystick.conf line 1: ignoring bad line starting with 'mk_arcade_joystick_rpi'

                                  with
                                  grep "mk_arcade_joystick_rpi" /etc/modprobe.d/*

                                  i see
                                  /etc/modprob.d/mk_arcade_joystick.conf options mk_arcade_joystick_rpi=1,2
                                  /etc/modprob.d/mk_arcade_joystick_rpi.conf options mk_arcade_joystick_rpi=1,2

                                  I think my 2nd gamepad set up is in conflict with the sound. Is it a possible way of solutions.. ?

                                  1 Reply Last reply Reply Quote 0
                                  • simonsterS
                                    simonster
                                    last edited by

                                    With regards to the sound issue, have you set the sound output in the raspi-config to 3.5mm (you can access this from the RetroPie menu in ES)?

                                    With regards to the joystick working: I'm not sure why you've done a number of these changes, if you installed from the update script first, the options were already setup for you, you just needed to configure the joysticks in ES (both of them as they are listed as separate devices with unique configurations).

                                    The instructions for autoloading the driver are as follows, these are the only sections that should be used to configure it:

                                    Open /etc/modules :

                                    sudo nano /etc/modules

                                    and add the line you use to load the driver :

                                    mk_arcade_joystick_rpi

                                    Then create the file /etc/modprobe.d/mk_arcade_joystick.conf :

                                    sudo nano /etc/modprobe.d/mk_arcade_joystick.conf

                                    and add the module configuration :

                                    options mk_arcade_joystick_rpi map=1,2

                                    1 Reply Last reply Reply Quote 0
                                    • loujezL
                                      loujez
                                      last edited by loujez

                                      Yes i have set the 3.5mm raspi_config. As i said sound is ok in emulationstation menu and worked before i set up weirdly my 2nd gamepad.

                                      I had installed the update-script but in emulationstation only "1 gamepad was detected". That's why i have tried to do it by myself. I am aware that i have made one mistake with the creation of mk_arcade_joystik.conf.
                                      I am going to clean all that things and i will come back to say you if there is a sound improvement. I'm pretty sure to have created a conflict somewhere. I will come back later

                                      Thanks again

                                      1 Reply Last reply Reply Quote 0
                                      • loujezL
                                        loujez
                                        last edited by loujez

                                        @simonster !!!!!!

                                        I have manage to diagnostic where comes the sound probleme. I have reinstall everything today from zero !!!
                                        For the hotkey button it works !!! thank you so much

                                        I have managed to get the 2nd player working and the sound was here , unbelievable !
                                        But as the first time i set up the 2nd gamepad, up and down wasn't recognised and left and right reversed.

                                        So on my computer i went to retroarch.cfg and manually corrected these lines :

                                        input_player2_up_axis = "+3"
                                        input_player2_down = "nul"
                                        input_player2_down_btn = "nul"
                                        input_player2_down_axis = "-3"
                                        input_player2_left = "nul"
                                        input_player2_left_btn = "nul"
                                        input_player2_left_axis = "+0"
                                        input_player2_right = "nul"
                                        input_player2_right_btn = "nul"
                                        input_player2_right_axis = "-0"

                                        by :

                                        input_player2_up_axis = "+1"
                                        input_player2_down = "nul"
                                        input_player2_down_btn = "nul"
                                        input_player2_down_axis = "-1"
                                        input_player2_left = "nul"
                                        input_player2_left_btn = "nul"
                                        input_player2_left_axis = "-0"
                                        input_player2_right = "nul"
                                        input_player2_right_btn = "nul"
                                        input_player2_right_axis = "+0"

                                        After i've done it, the sound has disappeared again !!!!!!!! It still here in the menu, but not in game.

                                        So the issue comes from retroarch.cfg. I suppose that i can't modify it manually and that's what i did the first time also.

                                        I'm going to reinstall everything

                                        1 Reply Last reply Reply Quote 0
                                        • loujezL
                                          loujez
                                          last edited by loujez

                                          ok everything is working !!!! I have configured retroarch.cfg mapping from the cabinet. Before i was doing it with the help of my computer and my local network.

                                          Thank you again for your time. I just have to play with a hotbuton key working as never !!!

                                          Cheers from france

                                          simonsterS 1 Reply Last reply Reply Quote 0
                                          • simonsterS
                                            simonster @loujez
                                            last edited by

                                            @loujez

                                            I'm still not sure why you got the issue with Up/Down and Left/Right on the 2nd controller the first time, but I'm glad you got it all working.

                                            Si

                                            1 Reply Last reply Reply Quote 1
                                            • First post
                                              Last post

                                            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.