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

    USB Encoder Mapping

    Scheduled Pinned Locked Moved Help and Support
    usb encoderkey mappingexit button
    27 Posts 2 Posters 2.4k 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.
    • B
      bpm009
      last edited by bpm009

      Ok, using SSH I ran the script and it did not send a pause command to the game running.

      Just to clarify, I went into the SSH terminal to the directory and entered ./pause-ra.sh which I believe is the correct method.

      I used the code you explained in the other post shown below for the pause-ra.sh script.

      #!/bin/bash
      echo -n "PAUSE_TOGGLE" | nc -d -u -w1 127.0.0.1 55355
      
      
      mituM 1 Reply Last reply Reply Quote 0
      • mituM
        mitu Global Moderator @bpm009
        last edited by

        @bpm009 OK, did you modify the retroarch.cfg file to enable network input, like explained in the post ?

        1 Reply Last reply Reply Quote 0
        • B
          bpm009
          last edited by

          Yes, I added the following line to the end of the retroarch.cfg file.

          network_cmd_enable = "true"
          
          1 Reply Last reply Reply Quote 0
          • mituM
            mitu Global Moderator
            last edited by

            @bpm009 said in USB Encoder Mapping:

            #!/bin/bash
            echo -n "PAUSE_TOGGLE" | nc -d -u -w1 127.0.0.1 55355

            Modify the script to

            #!/bin/bash
            echo -n "PAUSE_TOGGLE" | nc -u -w1 127.0.0.1 55355
            

            I think I added an extra parameter that doesn't do what it should.

            1 Reply Last reply Reply Quote 0
            • B
              bpm009
              last edited by

              Still no luck when running the script directly.

              1 Reply Last reply Reply Quote 0
              • mituM
                mitu Global Moderator
                last edited by

                Works for me - are you sure you're running a RetroArch emulator ? What game are you starting and what emulator appears in the launch command message ?

                1 Reply Last reply Reply Quote 0
                • B
                  bpm009
                  last edited by

                  Not 100% sure.I am running super mario kart and the SNES9X emulator.

                  1 Reply Last reply Reply Quote 0
                  • mituM
                    mitu Global Moderator
                    last edited by

                    When you start the game, there's the launch command 'splash', displaying the game and the emulator run:

                    What does it say when you start yours ?

                    1 Reply Last reply Reply Quote 0
                    • B
                      bpm009
                      last edited by

                      Mine says Super Mario Kart (USA) lr-snes9x2010.

                      1 Reply Last reply Reply Quote 0
                      • mituM
                        mitu Global Moderator
                        last edited by

                        Then it's using lr-snes9x2010 as emulator, which is a RetroArch core. I don't understand why it's not working - you can try adding the RetroArch network input config to \\retropie\configs\snes\retroarch.cfg, just in case you saved the configuration from the RGUI.

                        1 Reply Last reply Reply Quote 0
                        • B
                          bpm009
                          last edited by bpm009

                          Ok, good to know. I added the network input config to the snes config file. That still shouldn't have mattered when running the pause-ra.sh script in the terminal because isn't that simply running the PAUSE command the same as if I were running it in the game?

                          Edit: Ignore what I said above, that did the trick, I must have edited some configuration through the RGUI as you mentioned. You are awesome mitu. Can confirm everything from running in the terminal to pressing the P key does what it should do.

                          1 Reply Last reply Reply Quote 0
                          • B
                            bpm009
                            last edited by

                            Now for my usecase I need to find a way to replace KEY_P 1 with a controller button that I want to have linked to a dedicated P4 or P5 (if possible) position. If I assigned the KEY_P to say "button 11" which no other controller of mine has, that should work right?

                            1 Reply Last reply Reply Quote 0
                            • mituM
                              mitu Global Moderator
                              last edited by mitu

                              It should work, though you'll have to find out the event that triggers that. To find out the the right event, you need to:

                              • get the event device for the controller. Run cat /proc/bus/input/devices and note the /dev/input/eventX device of the controller you want to use. Let's say is /dev/input/event2.
                              • run thd --dump /dev/input/event2 from the terminal. Press the button and the event shold be shown on the screen:
                              thd --dump /dev/input/event2
                              EV_KEY  BTN_B   1       /dev/input/event2
                              # BTN_B 1       command
                              

                              Press Ctrl+C to stop.
                              The event name is shown on the 2nd (commented) line - BTN_B, since I pressed the B button on my gamepad. Replace the KEY_P with the corresponding BTN_ event and it should work. Make sure to restart the service after re-configuration (sudo systemctl restart triggerhappy).

                              1 Reply Last reply Reply Quote 0
                              • B
                                bpm009
                                last edited by

                                Everything worked flawlessly, I really appreciate the event lookup code, I never would have figured that out. I did notice that if a hotkey was enabled that it does not work which I believe you mentioned in the other thread. All in all it does exactly what I wanted it to do.

                                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.