forked from audiophonics/Raspberry-pwr-management
-
Notifications
You must be signed in to change notification settings - Fork 0
/
runeaudio.sds.sh
31 lines (26 loc) · 817 Bytes
/
runeaudio.sds.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
#Thanks to Hondagx35
#http://www.runeaudio.com/forum/audiophonics-i-sabre-v3-dac-es9023-tcxo-t3377.html#p13106
#http://www.runeaudio.com/forum/audiophonics-i-sabre-v3-dac-es9023-tcxo-t3377-20.html#p13195
PATH=/bin:/usr/bin:/usr/bin/gpio
echo "Audiophonics Shutdown script starting..."
echo "Asserting pins : "
echo "ShutDown : GPIO17=in, Low"
echo "BootOK : GPIO22=out, High"
echo "SoftSD : GPIO04=out, Low"
gpio -g mode 04 out
gpio -g write 04 0
gpio -g mode 17 in
gpio -g write 17 0
gpio -g mode 22 out
gpio -g write 22 1
while [ 1 ]; do
if [ "$(/usr/bin/gpio -g read 17)" = "1" ]; then
echo "ShutDown order received, RaspBerry pi will now enter in standby mode..."
/var/www/command/rune_shutdown poweroff
systemctl poweroff
break
fi
/bin/sleep 0.25
done
exit 0