Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NESPi 4 Case Shutdown Scripts Not Working Correctly #90

Open
jasonkonen opened this issue Aug 15, 2020 · 32 comments · May be fixed by #107
Open

NESPi 4 Case Shutdown Scripts Not Working Correctly #90

jasonkonen opened this issue Aug 15, 2020 · 32 comments · May be fixed by #107

Comments

@jasonkonen
Copy link

When I hit the power button to shut down the system, it goes through the shutdown procedure, but it then reboots immediately.

@Olliek5
Copy link

Olliek5 commented Aug 16, 2020

Same problems on latest retropie and and light pi is image using NESPi 4

@Shaddowbad
Copy link

Hello I have the NESPI4 case with a Raspberry Pi 4 8GB. I installed the Safe Shutdown Script. If I switch off the case with the power button, it does not go off. It started all over again. The mistake needs to be heard around.

@crcerror
Copy link

This one will work!
https://github.com/crcerror/retroflag-picase

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

Uninstall for RetroPie
wget -O - "https://raw.githubusercontent.com/crcerror/retroflag-picase/master/uninstall_all.sh" | sudo bash

@noracegres
Copy link

This one will work!
https://github.com/crcerror/retroflag-picase

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

Uninstall for RetroPie
wget -O - "https://raw.githubusercontent.com/crcerror/retroflag-picase/master/uninstall_all.sh" | sudo bash

Hi crcerror, your patch works to shutdown the pi, but the fan his still running after shutdown, any idea ?

Thanks

@crcerror
Copy link

@noracegres Do you have an Pi4? You can try to add
dtoverlay=gpio-poweroff,gpiopin=4,active_low=1,input=1 to /boot/config.txt

@noracegres
Copy link

dtoverlay=gpio-poweroff,gpiopin=4,active_low=1,input=1

My bad, I forgot to mention that it was for the new nespi4 case.

Thanks, I'll try your config and come back.

@jeffsawatzky
Copy link

I made this PR which seemed to fix it for me (with my NESPi 4 Case):
#89

They've recently updated the code so now my PR has conflicts, but you can try something similar

@jeffsawatzky
Copy link

@jasonkonen @Olliek5 I just tried with the latest script that was updated after this issue was created. It seems to have fixed my issue, perhaps it will fix yours too.

Not sure if you need to uninstall the old script first (I did) before you can install the latest one though.

@OfficialPhilcomm
Copy link

This one will work!
https://github.com/crcerror/retroflag-picase
Install for RetroPie
wget -O - "https://raw.githubusercontent.com/crcerror/retroflag-picase/master/install.sh" | sudo bash
Uninstall for RetroPie
wget -O - "https://raw.githubusercontent.com/crcerror/retroflag-picase/master/uninstall_all.sh" | sudo bash

Hi crcerror, your patch works to shutdown the pi, but the fan his still running after shutdown, any idea ?

Thanks

In /opt/RetroFlag/SafeShutdown.py, replace the poweroff() method with

def poweroff():
	while True:
		#self.assertEqual(GPIO.input(powerPin), GPIO.LOW)
		GPIO.wait_for_edge(powerPin, GPIO.FALLING)
		GPIO.output(powerenPin, GPIO.LOW)
		os.system("sudo killall emulationstation")
		os.system("sudo killall emulationstatio") #RetroPie 4.6
		os.system("sudo sleep 5s")
		os.system("sudo shutdown -r now")

That does the trick for me.
I wanted to create a pull request for that fix, but the admins don't give the permission for open PRs

@crcerror
Copy link

crcerror commented Oct 7, 2020

You'll instantly lose power with this if you use the NESPi power button. If you're happy with this then go on.

@OfficialPhilcomm
Copy link

True, so nevermind, that is not the solution

@crcerror
Copy link

crcerror commented Oct 8, 2020

This one will work!
https://github.com/crcerror/retroflag-picase

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

Uninstall for RetroPie
wget -O - "https://raw.githubusercontent.com/crcerror/retroflag-picase/master/uninstall_all.sh" | sudo bash

@BenMcLean
Copy link

Yikes. Retroflag really needs to update this.

@FRM-CCA
Copy link

FRM-CCA commented Oct 24, 2020

Yes same problem on nespi 4 with ssd, batocera 5.27, button reset force reboot system but reboot always, button power shutdown system but reboot

tested with /boot/config.txt
dtoverlay=gpio-poweroff,gpiopin=4,active_low=1,input=1

tested with batocera.conf
system.power.switch=RETROFLAG

@crcerror
Copy link

User error - please uninstall retroflag script first or remove custom.sh file

@FRM-CCA
Copy link

FRM-CCA commented Oct 25, 2020

Thank you remove custom.sh, uninstall and reinstall, OK :)

@skulltre
Copy link

skulltre commented Nov 4, 2020

Hi guys, I'm new here. Been trying all the suggestions here but i couldn't get my Nespi 4 to shut down properly. My pi 4 8gb is already on the latest EEPROM and booting to retropie on SSD.

Firstly, I am told that the front panel LED lights will not function as long as the script is not running correctly if safe shutdown is set to ON, is this true? On off switch it lights up a constant red.

I first tried the script by retroflag, i can see the script is installed via ps aux | grep py . however the script wouldn't work, nor the LED lights. I have since tried uninstall and remove the SafeShutdown.py and the entry in /etc/rc.local and proceeded to reinstall - still no luck.

any ideas?

@SolidHyunkel
Copy link

SolidHyunkel commented Nov 18, 2020

Hey! The scripts didn't work for me neither... My setup is nespi 4 case, raspberry pi 4 8gb running the latest retropie. When are they going to patch this? It doesn't seem to be too hard.... Good luck to all!

@skulltre
Copy link

I recently managed to replace the control board of the Nespi4 case and the Retroflag script works. But the front panel LED lights would not work on my pi4 8gb. If the safeshutdown switch is set to off there will be LED lights on at front panel. Doing a clean uninstall and using crcerror's shutdown script never worked for my pi4 8gb either. I am now waiting for a pi4 4gb board to arrive to test.

@bezaban
Copy link

bezaban commented Dec 12, 2020

I've got a nespi4 case and a rpi4 8gb. I'm having similar issues. I've tried both crcerror and the official scripts.

Did a little bit of debugging and it seems it doesn't pick up the event or is listening on the wrong channel - as GPIO.wait_for_edge() never triggers @ https://github.com/RetroFlag/retroflag-picase/blob/master/SafeShutdown.py#L27

@rtarroyo
Copy link

I'm having a similar issue, using a RP4 4gb with Retropie, when I press the power off button it goes through the motions of shutting down an then reboots before actually shutting down.

Also, the fact that it shows the terminal before shutting off makes it ugly when you are going for the console experience, I'm trying some changes but so far nothing

@rtarroyo
Copy link

This one will work!
https://github.com/crcerror/retroflag-picase

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

Uninstall for RetroPie
wget -O - "https://raw.githubusercontent.com/crcerror/retroflag-picase/master/uninstall_all.sh" | sudo bash

This worked! Wow, thanks! But apparently it generates a conflict with emulationstation, that if you shutdown through it everything will crash

@nicolalamacchia nicolalamacchia linked a pull request Jan 11, 2021 that will close this issue
@bezaban
Copy link

bezaban commented Jan 12, 2021

I think the issue here (rebooting with -r) is worth fixing. I first suspected my issue was related, but after digging in it's clearly something entirely different. I have tested my nespi4 case with two different RPI 4s, tried a multitude of GPIO libraries, got in the middle with jumper wires and have excluded mostly everything than a faulty PCB.

I've ordered a replacement board and will try my luck.

I'm still a little confused on what role the "powerenpin" plays in this, but it seems clear that the power switch never produces a falling edge, yet I can short GPIO3 to ground and it works as expected. I've also realized that the RPI seems to power up on 5v input rather than shorting GPIO3.

Maybe a little misplaced here, but posting for posterity.

@LukeForData
Copy link

question, I installed RetroPie on an SD and I am in the command prompt attempting to use the command

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

but when typing it out, it shows as this for some reason ( " will show up as @, and | as ~), I have no idea what is going on

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

and of course spits out errors:
scheme missing
http://sudo/ resolving sudo (sudo): failed
wget: unable to resole host
resolving bash (bash): failed

@mickelsn
Copy link

question, I installed RetroPie on an SD and I am in the command prompt attempting to use the command

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

but when typing it out, it shows as this for some reason ( " will show up as @, and | as ~), I have no idea what is going on

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

and of course spits out errors:
scheme missing
http://sudo/ resolving sudo (sudo): failed
wget: unable to resole host
resolving bash (bash): failed

You need to go into the raspi-config menu and set your localization options to the correct keyboard. I believe the Raspberry Pi 4 ships configured default for Great Britain; I had to change to US (locale and keyboard) and this solved my problem.

@Lazyboi-93
Copy link

Amazing, thanks everyone. This was really helpful. Works as expected.

@jessieknifgt
Copy link

I have the same problem but I'm running Ubuntu 20.10 OS. I'm assuming this script is for the retro-pi OS. is there one i can use just for ubuntu?

@m0uh85
Copy link

m0uh85 commented Apr 30, 2021

I would like to use this case (NESPI 4) with Raspbian - is there any chance to get a working shudown script for Raspbian?

@Marsian9
Copy link

Marsian9 commented Jul 6, 2021

question when i turn off the power switch on nespi 4, it run the safe shutdown scripts but few sec the led comes back on and keep flashing every 5 sec, my led on the controller on and off every few sec, and the fan is on the whole time.
i have tried uninstall the safe shutdown scripts and reinstall it still same thing happen.
can anyone help?

@zero4281
Copy link

zero4281 commented Jul 6, 2021

question when i turn off the power switch on nespi 4, it run the safe shutdown scripts but few sec the led comes back on and keep flashing every 5 sec, my led on the controller on and off every few sec, and the fan is on the whole time.
i have tried uninstall the safe shutdown scripts and reinstall it still same thing happen.
can anyone help?

Try updating the firmware for the Pi and the case.

@Marsian9
Copy link

Marsian9 commented Jul 7, 2021

i did both firmware updated already

question when i turn off the power switch on nespi 4, it run the safe shutdown scripts but few sec the led comes back on and keep flashing every 5 sec, my led on the controller on and off every few sec, and the fan is on the whole time.
i have tried uninstall the safe shutdown scripts and reinstall it still same thing happen.
can anyone help?

Try updating the firmware for the Pi and the case.

i already updated both firmware

@deatheffect
Copy link

This one will work!
https://github.com/crcerror/retroflag-picase
Install for RetroPie
wget -O - "https://raw.githubusercontent.com/crcerror/retroflag-picase/master/install.sh" | sudo bash
Uninstall for RetroPie
wget -O - "https://raw.githubusercontent.com/crcerror/retroflag-picase/master/uninstall_all.sh" | sudo bash

Hi crcerror, your patch works to shutdown the pi, but the fan his still running after shutdown, any idea ?
Thanks

In /opt/RetroFlag/SafeShutdown.py, replace the poweroff() method with

def poweroff():
	while True:
		#self.assertEqual(GPIO.input(powerPin), GPIO.LOW)
		GPIO.wait_for_edge(powerPin, GPIO.FALLING)
		GPIO.output(powerenPin, GPIO.LOW)
		os.system("sudo killall emulationstation")
		os.system("sudo killall emulationstatio") #RetroPie 4.6
		os.system("sudo sleep 5s")
		os.system("sudo shutdown -r now")

That does the trick for me. I wanted to create a pull request for that fix, but the admins don't give the permission for open PRs

^^^^^^ using the stock retroflag script and commenting out / replacing the poweroff with this worked for me, thankyou dude!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.