I got a question wether its possible to shut-down the BBB safely via the push button
(in contrast to a brute "Reset" or "Power-Off)
> In the FAQ it mentions it's not been a problem just cutting power to the BBB without a
> safe shutdown.
That is probably true, but would it be possible to trigger a
> safe shutdown by monitoring the pushbutton switch that's wired to an IO
> (not the RESET one) to do a safe shutdown?
I don't normally have a console
> connected to the BBB so this would be a nice way to trigger it before
> turning off the power if the switch is not used for anything else.
This bash-script should help.
Its be run in background, started in .profile.
# This script monitors the push button on a UniBone/QBone
# and issues a shutdown when pressed.
# 1.The pushbutton is connected to P8.12, GPIO1_12
# It can be queried via the filesystem:
# Its Linux GPIO nr is 32+12 = 44
# Setup GPIO as input
echo 44 >$GPIO_ROOT/export 2>/dev/null
echo in >$GPIO_ROOT/gpio44/direction
echo "Press UniBone/QBone push button 1-2 seconds to shutdown."
while [ $state -eq 0 ]
# 1st sample
if [ $state -eq 1 ]
# press detected: 2nd sample
# only reached when button pressed: bye!
echo "UniBone/QBone push button press detected ... shutting down!"
shutdown --poweroff --no-wall +0