Shutdown Button Only Works Sometimes...
-
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.
-
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!
-
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"
fiexit 0
-
@XD3l use a code block for code so it's displayed correctly.
-
@BuZz said in Shutdown Button Only Works Sometimes...:
@XD3l use a code block for code so it's displayed correctly.
Sure thing... but how? :)
-
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 ```
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.