Ah thanks for posting that, I’ll have to check it out too! I am planning on using a momentary push button to power on/off my pi (building an arcade stick). Does the control block only work with a toggle switch?
I have experience booting a pi2 and exiting emulators using a push button. The code I link to below could easily be adapted to shutdown the system as well. A toggle isn’t necessary, just a momentary push button is all that’s required.
All you need is a push button connected to gpio3. You may have problems shutting down your emulators if you use a script running shutdown -h now all by itself. I suggest for you to check out THIS post.
That piece of code shuts down the emulators gracefully so you don’t lose hi scores and it properly saves SRM’s
You could add the following code to the code in the link detailed above
os.system('shutdown -h now')
Insert that code right after device.emit(uinput.KEY_ESC,0)
In config.txt under /boot , add the line
That button will then boot up your pi and shut down your system and emulators gracefully.
I use it, its perfect. I bought the “use your own switch” and have it wired to an original nintendo switch. It does a complete perfect shut down. I wouldnt use anything else myself (I’m building a SNES currently and will be using it there too).
Only gripe I have, which probably is with all switches, is that it doesnt exit emulationstation before running the shut down command, so although the game saves save, the meta data (play count, etc.) doesnt. I believe if you add to the switch’s shut down command “kill emulationstation” it will work, but I havent played with that yet