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

    Raspberry Pi Zero built into a NES Controller (Buttons won't work in Retroarch, but do work in Emulationstation) [SOLVED]

    Scheduled Pinned Locked Moved Help and Support
    17 Posts 4 Posters 6.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.
    • N
      NeoTrace
      last edited by NeoTrace

      Hey,

      i did build a Zero into an original NES Controller, wired up the Buttons (Up, Down, Left, ...., B, A) and created a dts-overlay so it will be recognized as a keyboard.

      The Buttons work in Emulationstation and in the Ports, but i cant get them to work in Retroarch (NES/SNES/Megadrive...)

      i did find this tutorial but i think im missing something important https://hackaday.io/post/28804

      Did even try to map the keys directly in retroarch, but it wont recognize and button press, the attached USB keyboard works, which sends the same commands

      If i reconfigure the Controller it shows up as keyboard and it doesnt matter if i press the keyboard or the buttons on the NES they act like the same

      Any help is appreciated!!

      alt text

      br
      NeoTrace

      meleuM 1 Reply Last reply Reply Quote 0
      • meleuM
        meleu @NeoTrace
        last edited by meleu

        @NeoTrace
        Wow! Great work! :-)

        I'm not sure, but I think this issue have something related to the input_libretro_device_p1 option in retroarch.cfg. I've read these comments in the file, and I think it can help you to solve your problem.

        Try to set it to 3 and see if it works, like this:

        input_libretro_device_p1 = 3
        
        • Useful topics
        • joystick-selection tool
        • rpie-art tool
        • achievements I made
        1 Reply Last reply Reply Quote 0
        • N
          NeoTrace
          last edited by

          Thanks for the tip
          I do think I have tried that before but I will give it another try

          1 Reply Last reply Reply Quote 0
          • N
            NeoTrace
            last edited by

            any other suggestions?

            meleuM mediamogulM 2 Replies Last reply Reply Quote 0
            • meleuM
              meleu @NeoTrace
              last edited by meleu

              @NeoTrace sorry for the lack of a concrete help, I'm away from my RetroPie now. But I suggest you to search in the RGUI Settings -> Input section for something related to your problem.

              • Useful topics
              • joystick-selection tool
              • rpie-art tool
              • achievements I made
              1 Reply Last reply Reply Quote 0
              • mediamogulM
                mediamogul Global Moderator @NeoTrace
                last edited by mediamogul

                @NeoTrace

                If I'm understanding you correctly, it seems as though your controller is configured as a series of keyboard keys. RetroArch can be a bit picky about what it sees as a keyboard. I have a few controllers mapped to keyboard keys and I have to add a udev rule that makes sure the device is actually seen as a keyboard at a system level.

                The rule I use is:

                SUBSYSTEM=="input", ATTRS{name}=="The Name of Your Device Goes Here", GROUP="users", MODE="0666", ENV{ID_INPUT_KEYBOARD}="1"
                

                Edit: If this does apply to you and you are unfamiliar with creating a udev rule, I can walk you through it.

                RetroPie v4.5 • RPi3 Model B • 5.1V 2.5A PSU • 16GB SanDisk microSD • 512GB External Drive

                1 Reply Last reply Reply Quote 0
                • N
                  NeoTrace
                  last edited by

                  the thing is the usb keyboard attached which sends the same signals do work in retroarch.

                  does your tip the trick?

                  mediamogulM 1 Reply Last reply Reply Quote 0
                  • mediamogulM
                    mediamogul Global Moderator @NeoTrace
                    last edited by

                    @NeoTrace

                    It worked for me in what seems to be similar circumstances, but our situations may be different. The easiest way to find out is to try it. You can always remove the udev rule if you need to.

                    RetroPie v4.5 • RPi3 Model B • 5.1V 2.5A PSU • 16GB SanDisk microSD • 512GB External Drive

                    1 Reply Last reply Reply Quote 1
                    • N
                      NeoTrace
                      last edited by

                      allright then :)

                      silly question where do i put this?

                      mediamogulM 1 Reply Last reply Reply Quote 0
                      • mediamogulM
                        mediamogul Global Moderator @NeoTrace
                        last edited by mediamogul

                        @NeoTrace said in Raspberry Pi Zero built into a NES Controller (Buttons won't work in Retroarch, but do work in Emulationstation):

                        silly question where do i put this?

                        Not silly at all.

                        First, drop to the command line by pressing the 'F4' key on your keyboard. from there type:

                        sudo nano /etc/udev/rules.d/99-keyboard.rules
                        

                        Press enter and then type the rule into the empty field as follows:

                        SUBSYSTEM=="input", ATTRS{name}=="The Name of Your Device Goes Here", GROUP="users", MODE="0666", ENV{ID_INPUT_KEYBOARD}="1"
                        

                        If you need to get the name of your device, do a 'evtest' on the proper event listing at /dev/input/ and the name will be at the top. If you need to know more about that I can elaborate. Next, save the rule and close it out by pressing 'ctrl+o' to save, 'enter' to confirm and 'ctrl+x' to exit. Finally, type:

                        sudo reboot
                        

                        Press enter and when it reboots, you should be able to enter RetroArch and test to see if the controls are recognized. You might have to remap in Emulation Station also, but I don't think it will be necessary. It's also worth repeating for others who might try this, that this trick is specifically intended for a controller device that is already configured to present itself as a keyboard, but fails to be recognized as a keyboard by some software.

                        RetroPie v4.5 • RPi3 Model B • 5.1V 2.5A PSU • 16GB SanDisk microSD • 512GB External Drive

                        K 1 Reply Last reply Reply Quote 1
                        • N
                          NeoTrace
                          last edited by

                          thank you, will try it out in a second :)

                          1 Reply Last reply Reply Quote 0
                          • N
                            NeoTrace
                            last edited by

                            Thank you so much, that did the trick!
                            Working now :)

                            1 Reply Last reply Reply Quote 0
                            • K
                              KairosZenith @mediamogul
                              last edited by KairosZenith

                              @mediamogul Hey, i'm kinda new to this and having the same problem. Wired up with GPIOs, compiled the overlay, and is working in ES, but it's not working within the emulators. i did what you said above, but since i'm not a pro at this, i'm not sure if i typed it and executed it correctly. Do i change any of the other quotes besides the Device Name (which is retropie by default, right)?

                              i've mapped the buttons again in ES and restarted the Pi a couple of times. i tried mapping it inside of the RetroArch menu too, but the button presses won't register in there, only in ES. The funny thing is that i noticed it registers the button presses for the USB controller as the same keyboard presses that i have my GPIO controller buttons set at. I'm doing all this with a Pi Zero that i'm trying to fit inside a NES controller :) Thanks for any help.

                              mediamogulM 1 Reply Last reply Reply Quote 0
                              • mediamogulM
                                mediamogul Global Moderator @KairosZenith
                                last edited by mediamogul

                                @KairosZenith said in Raspberry Pi Zero built into a NES Controller (Buttons won't work in Retroarch, but do work in Emulationstation) [SOLVED]:

                                Do i change any of the other quotes besides the Device Name (which is retropie by default, right)?

                                The device name is actually not 'retropie', but instead the name of your specific input device. You can get that name using evtest. The full command is evtest /dev/input/eventX, with 'X' being the event number of your device. The resulting text output from the command will list the name at the top.

                                RetroPie v4.5 • RPi3 Model B • 5.1V 2.5A PSU • 16GB SanDisk microSD • 512GB External Drive

                                K 1 Reply Last reply Reply Quote 0
                                • N
                                  NeoTrace
                                  last edited by

                                  everything has been said :D

                                  1 Reply Last reply Reply Quote 0
                                  • K
                                    KairosZenith @mediamogul
                                    last edited by KairosZenith

                                    @mediamogul Thank you so much for the fast reply, that worked :)

                                    That made sense, i feel so foolish, lol. i should've known you were talking about the input device because that's what the discussion was about. The name for it was "gpio_keys".

                                    mediamogulM 1 Reply Last reply Reply Quote 0
                                    • mediamogulM
                                      mediamogul Global Moderator @KairosZenith
                                      last edited by

                                      @KairosZenith

                                      Nice! I'm glad it worked.

                                      RetroPie v4.5 • RPi3 Model B • 5.1V 2.5A PSU • 16GB SanDisk microSD • 512GB External Drive

                                      1 Reply Last reply Reply Quote 0
                                      • 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.