Here’s how I have the power control circuit set up.
[attachment file=”power wiring.jpg”]
I’m using a Powerboost Charger 500 circuit from Adafruit, which made the power control circuit fairly easy to build. I did have to desolder the pull-up resistor on the powerboost enable line to prevent it from turning on all the time. This circuit uses GPIO14 (the UART TX line on the Pi) as part of the latch circuit. Pressing the power button momentarily brings the enable line high, then the output from pin GPIO causes the latch to stay on. When I shut down the Pi through the Emulationstation menu, GPIO14 is brought low when shutdown is complete, which discharges the 10uF capacitor and pulls the enable line to shut power off. You can also manually turn it off by holding the power button down for about 3 seconds.
I don’t have any feedback from the power button to the Pi to trigger software shutdown when the button is pressed, although that wouldn’t be hard to add if I wanted it. Shutting down through the menu seems to work fine for me, and the current setup doesn’t require any software modification to work.