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

    Pause when controller disconnects

    Scheduled Pinned Locked Moved Help and Support
    controllerretroarch
    13 Posts 4 Posters 1.7k 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.
    • SanoS
      Sano
      last edited by

      I just lost at puyo puyo because my PS3 controller ran out of battery. How frustrating !
      On the PS3/4, when the controller runs out of battery, the game automatically pause.
      Do you know if there is a retroarch option to emulate this (pause the game if a controller is disconnected) ?
      I looked in global and core option but found nothing.

      1 Reply Last reply Reply Quote 0
      • SanoS
        Sano
        last edited by

        Hi Guys, I didn't had any answer so maybe I'm the only one that have this issue.

        I searched though retroach options without finding anything like "pause when a controller disconnects".

        Nevertheless, after finding an UDEV solution for switching to TV when a controller is connected, I just realized that a similar rule when a controller is disconnected could pause the current game.

        The problem is I didn't find any way to either :

        • send a keystoke to retroarch current process (It doesn't accept standard input through /proc/"pid"/fd/0)
        • or command current retroach thrugh CLI

        So basically I'm stuck :)
        Does anyone has an idea ? Could named pipes work ? (It would require a change in retroarch launch script)

        The last resort would be to open a feature request on retroarch...

        1 Reply Last reply Reply Quote 0
        • SanoS
          Sano
          last edited by Sano

          Digging up this thread after 6 months and no answer :)

          After finding the feature described here https://retropie.org.uk/forum/topic/15283/damn-great-retroarch-feature-i-totally-missed

          I enabled the Network Control Interface feature, and just created a new UDEV rule :

          ACTION=="remove", SUBSYSTEM=="input", ENV{DEVNAME}=="/dev/input/js*", RUN+="/bin/bash -c '/bin/echo -n MENU_TOGGLE | /bin/nc -u -w1 127.0.0.1 55355'"
          

          And it works : Retroarch menu pops up (and game pause) if a controller disconnects.
          I won't loose again because an out of battery DS3 :)

          My 2 cents.

          Edit : note you can also pause the game by replacing MENU_TOGGLE by PAUSE_TOGGLE, but it's the retroach (not the in-game) pause, so you have to use a keyboard or the network command again to resume the game, hence I preferred the menu solution.

          D 1 Reply Last reply Reply Quote 4
          • C
            Chuck_B
            last edited by

            @sano said in Pause when controller disconnects:

            Digging up this thread after 6 months and no answer :)

            After finding the feature described here https://retropie.org.uk/forum/topic/15283/damn-great-retroarch-feature-i-totally-missed

            I enabled the Network Control Interface feature, and just created a new UDEV rule :

            ACTION=="remove", SUBSYSTEM=="input", ENV{DEVNAME}=="/dev/input/js*", RUN+="/bin/bash -c '/bin/echo -n MENU_TOGGLE | /bin/nc -u -w1 127.0.0.1 55355'"
            

            And it works : Retroarch menu pops up (and game pause) if a controller disconnects.
            I won't loose again because an out of battery DS3 :)

            My 2 cents.

            Edit : note you can also pause the game by replacing MENU_TOGGLE by PAUSE_TOGGLE, but it's the retroach (not the in-game) pause, so you have to use a keyboard or the network command again to resume the game, hence I preferred the menu solution.

            That's really interesting. Does it work with any kind of wireless controllers?

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

              @chuck_b said in Pause when controller disconnects:

              That's really interesting. Does it work with any kind of wireless controllers?

              It should work with any type of controller, the configuration makes it so that when a gamepad is disconnected, the menu is shown in RA.

              1 Reply Last reply Reply Quote 0
              • D
                dudumaroja @Sano
                last edited by

                @sano said in Pause when controller disconnects:

                ACTION=="remove", SUBSYSTEM=="input", ENV{DEVNAME}=="/dev/input/js*", RUN+="/bin/bash -c '/bin/echo -n MENU_TOGGLE | /bin/nc -u -w1 127.0.0.1 55355'"

                where exacly you add this command?

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

                  @dudumaroja Create a new file called /etc/udev/rules.d/01-rp-disconnect.rules and add the text in that file. Reboot and it should take effect.

                  C 1 Reply Last reply Reply Quote 0
                  • D
                    dudumaroja
                    last edited by

                    this work amazingly well.. this should be included with retropie.

                    1 Reply Last reply Reply Quote 1
                    • C
                      Chuck_B @mitu
                      last edited by

                      @mitu naming that file 01-rp-disconnect.rules is mandatory?

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

                        @chuck_b No, just the file extension has to be .rules , otherwise you can name it any way you want
                        From https://wiki.debian.org/udev:

                        [...] Files in there are parsed in alpha order, as long as the name ends with ".rules".

                        C 1 Reply Last reply Reply Quote 0
                        • C
                          Chuck_B @mitu
                          last edited by

                          @mitu I put the extension ".rules", but when i disconnect the controller the game doesn't pause.
                          I setted network_cmd_enable = "true" on retroarch.cfg

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

                            @chuck_b said in Pause when controller disconnects:

                            I setted network_cmd_enable = "true" on retroarch.cfg

                            Which config file ? This should be done in the global (/opt/retropie/configs/all/retroarch.cfg) file. Did you restart your system after adding the .rules file ? What controller are you using ?

                            1 Reply Last reply Reply Quote 0
                            • C
                              Chuck_B
                              last edited by

                              i solved. I forgot to remove the # before network_cmd_enable = "true" :)

                              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.