RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login

    Multi Switch Shutdown Script!

    Scheduled Pinned Locked Moved Ideas and Development
    shutdown scriptshutdown switchcyperghost
    272 Posts 40 Posters 111.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.
    • cnotoC
      cnoto
      last edited by cnoto

      @cyperghost I am using your generic script above for a shutdown with a momentary button on a pi3a and Im seeing the following message:

      Kernel panic - not syncing attempting to kill init!

      Any thoughts why im seeing this?

      Many Thanks,

      1 Reply Last reply Reply Quote 0
      • IdelacioI
        Idelacio @cyperghost
        last edited by

        @cyperghost

        Oops, sorry for the slow reply.

        Yup! That worked perfectly. Thanks! <3

        1 Reply Last reply Reply Quote 0
        • ExarKunIvE
          ExarKunIv
          last edited by

          @cyperghost I have used this to shutdown my pi.
          But i have come across a few posts saying that it can be used to shutdown a emulator or restart ES.

          Can it be used to finishing killing xinit after exiting a game?

          RPi3B+ / 200GB/ RetroPie v4.5.14, RPi4 Model B 4gb / 256gb / RetroPie 4.8.2
          RPi5 4gb / 512gb / RetroPie 4.8.9 -Basic
          Maintainer of RetroPie-Extra .

          cyperghostC 1 Reply Last reply Reply Quote 0
          • cyperghostC
            cyperghost @ExarKunIv
            last edited by

            @exarkuniv as long as the call is

            1. Runcommand.sh
            2. Xinit
            3. X Application
              And all calls are children of the shell parent process then it is very likely that it will work. But never tested before
            ExarKunIvE 1 Reply Last reply Reply Quote 0
            • ExarKunIvE
              ExarKunIv @cyperghost
              last edited by

              @cyperghost yes i have the command going through run command to lunch the game

              here is my command that i have for my emulator.sh

              dhewm3 = "XINIT:/opt/retropie/ports/dhewm3/dhewm3"
              default = "dhewm3"
              
              

              so i know that it calls it correctly. well i think it does

              what do i need to do to set the shutdown script up. i have tried to follow your info as best as i could and i still get lost on it.

              RPi3B+ / 200GB/ RetroPie v4.5.14, RPi4 Model B 4gb / 256gb / RetroPie 4.8.2
              RPi5 4gb / 512gb / RetroPie 4.8.9 -Basic
              Maintainer of RetroPie-Extra .

              quicksilverQ 1 Reply Last reply Reply Quote 0
              • quicksilverQ
                quicksilver @ExarKunIv
                last edited by quicksilver

                @exarkuniv there is an issue with dhewm3 that the x window does not close properly after exiting the game. I was going to report it on the github page but never got around to it. It's likely to be a raspberry pi related issue or it could be because we aren't running a full desktop environment. Not sure if the dev would/could help.

                There is a setting you can turn on via raspi-config that allows you to kill an x session using cntrl+alt+backspace. That was my workaround when trying to close dhewm3.

                ExarKunIvE 1 Reply Last reply Reply Quote 0
                • ExarKunIvE
                  ExarKunIv @quicksilver
                  last edited by

                  @quicksilver thanks for the idea. i managed to get my kill script to work and map my hot keys with Xboxdrv to start it so now my game/ports now exit quickly. but ill remember that if i end up needing it down the road

                  RPi3B+ / 200GB/ RetroPie v4.5.14, RPi4 Model B 4gb / 256gb / RetroPie 4.8.2
                  RPi5 4gb / 512gb / RetroPie 4.8.9 -Basic
                  Maintainer of RetroPie-Extra .

                  1 Reply Last reply Reply Quote 0
                  • V
                    vwgolfman
                    last edited by vwgolfman

                    @cyperghost
                    Hello and thank you so much for all your hard work in creating the fantastic scripts that you do.

                    I have built a dual joystick controller with a Raspberry Pi 4 inside.
                    It is running Retropie 4.7.1
                    I have a button wired to pins 5 and 6 of the GPIO Header which shorts those pins when the button is pressed.

                    I would like to use this button as my safe shutdown button.

                    Please can you tell me whether your script will be good for this and if so should I install using...

                    wget -O - "https://raw.githubusercontent.com/crcerror/retroflag-picase/master/install.sh" | sudo bash

                    Many thanks once again for any help.

                    cyperghostC 1 Reply Last reply Reply Quote 0
                    • WeirdHW WeirdH referenced this topic on
                    • WeirdHW WeirdH referenced this topic on
                    • cyperghostC
                      cyperghost @vwgolfman
                      last edited by cyperghost

                      @vwgolfman You are using the "wrong" script for this. Please visit https://github.com/crcerror/ES-generic-shutdown

                      There is a dedicated command line option for a single GPIO button. The Retroflag script is just a small subset of the one linked above.

                      Edit:
                      Did forget, I wrote small walk-through already here: https://retropie.org.uk/forum/topic/17415/multi-switch-shutdown-script

                      V 1 Reply Last reply Reply Quote 0
                      • IdelacioI
                        Idelacio
                        last edited by Idelacio

                        On resetting games with the reset button I'm getting the following error:
                        /home/pi/RetroPie/scripts/multi_switch.sh: line 63: kill: (####) - No Such Process

                        Where #### is the process number.

                        It also producses the following message on closing the process:
                        Killed

                        As it looks messy having persistant messages like these show between screens is there a clean way to hide them?

                        I don't want to completely prevent error messages showing as sometimes I do screw up so just these ones specifically. If it's all or nothing though I'll just have to accept that.

                        1 Reply Last reply Reply Quote 0
                        • V
                          vwgolfman @cyperghost
                          last edited by

                          @cyperghost
                          Thank you so much, your coding is fantastic and I am now using your safe shutdown script successfully!

                          Could I please ask, is there a version which monitors the shutdown button continuously rather than polling it every second or so?

                          1 Reply Last reply Reply Quote 0
                          • cnotoC
                            cnoto
                            last edited by

                            @cyperghost I just used this script for a generic button on a zero 2 with no luck. Would anything be different about the pi zero 2?

                            1 Reply Last reply Reply Quote 0
                            • AshpoolA Ashpool referenced this topic on
                            • daniluxD
                              danilux
                              last edited by

                              @cyperghost Hi sweet man :v, I wanted to know if you think that by modifying the paths in your install instructions I could make your script work on batocera, since it's emulation station same as retropie, I have a generic button I want to use to save shut down, any help is appreciated

                              1 Reply Last reply Reply Quote 0
                              • ExarKunIvE ExarKunIv referenced this topic on
                              • B
                                BlackDraGoN 0
                                last edited by

                                I have got this error on my Raspberry pi 3b+:

                                DTOVERLAY[error]: failed to open 'RetroFlag_pw_io.dtbo'

                                Failed to read 'RetroFlag_pw_io.dtbo'
                                

                                What Can I do?

                                The file is installed in the correct place, in fact, I installed it with the installer and checked that everything was correct, but the dto does not load it.

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

                                  @BlackDraGoN-0 That error is not from @cyperghost's script, the script doesn't have any references to that .dtbo file.

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

                                    My pins are always level=0 fsel=0 func=INPUT how can I change level 1 when I press a button?

                                    1 Reply Last reply Reply Quote 0
                                    • B
                                      BlackDraGoN 0 @mitu
                                      last edited by

                                      @mitu I have done a clean installation of RetroPie, and I have installed the multiswitch, but every time the leds come on and it turns off. I have a Nespicase+ and a Raspberry Pi 3B+. I have also tried with the original retroflag script and the same thing happens.

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

                                        When I install the script, the nespicase+ always turns off. My Nespicase has a Reset button that is a push button, but the Off button is one of those that stays pressed when pressed, and I have to press it again to get it out.

                                        mituM AshpoolA 2 Replies Last reply Reply Quote 0
                                        • mituM
                                          mitu Global Moderator @BlackDraGoN 0
                                          last edited by

                                          @BlackDraGoN-0 I'm not familiar with the case, but I remember you had to activate a switch in order to have the script functional - https://retroflag.com/download/NESPi_CASE+_Manual.pdf mentions this switch and I presume it has to be switched ON (default is OFF).

                                          B 1 Reply Last reply Reply Quote 0
                                          • B
                                            BlackDraGoN 0 @mitu
                                            last edited by

                                            @mitu I have got the switch in ON.

                                            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.