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

    Shutdown Button Only Works Sometimes...

    Scheduled Pinned Locked Moved Help and Support
    pi zero
    6 Posts 2 Posters 1.6k 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.
    • XD3lX
      XD3l
      last edited by XD3l

      I am having trouble with one of my Pi Zero's. I can light a LED off of it, but can get it to respond to a Shutdown Button.

      I followed this guide:

      https://www.element14.com/community/docs/DOC-78055/l/adding-a-shutdown-button-to-the-raspberry-pi-b

      And am able to put the SD card in one of my Pi Zero's, connect the Shutdown button, and it works. Though on another Pi it does not. I have tried different Pins and the results are always the same.

      EDIT: I have noticed that this is only when I have a USB device soldered directly to the Pi Zero. If I unsolder the USB device (in this case a MayFlash Wii to USB adapter), then the GPIO pins work for the Shutdown button. Though again the LED will work either way.

      EDIT 2: In fact any time something is plugged into the USB port the Shutdown button ceases to work....

      EDIT 3: In fact the Shutdown button only seems to work when a USB HUB is plugged into the Pi. This is strange.

      1 Reply Last reply Reply Quote 0
      • XD3lX
        XD3l
        last edited by

        I narrowed it down. Turns out that the Shutdown button will only work when I boot connected to the Internet. If I boot in off-line mode then go on-line, it still will not work. I have to boot ready for it to connect.

        This is strange!

        1 Reply Last reply Reply Quote 0
        • XD3lX
          XD3l
          last edited by

          Resolved:

          My rc.local script was arranged wrong.

          I had my shut down script after the bit about the network and not before. Therefore if no network was detected, then the Shutdown script would never be activated.

          Shutdown Button

          sudo python /home/pi/scripts/shutdown_pi.py &

          Print the IP address

          _IP=$(hostname -I) || true
          if [ "$_IP" ]; then
          printf "My IP address is %s\n" "$_IP"
          fi

          exit 0

          BuZzB 1 Reply Last reply Reply Quote 0
          • BuZzB
            BuZz administrators @XD3l
            last edited by

            @XD3l use a code block for code so it's displayed correctly.

            To help us help you - please make sure you read the sticky topics before posting - https://retropie.org.uk/forum/topic/3/read-this-first

            XD3lX 1 Reply Last reply Reply Quote 0
            • XD3lX
              XD3l @BuZz
              last edited by

              @BuZz said in Shutdown Button Only Works Sometimes...:

              @XD3l use a code block for code so it's displayed correctly.

              Sure thing... but how? :)

              1 Reply Last reply Reply Quote 0
              • BuZzB
                BuZz administrators
                last edited by BuZz

                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 (links off to how to do it). There is also a help link when writing a post (compose ?) at the top right of the edit box.

                code sections use three backticks above and below the code block ```

                To help us help you - please make sure you read the sticky topics before posting - https://retropie.org.uk/forum/topic/3/read-this-first

                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.